diff options
Diffstat (limited to 'components/search/search_android_unittest.cc')
-rw-r--r-- | components/search/search_android_unittest.cc | 83 |
1 files changed, 2 insertions, 81 deletions
diff --git a/components/search/search_android_unittest.cc b/components/search/search_android_unittest.cc index f5c8320..a778e7d 100644 --- a/components/search/search_android_unittest.cc +++ b/components/search/search_android_unittest.cc @@ -27,87 +27,8 @@ TEST(SearchTest, EmbeddedSearchAPIEnabled) { } TEST(SearchTest, QueryExtractionEnabled) { - // Query extraction is always enabled on mobile. - EXPECT_TRUE(IsQueryExtractionEnabled()); -} - -class SearchUtilTest : public testing::Test { - protected: - void SetUp() override { - field_trial_list_.reset( - new base::FieldTrialList(new metrics::SHA1EntropyProvider("42"))); - base::StatisticsRecorder::Initialize(); - } - - private: - scoped_ptr<base::FieldTrialList> field_trial_list_; -}; - -TEST_F(SearchUtilTest, UseDefaultEmbeddedSearchPageVersion) { - ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( - "EmbeddedSearch", "Group1 espv:-1 query_extraction:1")); - EXPECT_TRUE(IsQueryExtractionEnabled()); - EXPECT_EQ("espv=1&", InstantExtendedEnabledParam(true)); - EXPECT_EQ("espv=1&", InstantExtendedEnabledParam(false)); -} - -TEST_F(SearchUtilTest, ShouldPrefetchSearchResults_InstantExtendedAPIEnabled) { - ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( - "EmbeddedSearch", "Group1 espv:2 prefetch_results:1")); - EXPECT_TRUE(ShouldPrefetchSearchResults()); - EXPECT_TRUE(IsInstantExtendedAPIEnabled()); - EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); -} - -TEST_F(SearchUtilTest, ShouldPrefetchSearchResults_InstantExtendedAPIDisabled) { - ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( - "EmbeddedSearch", "Group1 espv:1 prefetch_results:1")); - EXPECT_FALSE(ShouldPrefetchSearchResults()); - EXPECT_FALSE(IsInstantExtendedAPIEnabled()); - EXPECT_EQ(1ul, EmbeddedSearchPageVersion()); -} - -TEST_F(SearchUtilTest, ShouldPrefetchSearchResults_DisabledViaFieldTrials) { - ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( - "EmbeddedSearch", "Group1 espv:2 prefetch_results:0")); - EXPECT_FALSE(ShouldPrefetchSearchResults()); - EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); -} - -TEST_F(SearchUtilTest, ShouldPrefetchSearchResults_EnabledViaCommandLine) { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kPrefetchSearchResults); - // Command-line enable should override Finch. - ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( - "EmbeddedSearch", "Group1 espv:2 prefetch_results:0")); - EXPECT_TRUE(ShouldPrefetchSearchResults()); - EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); -} - -TEST_F(SearchUtilTest, - ShouldReuseInstantSearchBasePage_PrefetchResultsFlagDisabled) { - ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( - "EmbeddedSearch", - "Group1 espv:2 prefetch_results:0 reuse_instant_search_base_page:1")); - EXPECT_FALSE(ShouldPrefetchSearchResults()); - EXPECT_FALSE(ShouldReuseInstantSearchBasePage()); - EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); -} - -TEST_F(SearchUtilTest, ShouldReuseInstantSearchBasePage_EnabledViaFieldTrial) { - ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( - "EmbeddedSearch", - "Group1 espv:2 prefetch_results:1 reuse_instant_search_base_page:1")); - EXPECT_TRUE(ShouldReuseInstantSearchBasePage()); - EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); -} - -TEST_F(SearchUtilTest, ShouldReuseInstantSearchBasePage_DisabledViaFieldTrial) { - ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( - "EmbeddedSearch", - "Group1 espv:2 prefetch_results:1 reuse_instant_search_base_page:0")); - EXPECT_FALSE(ShouldReuseInstantSearchBasePage()); - EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); + // Query extraction is disabled on mobile. + EXPECT_FALSE(IsQueryExtractionEnabled()); } } // namespace |