Index: chrome/browser/search/search_unittest.cc |
diff --git a/chrome/browser/search/search_unittest.cc b/chrome/browser/search/search_unittest.cc |
index f8bc6287a2231520ace3d4a67d2e6ac5b2b4151b..b79f05f8907e8cb781f36c35cb85630fb0ab278e 100644 |
--- a/chrome/browser/search/search_unittest.cc |
+++ b/chrome/browser/search/search_unittest.cc |
@@ -299,6 +299,41 @@ TEST_F(SearchTest, ShouldAssignURLToInstantRendererExtendedEnabled) { |
} |
} |
+TEST_F(SearchTest, ShouldAssignURLToInstantRendererExtendedEnabledOverridden) { |
+ EnableInstantExtendedAPIForTesting(); |
+ |
+ // Override the instant url with the command line flag. |
+ CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kInstantURL, |
+ "http://bar.com/searchingfast"); |
+ |
+ // Existing Instant URLs should all work, plus new ones matching the override. |
+ const SearchTestCase kTestCases[] = { |
+ {chrome::kChromeSearchLocalNtpUrl, true, ""}, |
+ {chrome::kChromeSearchLocalGoogleNtpUrl, true, ""}, |
+ {"https://foo.com/instant?strk", true, ""}, |
+ {"https://foo.com/instant#strk", true, ""}, |
+ {"https://foo.com/instant?strk=0", true, ""}, |
+ {"https://foo.com/url?strk", true, ""}, |
+ {"https://foo.com/alt?strk", true, ""}, |
+ {"http://bar.com/searchingfast", true, ""}, |
+ {"http://bar.com/alt?strk", true, ""}, |
+ {"https://bar.com/searchingfast", true, ""}, |
+ {"http://foo.com/instant", false, "Non-HTTPS"}, |
+ {"http://foo.com/instant?strk", false, "Non-HTTPS"}, |
+ {"http://foo.com/instant?strk=1", false, "Non-HTTPS"}, |
+ {"https://foo.com/instant", false, "No search terms replacement"}, |
+ {"https://foo.com/?strk", false, "Non-exact path"}, |
+ {"https://www.bar.com/searchingfast", false, "Host mismatch"}, |
+ }; |
+ |
+ for (size_t i = 0; i < arraysize(kTestCases); ++i) { |
+ const SearchTestCase& test = kTestCases[i]; |
+ EXPECT_EQ(test.expected_result, |
+ ShouldAssignURLToInstantRenderer(GURL(test.url), profile())) |
+ << test.url << " " << test.comment; |
+ } |
+} |
sreeram
2013/05/03 23:17:31
Given my comment earlier about not doing "return t
David Black
2013/05/04 00:49:23
Done.
|
+ |
TEST_F(SearchTest, CoerceCommandLineURLToTemplateURL) { |
TemplateURL* template_url = |
TemplateURLServiceFactory::GetForProfile(profile())-> |