OLD | NEW |
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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 message_loop_runner_->Quit(); | 551 message_loop_runner_->Quit(); |
552 } | 552 } |
553 | 553 |
554 #if !defined(OS_MACOSX) | 554 #if !defined(OS_MACOSX) |
555 | 555 |
556 // Observer used to wait for the creation of a new app window. | 556 // Observer used to wait for the creation of a new app window. |
557 class TestAddAppWindowObserver | 557 class TestAddAppWindowObserver |
558 : public extensions::AppWindowRegistry::Observer { | 558 : public extensions::AppWindowRegistry::Observer { |
559 public: | 559 public: |
560 explicit TestAddAppWindowObserver(extensions::AppWindowRegistry* registry); | 560 explicit TestAddAppWindowObserver(extensions::AppWindowRegistry* registry); |
561 virtual ~TestAddAppWindowObserver(); | 561 ~TestAddAppWindowObserver() override; |
562 | 562 |
563 // extensions::AppWindowRegistry::Observer: | 563 // extensions::AppWindowRegistry::Observer: |
564 virtual void OnAppWindowAdded(extensions::AppWindow* app_window) override; | 564 void OnAppWindowAdded(extensions::AppWindow* app_window) override; |
565 | 565 |
566 extensions::AppWindow* WaitForAppWindow(); | 566 extensions::AppWindow* WaitForAppWindow(); |
567 | 567 |
568 private: | 568 private: |
569 extensions::AppWindowRegistry* registry_; // Not owned. | 569 extensions::AppWindowRegistry* registry_; // Not owned. |
570 extensions::AppWindow* window_; // Not owned. | 570 extensions::AppWindow* window_; // Not owned. |
571 base::RunLoop run_loop_; | 571 base::RunLoop run_loop_; |
572 | 572 |
573 DISALLOW_COPY_AND_ASSIGN(TestAddAppWindowObserver); | 573 DISALLOW_COPY_AND_ASSIGN(TestAddAppWindowObserver); |
574 }; | 574 }; |
(...skipping 19 matching lines...) Expand all Loading... |
594 return window_; | 594 return window_; |
595 } | 595 } |
596 | 596 |
597 #endif | 597 #endif |
598 | 598 |
599 } // namespace | 599 } // namespace |
600 | 600 |
601 class PolicyTest : public InProcessBrowserTest { | 601 class PolicyTest : public InProcessBrowserTest { |
602 protected: | 602 protected: |
603 PolicyTest() {} | 603 PolicyTest() {} |
604 virtual ~PolicyTest() {} | 604 ~PolicyTest() override {} |
605 | 605 |
606 virtual void SetUp() override { | 606 void SetUp() override { |
607 test_extension_cache_.reset(new extensions::ExtensionCacheFake()); | 607 test_extension_cache_.reset(new extensions::ExtensionCacheFake()); |
608 InProcessBrowserTest::SetUp(); | 608 InProcessBrowserTest::SetUp(); |
609 } | 609 } |
610 | 610 |
611 void SetUpInProcessBrowserTestFixture() override { | 611 void SetUpInProcessBrowserTestFixture() override { |
612 CommandLine::ForCurrentProcess()->AppendSwitch("noerrdialogs"); | 612 CommandLine::ForCurrentProcess()->AppendSwitch("noerrdialogs"); |
613 EXPECT_CALL(provider_, IsInitializationComplete(_)) | 613 EXPECT_CALL(provider_, IsInitializationComplete(_)) |
614 .WillRepeatedly(Return(true)); | 614 .WillRepeatedly(Return(true)); |
615 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | 615 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
616 } | 616 } |
(...skipping 2414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3031 &RestoreOnStartupPolicyTest::HomepageIsNTP, | 3031 &RestoreOnStartupPolicyTest::HomepageIsNTP, |
3032 &RestoreOnStartupPolicyTest::ListOfURLs, | 3032 &RestoreOnStartupPolicyTest::ListOfURLs, |
3033 &RestoreOnStartupPolicyTest::NTP, | 3033 &RestoreOnStartupPolicyTest::NTP, |
3034 &RestoreOnStartupPolicyTest::Last)); | 3034 &RestoreOnStartupPolicyTest::Last)); |
3035 | 3035 |
3036 // Similar to PolicyTest but sets a couple of policies before the browser is | 3036 // Similar to PolicyTest but sets a couple of policies before the browser is |
3037 // started. | 3037 // started. |
3038 class PolicyStatisticsCollectorTest : public PolicyTest { | 3038 class PolicyStatisticsCollectorTest : public PolicyTest { |
3039 public: | 3039 public: |
3040 PolicyStatisticsCollectorTest() {} | 3040 PolicyStatisticsCollectorTest() {} |
3041 virtual ~PolicyStatisticsCollectorTest() {} | 3041 ~PolicyStatisticsCollectorTest() override {} |
3042 | 3042 |
3043 void SetUpInProcessBrowserTestFixture() override { | 3043 void SetUpInProcessBrowserTestFixture() override { |
3044 PolicyTest::SetUpInProcessBrowserTestFixture(); | 3044 PolicyTest::SetUpInProcessBrowserTestFixture(); |
3045 PolicyMap policies; | 3045 PolicyMap policies; |
3046 policies.Set(key::kShowHomeButton, | 3046 policies.Set(key::kShowHomeButton, |
3047 POLICY_LEVEL_MANDATORY, | 3047 POLICY_LEVEL_MANDATORY, |
3048 POLICY_SCOPE_USER, | 3048 POLICY_SCOPE_USER, |
3049 new base::FundamentalValue(true), | 3049 new base::FundamentalValue(true), |
3050 NULL); | 3050 NULL); |
3051 policies.Set(key::kBookmarkBarEnabled, | 3051 policies.Set(key::kBookmarkBarEnabled, |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3426 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 3426 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
3427 browser2->tab_strip_model()->GetActiveWebContents(), | 3427 browser2->tab_strip_model()->GetActiveWebContents(), |
3428 "domAutomationController.send(window.showModalDialog !== undefined);", | 3428 "domAutomationController.send(window.showModalDialog !== undefined);", |
3429 &result)); | 3429 &result)); |
3430 EXPECT_TRUE(result); | 3430 EXPECT_TRUE(result); |
3431 } | 3431 } |
3432 | 3432 |
3433 #endif // !defined(CHROME_OS) | 3433 #endif // !defined(CHROME_OS) |
3434 | 3434 |
3435 } // namespace policy | 3435 } // namespace policy |
OLD | NEW |