OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/search/search.h" | 5 #include "components/search/search.h" |
6 | 6 |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
8 #include "base/metrics/statistics_recorder.h" | 8 #include "base/metrics/statistics_recorder.h" |
9 #include "components/variations/entropy_provider.h" | 9 #include "components/variations/entropy_provider.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoControlFlags) { | 124 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoControlFlags) { |
125 FieldTrialFlags flags; | 125 FieldTrialFlags flags; |
126 | 126 |
127 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 127 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
128 "EmbeddedSearch", "Control77 bar:1 baz:7 cat:dogs")); | 128 "EmbeddedSearch", "Control77 bar:1 baz:7 cat:dogs")); |
129 EXPECT_TRUE(GetFieldTrialInfo(&flags)); | 129 EXPECT_TRUE(GetFieldTrialInfo(&flags)); |
130 EXPECT_EQ(3ul, flags.size()); | 130 EXPECT_EQ(3ul, flags.size()); |
131 } | 131 } |
132 | 132 |
133 typedef EmbeddedSearchFieldTrialTest ShouldHideTopVerbatimTest; | |
134 | |
135 TEST_F(ShouldHideTopVerbatimTest, DoNotHideByDefault) { | |
136 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch", | |
137 "Control")); | |
138 EXPECT_FALSE(ShouldHideTopVerbatimMatch()); | |
139 } | |
140 | |
141 TEST_F(ShouldHideTopVerbatimTest, DoNotHideInInstantExtended) { | |
142 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch", | |
143 "Group1")); | |
144 EXPECT_FALSE(ShouldHideTopVerbatimMatch()); | |
145 } | |
146 | |
147 TEST_F(ShouldHideTopVerbatimTest, EnableByFlagInInstantExtended) { | |
148 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch", | |
149 "Group1 hide_verbatim:1")); | |
150 EXPECT_TRUE(ShouldHideTopVerbatimMatch()); | |
151 } | |
152 | |
153 TEST_F(ShouldHideTopVerbatimTest, EnableByFlagOutsideInstantExtended) { | |
154 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
155 "EmbeddedSearch", "Controll1 hide_verbatim:1")); | |
156 EXPECT_TRUE(ShouldHideTopVerbatimMatch()); | |
157 } | |
158 | |
159 TEST_F(ShouldHideTopVerbatimTest, DisableByFlag) { | |
160 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch", | |
161 "Group1 hide_verbatim:0")); | |
162 EXPECT_FALSE(ShouldHideTopVerbatimMatch()); | |
163 } | |
164 | |
165 } // namespace chrome | 133 } // namespace chrome |
OLD | NEW |