diff options
author | jered@chromium.org <jered@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-06 01:47:42 +0000 |
---|---|---|
committer | jered@chromium.org <jered@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-06 01:47:42 +0000 |
commit | 620ff56c20be427373b943a3dcbc8683f45f2173 (patch) | |
tree | f328341cc08505506497df7abfd5d8d8b02e81fb /chrome | |
parent | a5a711b3c11a14bff947c62bfa4c9ea62f627fc8 (diff) | |
download | chromium_src-620ff56c20be427373b943a3dcbc8683f45f2173.zip chromium_src-620ff56c20be427373b943a3dcbc8683f45f2173.tar.gz chromium_src-620ff56c20be427373b943a3dcbc8683f45f2173.tar.bz2 |
Field trial to disable google logo on local ntp.
Adds a field trial option to disable the custom treatment on the local
NTP when Google is the DSP. It's unclear if we need this config now.
BUG=
R=samarth@chromium.org
Review URL: https://codereview.chromium.org/156123002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/search/local_ntp_source.cc | 3 | ||||
-rw-r--r-- | chrome/browser/search/search.cc | 7 | ||||
-rw-r--r-- | chrome/browser/search/search.h | 4 | ||||
-rw-r--r-- | chrome/browser/search/search_unittest.cc | 16 |
4 files changed, 29 insertions, 1 deletions
diff --git a/chrome/browser/search/local_ntp_source.cc b/chrome/browser/search/local_ntp_source.cc index 6e668d7..8944ac3 100644 --- a/chrome/browser/search/local_ntp_source.cc +++ b/chrome/browser/search/local_ntp_source.cc @@ -105,7 +105,8 @@ std::string GetConfigData(Profile* profile) { base::DictionaryValue config_data; config_data.Set("translatedStrings", GetTranslatedStrings().release()); config_data.SetBoolean("isGooglePage", - DefaultSearchProviderIsGoogle(profile)); + DefaultSearchProviderIsGoogle(profile) && + chrome::ShouldShowGoogleLocalNTP()); // Serialize the dictionary. std::string js_text; diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc index 1562d52..2ba4567 100644 --- a/chrome/browser/search/search.cc +++ b/chrome/browser/search/search.cc @@ -72,6 +72,7 @@ const char kOriginChipFlagName[] = "origin_chip"; #if !defined(OS_IOS) && !defined(OS_ANDROID) const char kEnableQueryExtractionFlagName[] = "query_extraction"; #endif +const char kShouldShowGoogleLocalNTPFlagName[] = "google_local_ntp"; // Constants for the field trial name and group prefix. // Note in M30 and below this field trial was named "InstantExtended" and in @@ -611,6 +612,12 @@ OriginChipPosition GetOriginChipPosition() { ORIGIN_CHIP_DISABLED; } +bool ShouldShowGoogleLocalNTP() { + FieldTrialFlags flags; + return !GetFieldTrialInfo(&flags) || GetBoolValueForFlagWithDefault( + kShouldShowGoogleLocalNTPFlagName, true, flags); +} + GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile) { CHECK(ShouldAssignURLToInstantRenderer(url, profile)) << "Error granting Instant access."; diff --git a/chrome/browser/search/search.h b/chrome/browser/search/search.h index 0e9e826..49ffb4e 100644 --- a/chrome/browser/search/search.h +++ b/chrome/browser/search/search.h @@ -172,6 +172,10 @@ bool ShouldDisplayOriginChip(); // toolbar. OriginChipPosition GetOriginChipPosition(); +// Returns true if the local new tab page should show a Google logo and search +// box for users whose default search provider is Google, or false if not. +bool ShouldShowGoogleLocalNTP(); + // Transforms the input |url| into its "effective URL". The returned URL // facilitates grouping process-per-site. The |url| is transformed, for // example, from diff --git a/chrome/browser/search/search_unittest.cc b/chrome/browser/search/search_unittest.cc index ac18957..afe3bdd 100644 --- a/chrome/browser/search/search_unittest.cc +++ b/chrome/browser/search/search_unittest.cc @@ -713,6 +713,22 @@ TEST_F(SearchTest, ShouldReuseInstantSearchBasePage_DisabledViaFinch) { EXPECT_EQ(89ul, EmbeddedSearchPageVersion()); } +TEST_F(SearchTest, ShouldShowGoogleLocalNTP_Default) { + EXPECT_TRUE(ShouldShowGoogleLocalNTP()); +} + +TEST_F(SearchTest, ShouldShowGoogleLocalNTP_EnabledViaFinch) { + ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( + "EmbeddedSearch", "Group1 espv:2 google_local_ntp:1")); + EXPECT_TRUE(ShouldShowGoogleLocalNTP()); +} + +TEST_F(SearchTest, ShouldShowGoogleLocalNTP_DisabledViaFinch) { + ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( + "EmbeddedSearch", "Group1 espv:2 google_local_ntp:0")); + EXPECT_FALSE(ShouldShowGoogleLocalNTP()); +} + TEST_F(SearchTest, IsNTPURL) { GURL invalid_url; GURL ntp_url(chrome::kChromeUINewTabURL); |