OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
7 #include "base/metrics/histogram_base.h" | 7 #include "base/metrics/histogram_base.h" |
8 #include "base/metrics/histogram_samples.h" | 8 #include "base/metrics/histogram_samples.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 | 842 |
843 TEST_F(IsQueryExtractionEnabledTest, EnabledViaCommandLine) { | 843 TEST_F(IsQueryExtractionEnabledTest, EnabledViaCommandLine) { |
844 EnableQueryExtractionForTesting(); | 844 EnableQueryExtractionForTesting(); |
845 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 845 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
846 "EmbeddedSearch", "Group1 espv:2 query_extraction:0")); | 846 "EmbeddedSearch", "Group1 espv:2 query_extraction:0")); |
847 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); | 847 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); |
848 EXPECT_TRUE(IsQueryExtractionEnabled()); | 848 EXPECT_TRUE(IsQueryExtractionEnabled()); |
849 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); | 849 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); |
850 } | 850 } |
851 | 851 |
852 typedef SearchTest ShouldHideTopVerbatimTest; | |
853 | |
854 TEST_F(ShouldHideTopVerbatimTest, DoNotHideByDefault) { | |
855 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch", | |
856 "Control")); | |
857 EXPECT_FALSE(ShouldHideTopVerbatimMatch()); | |
858 } | |
859 | |
860 TEST_F(ShouldHideTopVerbatimTest, DoNotHideInInstantExtended) { | |
861 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch", | |
862 "Group1")); | |
863 EXPECT_FALSE(ShouldHideTopVerbatimMatch()); | |
864 } | |
865 | |
866 TEST_F(ShouldHideTopVerbatimTest, EnableByFlagInInstantExtended) { | |
867 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch", | |
868 "Group1 hide_verbatim:1")); | |
869 EXPECT_TRUE(ShouldHideTopVerbatimMatch()); | |
870 } | |
871 | |
872 TEST_F(ShouldHideTopVerbatimTest, EnableByFlagOutsideInstantExtended) { | |
873 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
874 "EmbeddedSearch", "Controll1 hide_verbatim:1")); | |
875 EXPECT_TRUE(ShouldHideTopVerbatimMatch()); | |
876 } | |
877 | |
878 TEST_F(ShouldHideTopVerbatimTest, DisableByFlag) { | |
879 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch", | |
880 "Group1 hide_verbatim:0")); | |
881 EXPECT_FALSE(ShouldHideTopVerbatimMatch()); | |
882 } | |
883 | |
884 typedef SearchTest DisplaySearchButtonTest; | 852 typedef SearchTest DisplaySearchButtonTest; |
885 | 853 |
886 TEST_F(DisplaySearchButtonTest, NotSet) { | 854 TEST_F(DisplaySearchButtonTest, NotSet) { |
887 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 855 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
888 "EmbeddedSearch", "Group1 espv:2")); | 856 "EmbeddedSearch", "Group1 espv:2")); |
889 EXPECT_EQ(DISPLAY_SEARCH_BUTTON_NEVER, GetDisplaySearchButtonConditions()); | 857 EXPECT_EQ(DISPLAY_SEARCH_BUTTON_NEVER, GetDisplaySearchButtonConditions()); |
890 } | 858 } |
891 | 859 |
892 TEST_F(DisplaySearchButtonTest, Never) { | 860 TEST_F(DisplaySearchButtonTest, Never) { |
893 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 861 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 } | 977 } |
1010 | 978 |
1011 TEST_F(OriginChipTest, CommandLineOnSrp) { | 979 TEST_F(OriginChipTest, CommandLineOnSrp) { |
1012 CommandLine::ForCurrentProcess()->AppendSwitch( | 980 CommandLine::ForCurrentProcess()->AppendSwitch( |
1013 switches::kEnableOriginChipOnSrp); | 981 switches::kEnableOriginChipOnSrp); |
1014 EXPECT_TRUE(ShouldDisplayOriginChip()); | 982 EXPECT_TRUE(ShouldDisplayOriginChip()); |
1015 EXPECT_EQ(ORIGIN_CHIP_ON_SRP, GetOriginChipCondition()); | 983 EXPECT_EQ(ORIGIN_CHIP_ON_SRP, GetOriginChipCondition()); |
1016 } | 984 } |
1017 | 985 |
1018 } // namespace chrome | 986 } // namespace chrome |
OLD | NEW |