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 "chrome/browser/search/search.h" | 5 #include "chrome/browser/search/search.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/metrics/statistics_recorder.h" | 10 #include "base/metrics/statistics_recorder.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "components/search/search.h" |
| 13 #include "components/search/search_switches.h" |
12 #include "components/variations/entropy_provider.h" | 14 #include "components/variations/entropy_provider.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
14 | 16 |
15 namespace chrome { | 17 namespace chrome { |
16 | 18 |
17 namespace { | 19 namespace { |
18 | 20 |
19 TEST(SearchTest, EmbeddedSearchAPIEnabled) { | |
20 EXPECT_EQ(1ul, EmbeddedSearchPageVersion()); | |
21 EXPECT_FALSE(IsInstantExtendedAPIEnabled()); | |
22 CommandLine::ForCurrentProcess()->AppendSwitch( | |
23 switches::kEnableEmbeddedSearchAPI); | |
24 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); | |
25 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); | |
26 } | |
27 | |
28 TEST(SearchTest, QueryExtractionEnabled) { | 21 TEST(SearchTest, QueryExtractionEnabled) { |
29 // Query extraction is always enabled on mobile. | 22 // Query extraction is always enabled on mobile. |
30 EXPECT_TRUE(IsQueryExtractionEnabled()); | 23 EXPECT_TRUE(IsQueryExtractionEnabled()); |
31 } | 24 } |
32 | 25 |
33 class SearchUtilTest : public testing::Test { | 26 class SearchUtilTest : public testing::Test { |
34 protected: | 27 protected: |
35 virtual void SetUp() { | 28 virtual void SetUp() { |
36 field_trial_list_.reset(new base::FieldTrialList( | 29 field_trial_list_.reset(new base::FieldTrialList( |
37 new metrics::SHA1EntropyProvider("42"))); | 30 new metrics::SHA1EntropyProvider("42"))); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 101 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
109 "EmbeddedSearch", | 102 "EmbeddedSearch", |
110 "Group1 espv:2 prefetch_results:1 reuse_instant_search_base_page:0")); | 103 "Group1 espv:2 prefetch_results:1 reuse_instant_search_base_page:0")); |
111 EXPECT_FALSE(ShouldReuseInstantSearchBasePage()); | 104 EXPECT_FALSE(ShouldReuseInstantSearchBasePage()); |
112 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); | 105 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); |
113 } | 106 } |
114 | 107 |
115 } // namespace | 108 } // namespace |
116 | 109 |
117 } // namespace chrome | 110 } // namespace chrome |
OLD | NEW |