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/memory/scoped_ptr.h" | 7 #include <memory> |
| 8 |
8 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/statistics_recorder.h" | 10 #include "base/metrics/statistics_recorder.h" |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
11 #include "components/variations/entropy_provider.h" | 12 #include "components/variations/entropy_provider.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 | 14 |
14 namespace search { | 15 namespace search { |
15 | 16 |
16 class EmbeddedSearchFieldTrialTest : public testing::Test { | 17 class EmbeddedSearchFieldTrialTest : public testing::Test { |
17 protected: | 18 protected: |
18 void SetUp() override { | 19 void SetUp() override { |
19 field_trial_list_.reset(new base::FieldTrialList( | 20 field_trial_list_.reset(new base::FieldTrialList( |
20 new metrics::SHA1EntropyProvider("42"))); | 21 new metrics::SHA1EntropyProvider("42"))); |
21 base::StatisticsRecorder::Initialize(); | 22 base::StatisticsRecorder::Initialize(); |
22 } | 23 } |
23 | 24 |
24 private: | 25 private: |
25 scoped_ptr<base::FieldTrialList> field_trial_list_; | 26 std::unique_ptr<base::FieldTrialList> field_trial_list_; |
26 }; | 27 }; |
27 | 28 |
28 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoEmptyAndValid) { | 29 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoEmptyAndValid) { |
29 FieldTrialFlags flags; | 30 FieldTrialFlags flags; |
30 | 31 |
31 EXPECT_TRUE(GetFieldTrialInfo(&flags)); | 32 EXPECT_TRUE(GetFieldTrialInfo(&flags)); |
32 EXPECT_EQ(0ul, flags.size()); | 33 EXPECT_EQ(0ul, flags.size()); |
33 | 34 |
34 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch", | 35 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch", |
35 "Group77")); | 36 "Group77")); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 EnableQueryExtractionForTesting(); | 233 EnableQueryExtractionForTesting(); |
233 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 234 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
234 "EmbeddedSearch", "Group1 espv:2 query_extraction:0")); | 235 "EmbeddedSearch", "Group1 espv:2 query_extraction:0")); |
235 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); | 236 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); |
236 EXPECT_TRUE(IsQueryExtractionEnabled()); | 237 EXPECT_TRUE(IsQueryExtractionEnabled()); |
237 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); | 238 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); |
238 } | 239 } |
239 #endif // !defined(OS_IOS) && !defined(OS_ANDROID) | 240 #endif // !defined(OS_IOS) && !defined(OS_ANDROID) |
240 | 241 |
241 } // namespace search | 242 } // namespace search |
OLD | NEW |