Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(456)

Unified Diff: chrome/browser/search_engines/template_url_parser_unittest.cc

Issue 9968016: Move the URL string from TemplateURLRef onto the owning TemplateURL. This will make it easier to m… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/template_url_parser_unittest.cc
===================================================================
--- chrome/browser/search_engines/template_url_parser_unittest.cc (revision 130285)
+++ chrome/browser/search_engines/template_url_parser_unittest.cc (working copy)
@@ -135,10 +135,9 @@
EXPECT_EQ(ASCIIToUTF16("Dictionary.com"), template_url_->short_name());
EXPECT_EQ(GURL("http://cache.lexico.com/g/d/favicon.ico"),
template_url_->favicon_url());
- ASSERT_FALSE(template_url_->url() == NULL);
- EXPECT_TRUE(template_url_->url()->SupportsReplacement());
+ EXPECT_TRUE(template_url_->url_ref().SupportsReplacement());
EXPECT_EQ("http://dictionary.reference.com/browse/{searchTerms}?r=75",
- template_url_->url()->url());
+ template_url_->url());
}
TEST_F(TemplateURLParserTest, TestMSDN) {
@@ -149,11 +148,10 @@
EXPECT_EQ(ASCIIToUTF16("Search \" MSDN"), template_url_->short_name());
EXPECT_EQ(GURL("http://search.msdn.microsoft.com/search/favicon.ico"),
template_url_->favicon_url());
- ASSERT_FALSE(template_url_->url() == NULL);
- EXPECT_TRUE(template_url_->url()->SupportsReplacement());
+ EXPECT_TRUE(template_url_->url_ref().SupportsReplacement());
EXPECT_EQ("http://search.msdn.microsoft.com/search/default.aspx?"
"Query={searchTerms}&brand=msdn&locale=en-US",
- template_url_->url()->url());
+ template_url_->url());
}
TEST_F(TemplateURLParserTest, TestWikipedia) {
@@ -164,16 +162,14 @@
EXPECT_EQ(ASCIIToUTF16("Wikipedia (English)"), template_url_->short_name());
EXPECT_EQ(GURL("http://en.wikipedia.org/favicon.ico"),
template_url_->favicon_url());
- ASSERT_FALSE(template_url_->url() == NULL);
- EXPECT_TRUE(template_url_->url()->SupportsReplacement());
+ EXPECT_TRUE(template_url_->url_ref().SupportsReplacement());
EXPECT_EQ("http://en.wikipedia.org/w/index.php?"
"title=Special:Search&search={searchTerms}",
- template_url_->url()->url());
- ASSERT_FALSE(template_url_->suggestions_url() == NULL);
- EXPECT_TRUE(template_url_->suggestions_url()->SupportsReplacement());
+ template_url_->url());
+ EXPECT_TRUE(template_url_->suggestions_url_ref().SupportsReplacement());
EXPECT_EQ("http://en.wikipedia.org/w/api.php?"
"action=opensearch&search={searchTerms}",
- template_url_->suggestions_url()->url());
+ template_url_->suggestions_url());
ASSERT_EQ(2U, template_url_->input_encodings().size());
EXPECT_EQ("UTF-8", template_url_->input_encodings()[0]);
EXPECT_EQ("Shift_JIS", template_url_->input_encodings()[1]);
@@ -194,12 +190,11 @@
ASSERT_NO_FATAL_FAILURE(ParseFile("firefox_ebay.xml", &filter));
ASSERT_TRUE(template_url_.get());
EXPECT_EQ(ASCIIToUTF16("eBay"), template_url_->short_name());
- ASSERT_FALSE(template_url_->url() == NULL);
- EXPECT_TRUE(template_url_->url()->SupportsReplacement());
+ EXPECT_TRUE(template_url_->url_ref().SupportsReplacement());
EXPECT_EQ("http://search.ebay.com/search/search.dll?query={searchTerms}&"
"MfcISAPICommand=GetResult&ht=1&srchdesc=n&maxRecordsReturned=300&"
"maxRecordsPerPage=50&SortProperty=MetaEndSort",
- template_url_->url()->url());
+ template_url_->url());
ASSERT_EQ(1U, template_url_->input_encodings().size());
EXPECT_EQ("ISO-8859-1", template_url_->input_encodings()[0]);
EXPECT_EQ(GURL("http://search.ebay.com/favicon.ico"),
@@ -214,10 +209,9 @@
ASSERT_NO_FATAL_FAILURE(ParseFile("firefox_webster.xml", &filter));
ASSERT_TRUE(template_url_.get());
EXPECT_EQ(ASCIIToUTF16("Webster"), template_url_->short_name());
- ASSERT_FALSE(template_url_->url() == NULL);
- EXPECT_TRUE(template_url_->url()->SupportsReplacement());
+ EXPECT_TRUE(template_url_->url_ref().SupportsReplacement());
EXPECT_EQ("http://www.webster.com/cgi-bin/dictionary?va={searchTerms}",
- template_url_->url()->url());
+ template_url_->url());
ASSERT_EQ(1U, template_url_->input_encodings().size());
EXPECT_EQ("ISO-8859-1", template_url_->input_encodings()[0]);
EXPECT_EQ(GURL("http://www.webster.com/favicon.ico"),
@@ -232,13 +226,12 @@
ASSERT_NO_FATAL_FAILURE(ParseFile("firefox_yahoo.xml", &filter));
ASSERT_TRUE(template_url_.get());
EXPECT_EQ(ASCIIToUTF16("Yahoo"), template_url_->short_name());
- ASSERT_FALSE(template_url_->url() == NULL);
- EXPECT_TRUE(template_url_->url()->SupportsReplacement());
+ EXPECT_TRUE(template_url_->url_ref().SupportsReplacement());
EXPECT_EQ("http://ff.search.yahoo.com/gossip?"
"output=fxjson&command={searchTerms}",
- template_url_->suggestions_url()->url());
+ template_url_->suggestions_url());
EXPECT_EQ("http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8",
- template_url_->url()->url());
+ template_url_->url());
ASSERT_EQ(1U, template_url_->input_encodings().size());
EXPECT_EQ("UTF-8", template_url_->input_encodings()[0]);
EXPECT_EQ(GURL("http://search.yahoo.com/favicon.ico"),
@@ -255,11 +248,10 @@
ASSERT_NO_FATAL_FAILURE(ParseFile("post_suggestion.xml", &filter));
ASSERT_TRUE(template_url_.get());
EXPECT_EQ(ASCIIToUTF16("Yahoo"), template_url_->short_name());
- ASSERT_FALSE(template_url_->url() == NULL);
- EXPECT_TRUE(template_url_->url()->SupportsReplacement());
- EXPECT_TRUE(template_url_->suggestions_url() == NULL);
+ EXPECT_TRUE(template_url_->url_ref().SupportsReplacement());
+ EXPECT_TRUE(template_url_->suggestions_url().empty());
EXPECT_EQ("http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8",
- template_url_->url()->url());
+ template_url_->url());
ASSERT_EQ(1U, template_url_->input_encodings().size());
EXPECT_EQ("UTF-8", template_url_->input_encodings()[0]);
EXPECT_EQ(GURL("http://search.yahoo.com/favicon.ico"),

Powered by Google App Engine
This is Rietveld 408576698