| Index: chrome/browser/search/search_unittest.cc
|
| diff --git a/chrome/browser/search/search_unittest.cc b/chrome/browser/search/search_unittest.cc
|
| index 19c4ca2d22d464f15abd2c17943b59e92cfa709a..fe97d8510617e13d37b4579bc933b7467caa982d 100644
|
| --- a/chrome/browser/search/search_unittest.cc
|
| +++ b/chrome/browser/search/search_unittest.cc
|
| @@ -175,8 +175,7 @@ class SearchTest : public BrowserWithTestWindowTest {
|
| TemplateURLData data;
|
| data.SetURL("http://foo.com/url?bar={searchTerms}");
|
| data.instant_url = "http://foo.com/instant?"
|
| - "{google:omniboxStartMarginParameter}{google:forceInstantResults}"
|
| - "foo=foo#foo=foo&strk";
|
| + "{google:forceInstantResults}foo=foo#foo=foo&strk";
|
| if (set_ntp_url) {
|
| data.new_tab_url = (insecure_ntp_url ? "http" : "https") +
|
| std::string("://foo.com/newtab?strk");
|
| @@ -499,8 +498,7 @@ TEST_F(SearchTest, InstantCacheableNTPNavigationEntry) {
|
| EXPECT_TRUE(NavEntryIsInstantNTP(contents,
|
| controller.GetLastCommittedEntry()));
|
| // Instant page is not cacheable NTP.
|
| - NavigateAndCommitActiveTab(GetInstantURL(profile(), kDisableStartMargin,
|
| - false));
|
| + NavigateAndCommitActiveTab(GetInstantURL(profile(), false));
|
| EXPECT_FALSE(NavEntryIsInstantNTP(contents,
|
| controller.GetLastCommittedEntry()));
|
| // Test Cacheable NTP
|
| @@ -567,60 +565,48 @@ TEST_F(SearchTest, UseLocalNTPIfNTPURLIsBlockedForSupervisedUser) {
|
| GURL new_tab_url(chrome::kChromeUINewTabURL);
|
| EXPECT_TRUE(HandleNewTabURLRewrite(&new_tab_url, profile()));
|
| EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), new_tab_url);
|
| - EXPECT_EQ(GURL(), GetInstantURL(profile(), kDisableStartMargin, false));
|
| + EXPECT_EQ(GURL(), GetInstantURL(profile(), false));
|
| }
|
|
|
| TEST_F(SearchTest, GetInstantURL) {
|
| // No Instant URL because "strk" is missing.
|
| SetDefaultInstantTemplateUrl(false);
|
| - EXPECT_EQ(GURL(), GetInstantURL(profile(), kDisableStartMargin, false));
|
| + EXPECT_EQ(GURL(), GetInstantURL(profile(), false));
|
|
|
| // Set an Instant URL with a valid search terms replacement key.
|
| SetDefaultInstantTemplateUrl(true);
|
|
|
| // Now there should be a valid Instant URL. Note the HTTPS "upgrade".
|
| EXPECT_EQ(GURL("https://foo.com/instant?foo=foo#foo=foo&strk"),
|
| - GetInstantURL(profile(), kDisableStartMargin, false));
|
| + GetInstantURL(profile(), false));
|
|
|
| // Enable suggest. No difference.
|
| profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true);
|
| EXPECT_EQ(GURL("https://foo.com/instant?foo=foo#foo=foo&strk"),
|
| - GetInstantURL(profile(), kDisableStartMargin, false));
|
| + GetInstantURL(profile(), false));
|
|
|
| // Disable suggest. No Instant URL.
|
| profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, false);
|
| - EXPECT_EQ(GURL(), GetInstantURL(profile(), kDisableStartMargin, false));
|
| + EXPECT_EQ(GURL(), GetInstantURL(profile(), false));
|
|
|
| // Use alternate Instant search base URL.
|
| profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true);
|
| ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
|
| "EmbeddedSearch", "Group1 espv:8 use_alternate_instant_url:1"));
|
| EXPECT_EQ(GURL("https://foo.com/search?foo=foo&qbp=1#foo=foo&strk"),
|
| - GetInstantURL(profile(), kDisableStartMargin, false));
|
| -}
|
| -
|
| -TEST_F(SearchTest, StartMarginCGI) {
|
| - // No margin.
|
| - profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true);
|
| -
|
| - EXPECT_EQ(GURL("https://foo.com/instant?foo=foo#foo=foo&strk"),
|
| - GetInstantURL(profile(), kDisableStartMargin, false));
|
| -
|
| - // With start margin.
|
| - EXPECT_EQ(GURL("https://foo.com/instant?es_sm=10&foo=foo#foo=foo&strk"),
|
| - GetInstantURL(profile(), 10, false));
|
| + GetInstantURL(profile(), false));
|
| }
|
|
|
| TEST_F(SearchTest, InstantSearchEnabledCGI) {
|
| // Disable Instant Search.
|
| // Make sure {google:forceInstantResults} is not set in the Instant URL.
|
| EXPECT_EQ(GURL("https://foo.com/instant?foo=foo#foo=foo&strk"),
|
| - GetInstantURL(profile(), kDisableStartMargin, false));
|
| + GetInstantURL(profile(), false));
|
|
|
| // Enable Instant Search.
|
| // Make sure {google:forceInstantResults} is set in the Instant URL.
|
| EXPECT_EQ(GURL("https://foo.com/instant?ion=1&foo=foo#foo=foo&strk"),
|
| - GetInstantURL(profile(), kDisableStartMargin, true));
|
| + GetInstantURL(profile(), true));
|
| }
|
|
|
| TEST_F(SearchTest, CommandLineOverrides) {
|
| @@ -641,7 +627,7 @@ TEST_F(SearchTest, CommandLineOverrides) {
|
| // By default, Instant Extended forces the instant URL to be HTTPS, so even if
|
| // we set a Google base URL that is HTTP, we should get an HTTPS URL.
|
| UIThreadSearchTermsData::SetGoogleBaseURL("http://www.foo.com/");
|
| - GURL instant_url(GetInstantURL(profile(), kDisableStartMargin, false));
|
| + GURL instant_url(GetInstantURL(profile(), false));
|
| ASSERT_TRUE(instant_url.is_valid());
|
| EXPECT_EQ("https://www.foo.com/webhp?strk", instant_url.spec());
|
|
|
| @@ -650,7 +636,7 @@ TEST_F(SearchTest, CommandLineOverrides) {
|
| UIThreadSearchTermsData::SetGoogleBaseURL(std::string());
|
| CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kGoogleBaseURL,
|
| "http://www.bar.com/");
|
| - instant_url = GetInstantURL(profile(), kDisableStartMargin, false);
|
| + instant_url = GetInstantURL(profile(), false);
|
| ASSERT_TRUE(instant_url.is_valid());
|
| EXPECT_EQ("http://www.bar.com/webhp?strk", instant_url.spec());
|
|
|
| @@ -664,7 +650,7 @@ TEST_F(SearchTest, CommandLineOverrides) {
|
| // query portion of the instant URL.
|
| CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| switches::kExtraSearchQueryParams, "a=b");
|
| - instant_url = GetInstantURL(profile(), kDisableStartMargin, false);
|
| + instant_url = GetInstantURL(profile(), false);
|
| ASSERT_TRUE(instant_url.is_valid());
|
| EXPECT_EQ("http://www.bar.com/webhp?a=b&strk", instant_url.spec());
|
| }
|
| @@ -837,7 +823,7 @@ TEST_F(SearchTest, IsNTPURL) {
|
| // No margin.
|
| EnableQueryExtractionForTesting();
|
| profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true);
|
| - GURL remote_ntp_url(GetInstantURL(profile(), kDisableStartMargin, false));
|
| + GURL remote_ntp_url(GetInstantURL(profile(), false));
|
| GURL search_url_with_search_terms("https://foo.com/url?strk&bar=abc");
|
| GURL search_url_without_search_terms("https://foo.com/url?strk&bar");
|
|
|
|
|