| 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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #if defined(ENABLE_MANAGED_USERS) | 34 #if defined(ENABLE_MANAGED_USERS) |
| 35 #include "chrome/browser/supervised_user/supervised_user_service.h" | 35 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 36 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 36 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 37 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 37 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 namespace chrome { | 40 namespace chrome { |
| 41 | 41 |
| 42 class SearchTest : public BrowserWithTestWindowTest { | 42 class SearchTest : public BrowserWithTestWindowTest { |
| 43 protected: | 43 protected: |
| 44 virtual void SetUp() OVERRIDE { | 44 virtual void SetUp() override { |
| 45 BrowserWithTestWindowTest::SetUp(); | 45 BrowserWithTestWindowTest::SetUp(); |
| 46 field_trial_list_.reset(new base::FieldTrialList( | 46 field_trial_list_.reset(new base::FieldTrialList( |
| 47 new metrics::SHA1EntropyProvider("42"))); | 47 new metrics::SHA1EntropyProvider("42"))); |
| 48 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 48 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 49 profile(), &TemplateURLServiceFactory::BuildInstanceFor); | 49 profile(), &TemplateURLServiceFactory::BuildInstanceFor); |
| 50 TemplateURLService* template_url_service = | 50 TemplateURLService* template_url_service = |
| 51 TemplateURLServiceFactory::GetForProfile(profile()); | 51 TemplateURLServiceFactory::GetForProfile(profile()); |
| 52 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service); | 52 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service); |
| 53 SetSearchProvider(true, false); | 53 SetSearchProvider(true, false); |
| 54 } | 54 } |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 const QueryExtractionAllowedTestCase& test = kTestCases[i]; | 753 const QueryExtractionAllowedTestCase& test = kTestCases[i]; |
| 754 EXPECT_EQ(test.expected_result, | 754 EXPECT_EQ(test.expected_result, |
| 755 chrome::IsQueryExtractionAllowedForURL(profile(), GURL(test.url))) | 755 chrome::IsQueryExtractionAllowedForURL(profile(), GURL(test.url))) |
| 756 << test.url << " " << test.comment; | 756 << test.url << " " << test.comment; |
| 757 } | 757 } |
| 758 } | 758 } |
| 759 | 759 |
| 760 class SearchURLTest : public SearchTest { | 760 class SearchURLTest : public SearchTest { |
| 761 protected: | 761 protected: |
| 762 virtual void SetSearchProvider(bool set_ntp_url, bool insecure_ntp_url) | 762 virtual void SetSearchProvider(bool set_ntp_url, bool insecure_ntp_url) |
| 763 OVERRIDE { | 763 override { |
| 764 TemplateURLService* template_url_service = | 764 TemplateURLService* template_url_service = |
| 765 TemplateURLServiceFactory::GetForProfile(profile()); | 765 TemplateURLServiceFactory::GetForProfile(profile()); |
| 766 TemplateURLData data; | 766 TemplateURLData data; |
| 767 data.SetURL("{google:baseURL}search?" | 767 data.SetURL("{google:baseURL}search?" |
| 768 "{google:instantExtendedEnabledParameter}q={searchTerms}"); | 768 "{google:instantExtendedEnabledParameter}q={searchTerms}"); |
| 769 data.search_terms_replacement_key = "espv"; | 769 data.search_terms_replacement_key = "espv"; |
| 770 template_url_ = new TemplateURL(data); | 770 template_url_ = new TemplateURL(data); |
| 771 // |template_url_service| takes ownership of |template_url_|. | 771 // |template_url_service| takes ownership of |template_url_|. |
| 772 template_url_service->Add(template_url_); | 772 template_url_service->Add(template_url_); |
| 773 template_url_service->SetUserSelectedDefaultSearchProvider(template_url_); | 773 template_url_service->SetUserSelectedDefaultSearchProvider(template_url_); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 TEST_F(OriginChipTest, CommandLineOnSrp) { | 1007 TEST_F(OriginChipTest, CommandLineOnSrp) { |
| 1008 CommandLine::ForCurrentProcess()->AppendSwitch( | 1008 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1009 switches::kEnableOriginChipOnSrp); | 1009 switches::kEnableOriginChipOnSrp); |
| 1010 EXPECT_TRUE(ShouldDisplayOriginChip()); | 1010 EXPECT_TRUE(ShouldDisplayOriginChip()); |
| 1011 EXPECT_EQ(ORIGIN_CHIP_ON_SRP, GetOriginChipCondition()); | 1011 EXPECT_EQ(ORIGIN_CHIP_ON_SRP, GetOriginChipCondition()); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 } // namespace chrome | 1014 } // namespace chrome |
| OLD | NEW |