Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: chrome/browser/search/search_unittest.cc

Issue 132733002: InstantExtended: remove dead code related to the non-cacheable NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 658
659 // If we specify extra search query params, they should be inserted into the 659 // If we specify extra search query params, they should be inserted into the
660 // query portion of the instant URL. 660 // query portion of the instant URL.
661 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 661 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
662 switches::kExtraSearchQueryParams, "a=b"); 662 switches::kExtraSearchQueryParams, "a=b");
663 instant_url = GetInstantURL(profile(), kDisableStartMargin, false); 663 instant_url = GetInstantURL(profile(), kDisableStartMargin, false);
664 ASSERT_TRUE(instant_url.is_valid()); 664 ASSERT_TRUE(instant_url.is_valid());
665 EXPECT_EQ("http://www.bar.com/webhp?a=b&strk", instant_url.spec()); 665 EXPECT_EQ("http://www.bar.com/webhp?a=b&strk", instant_url.spec());
666 } 666 }
667 667
668 TEST_F(SearchTest, ShouldShowInstantNTP_Default) {
669 EXPECT_FALSE(ShouldShowInstantNTP());
670 }
671
672 TEST_F(SearchTest, ShouldShowInstantNTP_DisabledViaFinch) {
673 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
674 "EmbeddedSearch", "Group1 show_ntp:0"));
675 EXPECT_FALSE(ShouldShowInstantNTP());
676 }
677
678 TEST_F(SearchTest, ShouldShowInstantNTP_DisabledByUseCacheableNTPFinchFlag) {
679 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
680 "EmbeddedSearch", "Group1 use_cacheable_ntp:1"));
681 EXPECT_FALSE(ShouldShowInstantNTP());
682 }
683
684 TEST_F(SearchTest, ShouldUseCacheableNTP_Default) {
685 EXPECT_TRUE(ShouldUseCacheableNTP());
686 }
687
688 TEST_F(SearchTest, ShouldUseCacheableNTP_EnabledViaFinch) {
689 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
690 "EmbeddedSearch", "Group1 use_cacheable_ntp:1"));
691 EXPECT_TRUE(ShouldUseCacheableNTP());
692 }
693
694 TEST_F(SearchTest, ShouldPrefetchSearchResults_Default) {
695 EXPECT_FALSE(ShouldPrefetchSearchResults());
696 }
697
698 TEST_F(SearchTest, ShouldPrefetchSearchResults_InstantExtendedAPIEnabled) { 668 TEST_F(SearchTest, ShouldPrefetchSearchResults_InstantExtendedAPIEnabled) {
699 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( 669 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
700 "EmbeddedSearch", 670 "EmbeddedSearch",
701 "Group1 espv:2 use_cacheable_ntp:1 prefetch_results:1")); 671 "Group1 espv:2 use_cacheable_ntp:1 prefetch_results:1"));
702 EXPECT_TRUE(ShouldPrefetchSearchResults()); 672 EXPECT_TRUE(ShouldPrefetchSearchResults());
703 #if defined(OS_IOS) || defined(OS_ANDROID) 673 #if defined(OS_IOS) || defined(OS_ANDROID)
704 EXPECT_EQ(1ul, EmbeddedSearchPageVersion()); 674 EXPECT_EQ(1ul, EmbeddedSearchPageVersion());
705 #else 675 #else
706 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); 676 EXPECT_EQ(2ul, EmbeddedSearchPageVersion());
707 #endif 677 #endif
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 "EmbeddedSearch", "Group1 espv:2 origin_chip:1")); 906 "EmbeddedSearch", "Group1 espv:2 origin_chip:1"));
937 EXPECT_TRUE(ShouldDisplayOriginChip()); 907 EXPECT_TRUE(ShouldDisplayOriginChip());
938 } 908 }
939 909
940 TEST_F(OriginChipTest, CommandLineOriginChip) { 910 TEST_F(OriginChipTest, CommandLineOriginChip) {
941 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableOriginChip); 911 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableOriginChip);
942 EXPECT_TRUE(ShouldDisplayOriginChip()); 912 EXPECT_TRUE(ShouldDisplayOriginChip());
943 } 913 }
944 914
945 } // namespace chrome 915 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698