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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
| 38 #include "content/public/common/renderer_preferences.h" | 38 #include "content/public/common/renderer_preferences.h" |
| 39 #include "url/gurl.h" | 39 #include "url/gurl.h" |
| 40 | 40 |
| 41 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 41 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 42 #include "chrome/browser/supervised_user/supervised_user_service.h" | 42 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 43 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 43 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 44 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 44 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 #if defined(OS_MACOSX) | |
| 48 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" | |
| 49 #endif | |
| 50 | |
| 47 namespace search { | 51 namespace search { |
| 48 | 52 |
| 49 class SearchTest : public BrowserWithTestWindowTest { | 53 class SearchTest : public BrowserWithTestWindowTest { |
| 50 protected: | 54 protected: |
| 51 void SetUp() override { | 55 void SetUp() override { |
| 52 BrowserWithTestWindowTest::SetUp(); | 56 BrowserWithTestWindowTest::SetUp(); |
| 53 field_trial_list_.reset(new base::FieldTrialList( | 57 field_trial_list_.reset(new base::FieldTrialList( |
| 54 base::MakeUnique<metrics::SHA1EntropyProvider>("42"))); | 58 base::MakeUnique<metrics::SHA1EntropyProvider>("42"))); |
| 55 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 59 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 56 profile(), &TemplateURLServiceFactory::BuildInstanceFor); | 60 profile(), &TemplateURLServiceFactory::BuildInstanceFor); |
| 57 TemplateURLService* template_url_service = | 61 TemplateURLService* template_url_service = |
| 58 TemplateURLServiceFactory::GetForProfile(profile()); | 62 TemplateURLServiceFactory::GetForProfile(profile()); |
| 59 search_test_utils::WaitForTemplateURLServiceToLoad(template_url_service); | 63 search_test_utils::WaitForTemplateURLServiceToLoad(template_url_service); |
| 60 SetSearchProvider(true, false); | 64 SetSearchProvider(true, false); |
| 65 | |
| 66 #if defined(OS_MACOSX) | |
| 67 ui::WindowResizeHelperMac::Get()->Init(base::ThreadTaskRunnerHandle::Get()); | |
|
Charlie Reis
2016/11/23 07:25:22
Just for the record, what made this test change ne
lfg
2016/11/29 17:41:22
Search test performs multiple navigations, in part
Charlie Reis
2016/11/29 19:35:55
Hmm, I don't follow. Lots of tests do multiple na
| |
| 68 #endif // OS_MACOSX | |
| 69 } | |
| 70 | |
| 71 void TearDown() override { | |
| 72 #if defined(OS_MACOSX) | |
| 73 ui::WindowResizeHelperMac::Get()->ShutdownForTests(); | |
| 74 #endif // OS_MACOSX | |
| 75 | |
| 76 BrowserWithTestWindowTest::TearDown(); | |
| 61 } | 77 } |
| 62 | 78 |
| 63 virtual void SetSearchProvider(bool set_ntp_url, bool insecure_ntp_url) { | 79 virtual void SetSearchProvider(bool set_ntp_url, bool insecure_ntp_url) { |
| 64 TemplateURLService* template_url_service = | 80 TemplateURLService* template_url_service = |
| 65 TemplateURLServiceFactory::GetForProfile(profile()); | 81 TemplateURLServiceFactory::GetForProfile(profile()); |
| 66 TemplateURLData data; | 82 TemplateURLData data; |
| 67 data.SetShortName(base::ASCIIToUTF16("foo.com")); | 83 data.SetShortName(base::ASCIIToUTF16("foo.com")); |
| 68 data.SetURL("http://foo.com/url?bar={searchTerms}"); | 84 data.SetURL("http://foo.com/url?bar={searchTerms}"); |
| 69 data.instant_url = "http://foo.com/instant?" | 85 data.instant_url = "http://foo.com/instant?" |
| 70 "{google:forceInstantResults}foo=foo#foo=foo&strk"; | 86 "{google:forceInstantResults}foo=foo#foo=foo&strk"; |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 668 TemplateURLRef::SearchTermsArgs search_terms_args(base::ASCIIToUTF16("foo")); | 684 TemplateURLRef::SearchTermsArgs search_terms_args(base::ASCIIToUTF16("foo")); |
| 669 GURL result(template_url_->url_ref().ReplaceSearchTerms( | 685 GURL result(template_url_->url_ref().ReplaceSearchTerms( |
| 670 search_terms_args, UIThreadSearchTermsData(profile()))); | 686 search_terms_args, UIThreadSearchTermsData(profile()))); |
| 671 ASSERT_TRUE(result.is_valid()); | 687 ASSERT_TRUE(result.is_valid()); |
| 672 // Query extraction is disabled. Make sure | 688 // Query extraction is disabled. Make sure |
| 673 // {google:instantExtendedEnabledParameter} is not set in the search URL. | 689 // {google:instantExtendedEnabledParameter} is not set in the search URL. |
| 674 EXPECT_EQ("http://www.google.com/search?q=foo", result.spec()); | 690 EXPECT_EQ("http://www.google.com/search?q=foo", result.spec()); |
| 675 } | 691 } |
| 676 | 692 |
| 677 } // namespace search | 693 } // namespace search |
| OLD | NEW |