Chromium Code Reviews| 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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 793 // "prefetch_results" flag is enabled via field trials. | 793 // "prefetch_results" flag is enabled via field trials. |
| 794 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 794 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 795 "EmbeddedSearch", | 795 "EmbeddedSearch", |
| 796 "Group1 espv:80 prefetch_results:1")); | 796 "Group1 espv:80 prefetch_results:1")); |
| 797 EXPECT_TRUE(ShouldPrefetchSearchResults()); | 797 EXPECT_TRUE(ShouldPrefetchSearchResults()); |
| 798 | 798 |
| 799 EXPECT_EQ(GURL("https://foo.com/instant?ion=1&foo=foo#foo=foo&strk"), | 799 EXPECT_EQ(GURL("https://foo.com/instant?ion=1&foo=foo#foo=foo&strk"), |
| 800 GetSearchResultPrefetchBaseURL(profile())); | 800 GetSearchResultPrefetchBaseURL(profile())); |
| 801 } | 801 } |
| 802 | 802 |
| 803 TEST_F(SearchTest, ForceInstantResultsParam) { | |
| 804 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch", | |
| 805 "Group1 espv:2")); | |
| 806 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); | |
| 807 EXPECT_EQ("ion=1&", ForceInstantResultsParam(true)); | |
| 808 EXPECT_EQ("", ForceInstantResultsParam(false)); | |
|
Peter Kasting
2014/02/14 05:30:00
Nit: "" -> std::string()
kmadhusu
2014/02/14 18:24:04
Done.
| |
| 809 } | |
| 810 | |
| 803 class SearchURLTest : public SearchTest { | 811 class SearchURLTest : public SearchTest { |
| 804 protected: | 812 protected: |
| 805 virtual void SetSearchProvider(bool set_ntp_url, bool insecure_ntp_url) | 813 virtual void SetSearchProvider(bool set_ntp_url, bool insecure_ntp_url) |
| 806 OVERRIDE { | 814 OVERRIDE { |
| 807 TemplateURLService* template_url_service = | 815 TemplateURLService* template_url_service = |
| 808 TemplateURLServiceFactory::GetForProfile(profile()); | 816 TemplateURLServiceFactory::GetForProfile(profile()); |
| 809 TemplateURLData data; | 817 TemplateURLData data; |
| 810 data.SetURL("{google:baseURL}search?" | 818 data.SetURL("{google:baseURL}search?" |
| 811 "{google:instantExtendedEnabledParameter}q={searchTerms}"); | 819 "{google:instantExtendedEnabledParameter}q={searchTerms}"); |
| 812 data.search_terms_replacement_key = "espv"; | 820 data.search_terms_replacement_key = "espv"; |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1176 } | 1184 } |
| 1177 | 1185 |
| 1178 TEST_F(OriginChipV2Test, CommandLineHideOnUserInput) { | 1186 TEST_F(OriginChipV2Test, CommandLineHideOnUserInput) { |
| 1179 CommandLine::ForCurrentProcess()->AppendSwitch( | 1187 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1180 switches::kEnableOriginChipV2HideOnUserInput); | 1188 switches::kEnableOriginChipV2HideOnUserInput); |
| 1181 EXPECT_TRUE(ShouldDisplayOriginChipV2()); | 1189 EXPECT_TRUE(ShouldDisplayOriginChipV2()); |
| 1182 EXPECT_EQ(ORIGIN_CHIP_V2_HIDE_ON_USER_INPUT, GetOriginChipV2HideTrigger()); | 1190 EXPECT_EQ(ORIGIN_CHIP_V2_HIDE_ON_USER_INPUT, GetOriginChipV2HideTrigger()); |
| 1183 } | 1191 } |
| 1184 | 1192 |
| 1185 } // namespace chrome | 1193 } // namespace chrome |
| OLD | NEW |