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, ShouldPrefetchSearchResults_EnabledViaCommandLine) { | |
693 CommandLine::ForCurrentProcess()->AppendSwitch( | |
694 switches::kPrefetchSearchResults); | |
695 // Command-line enable should override Finch. | |
696 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
697 "EmbeddedSearch", "Group1 espv:80 prefetch_results:0")); | |
698 EXPECT_TRUE(ShouldPrefetchSearchResults()); | |
699 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); | |
700 } | |
701 | |
702 TEST_F(SearchTest, | |
703 ShouldAllowPrefetchNonDefaultMatch_PrefetchResultsFlagDisabled) { | |
704 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
705 "EmbeddedSearch", | |
706 "Group1 espv:80 prefetch_results:0 " | |
707 "allow_prefetch_non_default_match:1")); | |
kmadhusu
2014/06/18 17:07:38
style nit: This can fit in the previous line.
sidharthms
2014/06/18 22:45:22
Done.
| |
708 EXPECT_FALSE(ShouldAllowPrefetchNonDefaultMatch()); | |
709 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); | |
710 } | |
711 | |
712 TEST_F(SearchTest, ShouldAllowPrefetchNonDefaultMatch_DisabledViaFieldTrial) { | |
713 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
714 "EmbeddedSearch", | |
715 "Group1 espv:89 prefetch_results:1 " | |
716 "allow_prefetch_non_default_match:0")); | |
717 EXPECT_FALSE(ShouldAllowPrefetchNonDefaultMatch()); | |
718 EXPECT_EQ(89ul, EmbeddedSearchPageVersion()); | |
719 } | |
720 | |
721 TEST_F(SearchTest, ShouldAllowPrefetchNonDefaultMatch_EnabledViaFieldTrial) { | |
722 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
723 "EmbeddedSearch", | |
724 "Group1 espv:80 prefetch_results:1 " | |
725 "allow_prefetch_non_default_match:1")); | |
726 EXPECT_TRUE(ShouldAllowPrefetchNonDefaultMatch()); | |
727 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); | |
728 } | |
729 | |
692 TEST_F(SearchTest, | 730 TEST_F(SearchTest, |
693 ShouldPrerenderInstantUrlOnOmniboxFocus_PrefetchResultsFlagDisabled) { | 731 ShouldPrerenderInstantUrlOnOmniboxFocus_PrefetchResultsFlagDisabled) { |
694 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 732 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
695 "EmbeddedSearch", | 733 "EmbeddedSearch", |
696 "Group1 espv:80 prefetch_results:0 " | 734 "Group1 espv:80 prefetch_results:0 " |
697 "prerender_instant_url_on_omnibox_focus:1")); | 735 "prerender_instant_url_on_omnibox_focus:1")); |
698 EXPECT_FALSE(ShouldPrerenderInstantUrlOnOmniboxFocus()); | 736 EXPECT_FALSE(ShouldPrerenderInstantUrlOnOmniboxFocus()); |
699 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); | 737 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); |
700 } | 738 } |
701 | 739 |
(...skipping 10 matching lines...) Expand all Loading... | |
712 TEST_F(SearchTest, | 750 TEST_F(SearchTest, |
713 ShouldPrerenderInstantUrlOnOmniboxFocus_EnabledViaFieldTrial) { | 751 ShouldPrerenderInstantUrlOnOmniboxFocus_EnabledViaFieldTrial) { |
714 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 752 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
715 "EmbeddedSearch", | 753 "EmbeddedSearch", |
716 "Group1 espv:80 prefetch_results:1 " | 754 "Group1 espv:80 prefetch_results:1 " |
717 "prerender_instant_url_on_omnibox_focus:1")); | 755 "prerender_instant_url_on_omnibox_focus:1")); |
718 EXPECT_TRUE(ShouldPrerenderInstantUrlOnOmniboxFocus()); | 756 EXPECT_TRUE(ShouldPrerenderInstantUrlOnOmniboxFocus()); |
719 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); | 757 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); |
720 } | 758 } |
721 | 759 |
722 TEST_F(SearchTest, ShouldPrefetchSearchResults_EnabledViaCommandLine) { | |
723 CommandLine::ForCurrentProcess()->AppendSwitch( | |
724 switches::kPrefetchSearchResults); | |
725 // Command-line enable should override Finch. | |
726 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
727 "EmbeddedSearch", | |
728 "Group1 espv:80 prefetch_results:0")); | |
729 EXPECT_TRUE(ShouldPrefetchSearchResults()); | |
730 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); | |
731 } | |
732 | |
733 TEST_F(SearchTest, | 760 TEST_F(SearchTest, |
734 ShouldReuseInstantSearchBasePage_PrefetchResultsFlagDisabled) { | 761 ShouldReuseInstantSearchBasePage_PrefetchResultsFlagDisabled) { |
735 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 762 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
736 "EmbeddedSearch", | 763 "EmbeddedSearch", |
737 "Group1 espv:89 prefetch_results:0 reuse_instant_search_base_page:1")); | 764 "Group1 espv:89 prefetch_results:0 reuse_instant_search_base_page:1")); |
738 EXPECT_FALSE(ShouldPrefetchSearchResults()); | 765 EXPECT_FALSE(ShouldPrefetchSearchResults()); |
739 EXPECT_FALSE(ShouldReuseInstantSearchBasePage()); | 766 EXPECT_FALSE(ShouldReuseInstantSearchBasePage()); |
740 EXPECT_EQ(89ul, EmbeddedSearchPageVersion()); | 767 EXPECT_EQ(89ul, EmbeddedSearchPageVersion()); |
741 } | 768 } |
742 | 769 |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1167 } | 1194 } |
1168 | 1195 |
1169 TEST_F(OriginChipTest, CommandLineOnSrp) { | 1196 TEST_F(OriginChipTest, CommandLineOnSrp) { |
1170 CommandLine::ForCurrentProcess()->AppendSwitch( | 1197 CommandLine::ForCurrentProcess()->AppendSwitch( |
1171 switches::kEnableOriginChipOnSrp); | 1198 switches::kEnableOriginChipOnSrp); |
1172 EXPECT_TRUE(ShouldDisplayOriginChip()); | 1199 EXPECT_TRUE(ShouldDisplayOriginChip()); |
1173 EXPECT_EQ(ORIGIN_CHIP_ON_SRP, GetOriginChipCondition()); | 1200 EXPECT_EQ(ORIGIN_CHIP_ON_SRP, GetOriginChipCondition()); |
1174 } | 1201 } |
1175 | 1202 |
1176 } // namespace chrome | 1203 } // namespace chrome |
OLD | NEW |