Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(766)

Side by Side Diff: chrome/browser/ui/search/search_tab_helper_unittest.cc

Issue 681823004: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/ui/search/search_tab_helper.h" 5 #include "chrome/browser/ui/search/search_tab_helper.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 MOCK_METHOD2(OnLogMostVisitedNavigation, 66 MOCK_METHOD2(OnLogMostVisitedNavigation,
67 void(int position, const base::string16& provider)); 67 void(int position, const base::string16& provider));
68 MOCK_METHOD1(PasteIntoOmnibox, void(const base::string16&)); 68 MOCK_METHOD1(PasteIntoOmnibox, void(const base::string16&));
69 MOCK_METHOD1(OnChromeIdentityCheck, void(const base::string16& identity)); 69 MOCK_METHOD1(OnChromeIdentityCheck, void(const base::string16& identity));
70 }; 70 };
71 71
72 } // namespace 72 } // namespace
73 73
74 class SearchTabHelperTest : public ChromeRenderViewHostTestHarness { 74 class SearchTabHelperTest : public ChromeRenderViewHostTestHarness {
75 public: 75 public:
76 virtual void SetUp() { 76 void SetUp() override {
77 ChromeRenderViewHostTestHarness::SetUp(); 77 ChromeRenderViewHostTestHarness::SetUp();
78 SearchTabHelper::CreateForWebContents(web_contents()); 78 SearchTabHelper::CreateForWebContents(web_contents());
79 } 79 }
80 80
81 content::BrowserContext* CreateBrowserContext() override { 81 content::BrowserContext* CreateBrowserContext() override {
82 TestingProfile::Builder builder; 82 TestingProfile::Builder builder;
83 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), 83 builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
84 FakeSigninManagerBase::Build); 84 FakeSigninManagerBase::Build);
85 builder.AddTestingFactory( 85 builder.AddTestingFactory(
86 ProfileSyncServiceFactory::GetInstance(), 86 ProfileSyncServiceFactory::GetInstance(),
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 TabTitleObserver title_observer(web_contents()); 307 TabTitleObserver title_observer(web_contents());
308 NavigateAndCommit(GURL(chrome::kChromeUINewTabURL)); 308 NavigateAndCommit(GURL(chrome::kChromeUINewTabURL));
309 const base::string16 title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); 309 const base::string16 title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE);
310 EXPECT_EQ(title, title_observer.title_on_start()); 310 EXPECT_EQ(title, title_observer.title_on_start());
311 EXPECT_EQ(title, title_observer.title_on_commit()); 311 EXPECT_EQ(title, title_observer.title_on_commit());
312 EXPECT_EQ(title, web_contents()->GetTitle()); 312 EXPECT_EQ(title, web_contents()->GetTitle());
313 } 313 }
314 314
315 class SearchTabHelperWindowTest : public BrowserWithTestWindowTest { 315 class SearchTabHelperWindowTest : public BrowserWithTestWindowTest {
316 protected: 316 protected:
317 virtual void SetUp() override { 317 void SetUp() override {
318 BrowserWithTestWindowTest::SetUp(); 318 BrowserWithTestWindowTest::SetUp();
319 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 319 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
320 profile(), &TemplateURLServiceFactory::BuildInstanceFor); 320 profile(), &TemplateURLServiceFactory::BuildInstanceFor);
321 TemplateURLService* template_url_service = 321 TemplateURLService* template_url_service =
322 TemplateURLServiceFactory::GetForProfile(profile()); 322 TemplateURLServiceFactory::GetForProfile(profile());
323 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service); 323 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service);
324 324
325 TemplateURLData data; 325 TemplateURLData data;
326 data.SetURL("http://foo.com/url?bar={searchTerms}"); 326 data.SetURL("http://foo.com/url?bar={searchTerms}");
327 data.instant_url = "http://foo.com/instant?" 327 data.instant_url = "http://foo.com/instant?"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 GURL("http://www.example.com"), 394 GURL("http://www.example.com"),
395 1, 395 1,
396 base::string16()); 396 base::string16());
397 CommitPendingLoad(controller); 397 CommitPendingLoad(controller);
398 EXPECT_NE(GURL(chrome::kChromeSearchLocalNtpUrl), 398 EXPECT_NE(GURL(chrome::kChromeSearchLocalNtpUrl),
399 controller->GetLastCommittedEntry()->GetURL()); 399 controller->GetLastCommittedEntry()->GetURL());
400 } 400 }
401 401
402 class SearchTabHelperPrerenderTest : public InstantUnitTestBase { 402 class SearchTabHelperPrerenderTest : public InstantUnitTestBase {
403 public: 403 public:
404 virtual ~SearchTabHelperPrerenderTest() {} 404 ~SearchTabHelperPrerenderTest() override {}
405 405
406 protected: 406 protected:
407 virtual void SetUp() override { 407 void SetUp() override {
408 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( 408 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
409 "EmbeddedSearch", 409 "EmbeddedSearch",
410 "Group1 espv:89 prefetch_results:1 " 410 "Group1 espv:89 prefetch_results:1 "
411 "prerender_instant_url_on_omnibox_focus:1")); 411 "prerender_instant_url_on_omnibox_focus:1"));
412 InstantUnitTestBase::SetUp(); 412 InstantUnitTestBase::SetUp();
413 413
414 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); 414 AddTab(browser(), GURL(chrome::kChromeUINewTabURL));
415 prerender::PrerenderManagerFactory::GetForProfile(browser()->profile())-> 415 prerender::PrerenderManagerFactory::GetForProfile(browser()->profile())->
416 OnCookieStoreLoaded(); 416 OnCookieStoreLoaded();
417 SearchTabHelper::FromWebContents(web_contents())->set_omnibox_has_focus_fn( 417 SearchTabHelper::FromWebContents(web_contents())->set_omnibox_has_focus_fn(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 } 458 }
459 459
460 TEST_F(SearchTabHelperPrerenderTest, 460 TEST_F(SearchTabHelperPrerenderTest,
461 OnTabActivatedNoPrerenderIfOmniboxBlurred) { 461 OnTabActivatedNoPrerenderIfOmniboxBlurred) {
462 SearchTabHelperPrerenderTest::omnibox_has_focus_ = false; 462 SearchTabHelperPrerenderTest::omnibox_has_focus_ = false;
463 SearchTabHelper* search_tab_helper = 463 SearchTabHelper* search_tab_helper =
464 SearchTabHelper::FromWebContents(web_contents()); 464 SearchTabHelper::FromWebContents(web_contents());
465 search_tab_helper->OnTabActivated(); 465 search_tab_helper->OnTabActivated();
466 ASSERT_FALSE(IsInstantURLMarkedForPrerendering()); 466 ASSERT_FALSE(IsInstantURLMarkedForPrerendering());
467 } 467 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698