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/metrics/statistics_recorder.h" | 9 #include "base/metrics/statistics_recorder.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 } | 682 } |
683 | 683 |
684 TEST_F(SearchTest, ShouldPrefetchSearchResults_EnabledViaFieldTrial) { | 684 TEST_F(SearchTest, ShouldPrefetchSearchResults_EnabledViaFieldTrial) { |
685 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 685 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
686 "EmbeddedSearch", | 686 "EmbeddedSearch", |
687 "Group1 espv:80 prefetch_results:1")); | 687 "Group1 espv:80 prefetch_results:1")); |
688 EXPECT_TRUE(ShouldPrefetchSearchResults()); | 688 EXPECT_TRUE(ShouldPrefetchSearchResults()); |
689 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); | 689 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); |
690 } | 690 } |
691 | 691 |
| 692 TEST_F(SearchTest, |
| 693 ShouldPrerenderInstantUrlOnOmniboxFocus_DisabledViaFieldTrial) { |
| 694 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 695 "EmbeddedSearch", |
| 696 "Group1 espv:89 prerender_instant_url_on_omnibox_focus:0")); |
| 697 EXPECT_FALSE(ShouldPrerenderInstantUrlOnOmniboxFocus()); |
| 698 EXPECT_EQ(89ul, EmbeddedSearchPageVersion()); |
| 699 } |
| 700 |
| 701 TEST_F(SearchTest, |
| 702 ShouldPrerenderInstantUrlOnOmniboxFocus_EnabledViaFieldTrial) { |
| 703 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 704 "EmbeddedSearch", |
| 705 "Group1 espv:80 prerender_instant_url_on_omnibox_focus:1")); |
| 706 EXPECT_TRUE(ShouldPrerenderInstantUrlOnOmniboxFocus()); |
| 707 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); |
| 708 } |
| 709 |
692 TEST_F(SearchTest, ShouldPrefetchSearchResults_EnabledViaCommandLine) { | 710 TEST_F(SearchTest, ShouldPrefetchSearchResults_EnabledViaCommandLine) { |
693 CommandLine::ForCurrentProcess()->AppendSwitch( | 711 CommandLine::ForCurrentProcess()->AppendSwitch( |
694 switches::kPrefetchSearchResults); | 712 switches::kPrefetchSearchResults); |
695 // Command-line enable should override Finch. | 713 // Command-line enable should override Finch. |
696 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 714 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
697 "EmbeddedSearch", | 715 "EmbeddedSearch", |
698 "Group1 espv:80 prefetch_results:0")); | 716 "Group1 espv:80 prefetch_results:0")); |
699 EXPECT_TRUE(ShouldPrefetchSearchResults()); | 717 EXPECT_TRUE(ShouldPrefetchSearchResults()); |
700 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); | 718 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); |
701 } | 719 } |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 } | 1155 } |
1138 | 1156 |
1139 TEST_F(OriginChipTest, CommandLineOnSrp) { | 1157 TEST_F(OriginChipTest, CommandLineOnSrp) { |
1140 CommandLine::ForCurrentProcess()->AppendSwitch( | 1158 CommandLine::ForCurrentProcess()->AppendSwitch( |
1141 switches::kEnableOriginChipOnSrp); | 1159 switches::kEnableOriginChipOnSrp); |
1142 EXPECT_TRUE(ShouldDisplayOriginChip()); | 1160 EXPECT_TRUE(ShouldDisplayOriginChip()); |
1143 EXPECT_EQ(ORIGIN_CHIP_ON_SRP, GetOriginChipCondition()); | 1161 EXPECT_EQ(ORIGIN_CHIP_ON_SRP, GetOriginChipCondition()); |
1144 } | 1162 } |
1145 | 1163 |
1146 } // namespace chrome | 1164 } // namespace chrome |
OLD | NEW |