| 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(std::string(), ForceInstantResultsParam(false)); |
| 809 } |
| 810 |
| 803 struct ExtractSearchTermsTestCase { | 811 struct ExtractSearchTermsTestCase { |
| 804 const char* url; | 812 const char* url; |
| 805 const char* expected_result; | 813 const char* expected_result; |
| 806 const char* comment; | 814 const char* comment; |
| 807 }; | 815 }; |
| 808 | 816 |
| 809 TEST_F(SearchTest, ExtractSearchTermsFromURL) { | 817 TEST_F(SearchTest, ExtractSearchTermsFromURL) { |
| 810 const ExtractSearchTermsTestCase kTestCases[] = { | 818 const ExtractSearchTermsTestCase kTestCases[] = { |
| 811 {chrome::kChromeSearchLocalNtpUrl, "", "NTP url"}, | 819 {chrome::kChromeSearchLocalNtpUrl, "", "NTP url"}, |
| 812 {"https://foo.com/instant?strk", "", "Invalid search url"}, | 820 {"https://foo.com/instant?strk", "", "Invalid search url"}, |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 } | 1234 } |
| 1227 | 1235 |
| 1228 TEST_F(OriginChipV2Test, CommandLineHideOnUserInput) { | 1236 TEST_F(OriginChipV2Test, CommandLineHideOnUserInput) { |
| 1229 CommandLine::ForCurrentProcess()->AppendSwitch( | 1237 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1230 switches::kEnableOriginChipV2HideOnUserInput); | 1238 switches::kEnableOriginChipV2HideOnUserInput); |
| 1231 EXPECT_TRUE(ShouldDisplayOriginChipV2()); | 1239 EXPECT_TRUE(ShouldDisplayOriginChipV2()); |
| 1232 EXPECT_EQ(ORIGIN_CHIP_V2_HIDE_ON_USER_INPUT, GetOriginChipV2HideTrigger()); | 1240 EXPECT_EQ(ORIGIN_CHIP_V2_HIDE_ON_USER_INPUT, GetOriginChipV2HideTrigger()); |
| 1233 } | 1241 } |
| 1234 | 1242 |
| 1235 } // namespace chrome | 1243 } // namespace chrome |
| OLD | NEW |