| 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" |
| 11 #include "chrome/browser/search/instant_service.h" | 11 #include "chrome/browser/search/instant_service.h" |
| 12 #include "chrome/browser/search/instant_service_factory.h" | 12 #include "chrome/browser/search/instant_service_factory.h" |
| 13 #include "chrome/browser/search/search.h" | 13 #include "chrome/browser/search/search.h" |
| 14 #include "chrome/browser/search_engines/search_terms_data.h" | 14 #include "chrome/browser/search_engines/search_terms_data.h" |
| 15 #include "chrome/browser/search_engines/template_url_service.h" | 15 #include "chrome/browser/search_engines/template_url_service.h" |
| 16 #include "chrome/browser/search_engines/template_url_service_factory.h" | 16 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 21 #include "chrome/test/base/browser_with_test_window_test.h" | 21 #include "chrome/test/base/browser_with_test_window_test.h" |
| 22 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
| 23 #include "components/variations/entropy_provider.h" | 23 #include "components/variations/entropy_provider.h" |
| 24 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
| 25 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
| 26 #include "content/public/browser/site_instance.h" | 26 #include "content/public/browser/site_instance.h" |
| 27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "content/public/common/renderer_preferences.h" | 28 #include "content/public/common/renderer_preferences.h" |
| 29 #include "url/gurl.h" |
| 29 | 30 |
| 30 namespace chrome { | 31 namespace chrome { |
| 31 | 32 |
| 32 class EmbeddedSearchFieldTrialTest : public testing::Test { | 33 class EmbeddedSearchFieldTrialTest : public testing::Test { |
| 33 protected: | 34 protected: |
| 34 virtual void SetUp() { | 35 virtual void SetUp() { |
| 35 field_trial_list_.reset(new base::FieldTrialList( | 36 field_trial_list_.reset(new base::FieldTrialList( |
| 36 new metrics::SHA1EntropyProvider("42"))); | 37 new metrics::SHA1EntropyProvider("42"))); |
| 37 base::StatisticsRecorder::Initialize(); | 38 base::StatisticsRecorder::Initialize(); |
| 38 ResetInstantExtendedOptInStateGateForTest(); | 39 ResetInstantExtendedOptInStateGateForTest(); |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 EXPECT_FALSE(chrome::IsNTPURL(search_url_with_search_terms, profile())); | 874 EXPECT_FALSE(chrome::IsNTPURL(search_url_with_search_terms, profile())); |
| 874 EXPECT_TRUE(chrome::IsNTPURL(search_url_without_search_terms, profile())); | 875 EXPECT_TRUE(chrome::IsNTPURL(search_url_without_search_terms, profile())); |
| 875 | 876 |
| 876 EXPECT_FALSE(chrome::IsNTPURL(ntp_url, NULL)); | 877 EXPECT_FALSE(chrome::IsNTPURL(ntp_url, NULL)); |
| 877 EXPECT_FALSE(chrome::IsNTPURL(local_ntp_url, NULL)); | 878 EXPECT_FALSE(chrome::IsNTPURL(local_ntp_url, NULL)); |
| 878 EXPECT_FALSE(chrome::IsNTPURL(remote_ntp_url, NULL)); | 879 EXPECT_FALSE(chrome::IsNTPURL(remote_ntp_url, NULL)); |
| 879 EXPECT_FALSE(chrome::IsNTPURL(search_url_with_search_terms, NULL)); | 880 EXPECT_FALSE(chrome::IsNTPURL(search_url_with_search_terms, NULL)); |
| 880 EXPECT_FALSE(chrome::IsNTPURL(search_url_without_search_terms, NULL)); | 881 EXPECT_FALSE(chrome::IsNTPURL(search_url_without_search_terms, NULL)); |
| 881 } | 882 } |
| 882 | 883 |
| 884 TEST_F(SearchTest, GetSearchURLs) { |
| 885 std::vector<GURL> search_urls = GetSearchURLs(profile()); |
| 886 EXPECT_EQ(2U, search_urls.size()); |
| 887 EXPECT_EQ("http://foo.com/alt#quux=", search_urls[0].spec()); |
| 888 EXPECT_EQ("http://foo.com/url?bar=", search_urls[1].spec()); |
| 889 } |
| 890 |
| 883 } // namespace chrome | 891 } // namespace chrome |
| OLD | NEW |