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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 624173002: replace OVERRIDE and FINAL with override and final in chrome/browser/[j-q]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 } 482 }
483 483
484 int output_mute_changed_count() const { 484 int output_mute_changed_count() const {
485 return output_mute_changed_count_; 485 return output_mute_changed_count_;
486 } 486 }
487 487
488 virtual ~TestAudioObserver() {} 488 virtual ~TestAudioObserver() {}
489 489
490 protected: 490 protected:
491 // chromeos::CrasAudioHandler::AudioObserver overrides. 491 // chromeos::CrasAudioHandler::AudioObserver overrides.
492 virtual void OnOutputMuteChanged() OVERRIDE { 492 virtual void OnOutputMuteChanged() override {
493 ++output_mute_changed_count_; 493 ++output_mute_changed_count_;
494 } 494 }
495 495
496 private: 496 private:
497 int output_mute_changed_count_; 497 int output_mute_changed_count_;
498 498
499 DISALLOW_COPY_AND_ASSIGN(TestAudioObserver); 499 DISALLOW_COPY_AND_ASSIGN(TestAudioObserver);
500 }; 500 };
501 #endif 501 #endif
502 502
503 // This class waits until either a load stops or the WebContents is destroyed. 503 // This class waits until either a load stops or the WebContents is destroyed.
504 class WebContentsLoadedOrDestroyedWatcher 504 class WebContentsLoadedOrDestroyedWatcher
505 : public content::WebContentsObserver { 505 : public content::WebContentsObserver {
506 public: 506 public:
507 explicit WebContentsLoadedOrDestroyedWatcher( 507 explicit WebContentsLoadedOrDestroyedWatcher(
508 content::WebContents* web_contents); 508 content::WebContents* web_contents);
509 virtual ~WebContentsLoadedOrDestroyedWatcher(); 509 virtual ~WebContentsLoadedOrDestroyedWatcher();
510 510
511 // Waits until the WebContents's load is done or until it is destroyed. 511 // Waits until the WebContents's load is done or until it is destroyed.
512 void Wait(); 512 void Wait();
513 513
514 // Overridden WebContentsObserver methods. 514 // Overridden WebContentsObserver methods.
515 virtual void WebContentsDestroyed() OVERRIDE; 515 virtual void WebContentsDestroyed() override;
516 virtual void DidStopLoading( 516 virtual void DidStopLoading(
517 content::RenderViewHost* render_view_host) OVERRIDE; 517 content::RenderViewHost* render_view_host) override;
518 518
519 private: 519 private:
520 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; 520 scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
521 521
522 DISALLOW_COPY_AND_ASSIGN(WebContentsLoadedOrDestroyedWatcher); 522 DISALLOW_COPY_AND_ASSIGN(WebContentsLoadedOrDestroyedWatcher);
523 }; 523 };
524 524
525 WebContentsLoadedOrDestroyedWatcher::WebContentsLoadedOrDestroyedWatcher( 525 WebContentsLoadedOrDestroyedWatcher::WebContentsLoadedOrDestroyedWatcher(
526 content::WebContents* web_contents) 526 content::WebContents* web_contents)
527 : content::WebContentsObserver(web_contents), 527 : content::WebContentsObserver(web_contents),
(...skipping 18 matching lines...) Expand all
546 #if !defined(OS_MACOSX) 546 #if !defined(OS_MACOSX)
547 547
548 // Observer used to wait for the creation of a new app window. 548 // Observer used to wait for the creation of a new app window.
549 class TestAddAppWindowObserver 549 class TestAddAppWindowObserver
550 : public extensions::AppWindowRegistry::Observer { 550 : public extensions::AppWindowRegistry::Observer {
551 public: 551 public:
552 explicit TestAddAppWindowObserver(extensions::AppWindowRegistry* registry); 552 explicit TestAddAppWindowObserver(extensions::AppWindowRegistry* registry);
553 virtual ~TestAddAppWindowObserver(); 553 virtual ~TestAddAppWindowObserver();
554 554
555 // extensions::AppWindowRegistry::Observer: 555 // extensions::AppWindowRegistry::Observer:
556 virtual void OnAppWindowAdded(extensions::AppWindow* app_window) OVERRIDE; 556 virtual void OnAppWindowAdded(extensions::AppWindow* app_window) override;
557 557
558 extensions::AppWindow* WaitForAppWindow(); 558 extensions::AppWindow* WaitForAppWindow();
559 559
560 private: 560 private:
561 extensions::AppWindowRegistry* registry_; // Not owned. 561 extensions::AppWindowRegistry* registry_; // Not owned.
562 extensions::AppWindow* window_; // Not owned. 562 extensions::AppWindow* window_; // Not owned.
563 base::RunLoop run_loop_; 563 base::RunLoop run_loop_;
564 564
565 DISALLOW_COPY_AND_ASSIGN(TestAddAppWindowObserver); 565 DISALLOW_COPY_AND_ASSIGN(TestAddAppWindowObserver);
566 }; 566 };
(...skipping 21 matching lines...) Expand all
588 588
589 #endif 589 #endif
590 590
591 } // namespace 591 } // namespace
592 592
593 class PolicyTest : public InProcessBrowserTest { 593 class PolicyTest : public InProcessBrowserTest {
594 protected: 594 protected:
595 PolicyTest() {} 595 PolicyTest() {}
596 virtual ~PolicyTest() {} 596 virtual ~PolicyTest() {}
597 597
598 virtual void SetUp() OVERRIDE { 598 virtual void SetUp() override {
599 test_extension_cache_.reset(new extensions::ExtensionCacheFake()); 599 test_extension_cache_.reset(new extensions::ExtensionCacheFake());
600 InProcessBrowserTest::SetUp(); 600 InProcessBrowserTest::SetUp();
601 } 601 }
602 602
603 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 603 virtual void SetUpInProcessBrowserTestFixture() override {
604 CommandLine::ForCurrentProcess()->AppendSwitch("noerrdialogs"); 604 CommandLine::ForCurrentProcess()->AppendSwitch("noerrdialogs");
605 EXPECT_CALL(provider_, IsInitializationComplete(_)) 605 EXPECT_CALL(provider_, IsInitializationComplete(_))
606 .WillRepeatedly(Return(true)); 606 .WillRepeatedly(Return(true));
607 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); 607 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
608 } 608 }
609 609
610 virtual void SetUpOnMainThread() OVERRIDE { 610 virtual void SetUpOnMainThread() override {
611 BrowserThread::PostTask( 611 BrowserThread::PostTask(
612 BrowserThread::IO, FROM_HERE, 612 BrowserThread::IO, FROM_HERE,
613 base::Bind(chrome_browser_net::SetUrlRequestMocksEnabled, true)); 613 base::Bind(chrome_browser_net::SetUrlRequestMocksEnabled, true));
614 } 614 }
615 615
616 // Makes URLRequestMockHTTPJobs serve data from content::DIR_TEST_DATA 616 // Makes URLRequestMockHTTPJobs serve data from content::DIR_TEST_DATA
617 // instead of chrome::DIR_TEST_DATA. 617 // instead of chrome::DIR_TEST_DATA.
618 void ServeContentTestData() { 618 void ServeContentTestData() {
619 base::FilePath root_http; 619 base::FilePath root_http;
620 PathService::Get(content::DIR_TEST_DATA, &root_http); 620 PathService::Get(content::DIR_TEST_DATA, &root_http);
(...skipping 15 matching lines...) Expand all
636 new base::FundamentalValue(!enabled), 636 new base::FundamentalValue(!enabled),
637 NULL); 637 NULL);
638 UpdateProviderPolicy(policies); 638 UpdateProviderPolicy(policies);
639 } 639 }
640 640
641 #if defined(OS_CHROMEOS) 641 #if defined(OS_CHROMEOS)
642 class QuitMessageLoopAfterScreenshot : public ScreenshotTakerObserver { 642 class QuitMessageLoopAfterScreenshot : public ScreenshotTakerObserver {
643 public: 643 public:
644 virtual void OnScreenshotCompleted( 644 virtual void OnScreenshotCompleted(
645 ScreenshotTakerObserver::Result screenshot_result, 645 ScreenshotTakerObserver::Result screenshot_result,
646 const base::FilePath& screenshot_path) OVERRIDE { 646 const base::FilePath& screenshot_path) override {
647 BrowserThread::PostTaskAndReply(BrowserThread::IO, 647 BrowserThread::PostTaskAndReply(BrowserThread::IO,
648 FROM_HERE, 648 FROM_HERE,
649 base::Bind(base::DoNothing), 649 base::Bind(base::DoNothing),
650 base::MessageLoop::QuitClosure()); 650 base::MessageLoop::QuitClosure());
651 } 651 }
652 652
653 virtual ~QuitMessageLoopAfterScreenshot() {} 653 virtual ~QuitMessageLoopAfterScreenshot() {}
654 }; 654 };
655 655
656 void TestScreenshotFile(bool enabled) { 656 void TestScreenshotFile(bool enabled) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 764
765 #if defined(OS_WIN) 765 #if defined(OS_WIN)
766 // This policy only exists on Windows. 766 // This policy only exists on Windows.
767 767
768 // Sets the locale policy before the browser is started. 768 // Sets the locale policy before the browser is started.
769 class LocalePolicyTest : public PolicyTest { 769 class LocalePolicyTest : public PolicyTest {
770 public: 770 public:
771 LocalePolicyTest() {} 771 LocalePolicyTest() {}
772 virtual ~LocalePolicyTest() {} 772 virtual ~LocalePolicyTest() {}
773 773
774 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 774 virtual void SetUpInProcessBrowserTestFixture() override {
775 PolicyTest::SetUpInProcessBrowserTestFixture(); 775 PolicyTest::SetUpInProcessBrowserTestFixture();
776 PolicyMap policies; 776 PolicyMap policies;
777 policies.Set(key::kApplicationLocaleValue, 777 policies.Set(key::kApplicationLocaleValue,
778 POLICY_LEVEL_MANDATORY, 778 POLICY_LEVEL_MANDATORY,
779 POLICY_SCOPE_USER, 779 POLICY_SCOPE_USER,
780 new base::StringValue("fr"), 780 new base::StringValue("fr"),
781 NULL); 781 NULL);
782 provider_.UpdateChromePolicy(policies); 782 provider_.UpdateChromePolicy(policies);
783 // The "en-US" ResourceBundle is always loaded before this step for tests, 783 // The "en-US" ResourceBundle is always loaded before this step for tests,
784 // but in this test we want the browser to load the bundle as it 784 // but in this test we want the browser to load the bundle as it
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
2668 // and stores the expected startup URLs in |expected_urls_|. 2668 // and stores the expected startup URLs in |expected_urls_|.
2669 class RestoreOnStartupPolicyTest 2669 class RestoreOnStartupPolicyTest
2670 : public PolicyTest, 2670 : public PolicyTest,
2671 public testing::WithParamInterface< 2671 public testing::WithParamInterface<
2672 void (RestoreOnStartupPolicyTest::*)(void)> { 2672 void (RestoreOnStartupPolicyTest::*)(void)> {
2673 public: 2673 public:
2674 RestoreOnStartupPolicyTest() {} 2674 RestoreOnStartupPolicyTest() {}
2675 virtual ~RestoreOnStartupPolicyTest() {} 2675 virtual ~RestoreOnStartupPolicyTest() {}
2676 2676
2677 #if defined(OS_CHROMEOS) 2677 #if defined(OS_CHROMEOS)
2678 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 2678 virtual void SetUpCommandLine(CommandLine* command_line) override {
2679 // TODO(nkostylev): Investigate if we can remove this switch. 2679 // TODO(nkostylev): Investigate if we can remove this switch.
2680 command_line->AppendSwitch(switches::kCreateBrowserOnStartupForTests); 2680 command_line->AppendSwitch(switches::kCreateBrowserOnStartupForTests);
2681 PolicyTest::SetUpCommandLine(command_line); 2681 PolicyTest::SetUpCommandLine(command_line);
2682 } 2682 }
2683 #endif 2683 #endif
2684 2684
2685 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 2685 virtual void SetUpInProcessBrowserTestFixture() override {
2686 PolicyTest::SetUpInProcessBrowserTestFixture(); 2686 PolicyTest::SetUpInProcessBrowserTestFixture();
2687 // Set early policies now, before the browser is created. 2687 // Set early policies now, before the browser is created.
2688 (this->*(GetParam()))(); 2688 (this->*(GetParam()))();
2689 2689
2690 // Remove the non-switch arguments, so that session restore kicks in for 2690 // Remove the non-switch arguments, so that session restore kicks in for
2691 // these tests. 2691 // these tests.
2692 CommandLine* command_line = CommandLine::ForCurrentProcess(); 2692 CommandLine* command_line = CommandLine::ForCurrentProcess();
2693 CommandLine::StringVector argv = command_line->argv(); 2693 CommandLine::StringVector argv = command_line->argv();
2694 argv.erase(std::remove_if(++argv.begin(), argv.end(), IsNonSwitchArgument), 2694 argv.erase(std::remove_if(++argv.begin(), argv.end(), IsNonSwitchArgument),
2695 argv.end()); 2695 argv.end());
2696 command_line->InitFromArgv(argv); 2696 command_line->InitFromArgv(argv);
2697 ASSERT_TRUE(std::equal(argv.begin(), argv.end(), 2697 ASSERT_TRUE(std::equal(argv.begin(), argv.end(),
2698 command_line->argv().begin())); 2698 command_line->argv().begin()));
2699 } 2699 }
2700 2700
2701 virtual void SetUpOnMainThread() OVERRIDE { 2701 virtual void SetUpOnMainThread() override {
2702 BrowserThread::PostTask( 2702 BrowserThread::PostTask(
2703 BrowserThread::IO, 2703 BrowserThread::IO,
2704 FROM_HERE, 2704 FROM_HERE,
2705 base::Bind( 2705 base::Bind(
2706 RedirectHostsToTestData, kRestoredURLs, arraysize(kRestoredURLs))); 2706 RedirectHostsToTestData, kRestoredURLs, arraysize(kRestoredURLs)));
2707 } 2707 }
2708 2708
2709 void HomepageIsNotNTP() { 2709 void HomepageIsNotNTP() {
2710 // Verifies that policy can set the startup pages to the homepage, when 2710 // Verifies that policy can set the startup pages to the homepage, when
2711 // the homepage is not the NTP. 2711 // the homepage is not the NTP.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2839 &RestoreOnStartupPolicyTest::NTP, 2839 &RestoreOnStartupPolicyTest::NTP,
2840 &RestoreOnStartupPolicyTest::Last)); 2840 &RestoreOnStartupPolicyTest::Last));
2841 2841
2842 // Similar to PolicyTest but sets a couple of policies before the browser is 2842 // Similar to PolicyTest but sets a couple of policies before the browser is
2843 // started. 2843 // started.
2844 class PolicyStatisticsCollectorTest : public PolicyTest { 2844 class PolicyStatisticsCollectorTest : public PolicyTest {
2845 public: 2845 public:
2846 PolicyStatisticsCollectorTest() {} 2846 PolicyStatisticsCollectorTest() {}
2847 virtual ~PolicyStatisticsCollectorTest() {} 2847 virtual ~PolicyStatisticsCollectorTest() {}
2848 2848
2849 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 2849 virtual void SetUpInProcessBrowserTestFixture() override {
2850 PolicyTest::SetUpInProcessBrowserTestFixture(); 2850 PolicyTest::SetUpInProcessBrowserTestFixture();
2851 PolicyMap policies; 2851 PolicyMap policies;
2852 policies.Set(key::kShowHomeButton, 2852 policies.Set(key::kShowHomeButton,
2853 POLICY_LEVEL_MANDATORY, 2853 POLICY_LEVEL_MANDATORY,
2854 POLICY_SCOPE_USER, 2854 POLICY_SCOPE_USER,
2855 new base::FundamentalValue(true), 2855 new base::FundamentalValue(true),
2856 NULL); 2856 NULL);
2857 policies.Set(key::kBookmarkBarEnabled, 2857 policies.Set(key::kBookmarkBarEnabled,
2858 POLICY_LEVEL_MANDATORY, 2858 POLICY_LEVEL_MANDATORY,
2859 POLICY_SCOPE_USER, 2859 POLICY_SCOPE_USER,
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
3129 3129
3130 INSTANTIATE_TEST_CASE_P(MediaStreamDevicesControllerBrowserTestInstance, 3130 INSTANTIATE_TEST_CASE_P(MediaStreamDevicesControllerBrowserTestInstance,
3131 MediaStreamDevicesControllerBrowserTest, 3131 MediaStreamDevicesControllerBrowserTest,
3132 testing::Bool()); 3132 testing::Bool());
3133 3133
3134 #if !defined(OS_CHROMEOS) 3134 #if !defined(OS_CHROMEOS)
3135 // Similar to PolicyTest but sets the proper policy before the browser is 3135 // Similar to PolicyTest but sets the proper policy before the browser is
3136 // started. 3136 // started.
3137 class PolicyVariationsServiceTest : public PolicyTest { 3137 class PolicyVariationsServiceTest : public PolicyTest {
3138 public: 3138 public:
3139 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 3139 virtual void SetUpInProcessBrowserTestFixture() override {
3140 PolicyTest::SetUpInProcessBrowserTestFixture(); 3140 PolicyTest::SetUpInProcessBrowserTestFixture();
3141 PolicyMap policies; 3141 PolicyMap policies;
3142 policies.Set(key::kVariationsRestrictParameter, 3142 policies.Set(key::kVariationsRestrictParameter,
3143 POLICY_LEVEL_MANDATORY, 3143 POLICY_LEVEL_MANDATORY,
3144 POLICY_SCOPE_USER, 3144 POLICY_SCOPE_USER,
3145 new base::StringValue("restricted"), 3145 new base::StringValue("restricted"),
3146 NULL); 3146 NULL);
3147 provider_.UpdateChromePolicy(policies); 3147 provider_.UpdateChromePolicy(policies);
3148 } 3148 }
3149 }; 3149 };
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3232 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 3232 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
3233 browser2->tab_strip_model()->GetActiveWebContents(), 3233 browser2->tab_strip_model()->GetActiveWebContents(),
3234 "domAutomationController.send(window.showModalDialog !== undefined);", 3234 "domAutomationController.send(window.showModalDialog !== undefined);",
3235 &result)); 3235 &result));
3236 EXPECT_TRUE(result); 3236 EXPECT_TRUE(result);
3237 } 3237 }
3238 3238
3239 #endif // !defined(CHROME_OS) 3239 #endif // !defined(CHROME_OS)
3240 3240
3241 } // namespace policy 3241 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/network_prediction_policy_handler.h ('k') | chrome/browser/policy/policy_prefs_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698