| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/files/file_path.h" |
| 8 #include "base/macros.h" | 11 #include "base/macros.h" |
| 9 #include "chrome/browser/extensions/chrome_extension_test_notification_observer.
h" | |
| 10 #include "chrome/test/base/web_ui_browser_test.h" | 12 #include "chrome/test/base/web_ui_browser_test.h" |
| 11 #include "extensions/browser/extension_dialog_auto_confirm.h" | |
| 12 #include "extensions/browser/test_management_policy.h" | 13 #include "extensions/browser/test_management_policy.h" |
| 13 #include "extensions/common/extension.h" | |
| 14 #include "extensions/common/feature_switch.h" | 14 #include "extensions/common/feature_switch.h" |
| 15 #include "extensions/common/features/feature_channel.h" | |
| 16 | 15 |
| 17 class Profile; | 16 namespace extensions { |
| 17 class Extension; |
| 18 class ScopedTestDialogAutoConfirm; |
| 19 } |
| 18 | 20 |
| 19 // C++ test fixture used by extension_settings_browsertest.js. | 21 // C++ test fixture used by extension_settings_browsertest.js. |
| 20 class ExtensionSettingsUIBrowserTest : public WebUIBrowserTest { | 22 class ExtensionSettingsUIBrowserTest : public WebUIBrowserTest { |
| 21 public: | 23 public: |
| 22 ExtensionSettingsUIBrowserTest(); | 24 ExtensionSettingsUIBrowserTest(); |
| 23 ~ExtensionSettingsUIBrowserTest() override; | 25 ~ExtensionSettingsUIBrowserTest() override; |
| 24 | 26 |
| 25 protected: | 27 protected: |
| 26 // Get the profile to use. | |
| 27 Profile* GetProfile(); | |
| 28 | |
| 29 const std::string& last_loaded_extension_id() { | |
| 30 return observer_->last_loaded_extension_id(); | |
| 31 } | |
| 32 | |
| 33 void SetUpOnMainThread() override; | |
| 34 | |
| 35 void InstallGoodExtension(); | 28 void InstallGoodExtension(); |
| 36 | 29 |
| 37 void InstallErrorsExtension(); | 30 void InstallErrorsExtension(); |
| 38 | 31 |
| 39 void InstallSharedModule(); | 32 void InstallSharedModule(); |
| 40 | 33 |
| 41 void InstallPackagedApp(); | 34 void InstallPackagedApp(); |
| 42 | 35 |
| 43 void InstallHostedApp(); | 36 void InstallHostedApp(); |
| 44 | 37 |
| 45 void InstallPlatformApp(); | 38 void InstallPlatformApp(); |
| 46 | 39 |
| 47 void AddManagedPolicyProvider(); | 40 void AddManagedPolicyProvider(); |
| 48 | 41 |
| 49 void SetAutoConfirmUninstall(); | 42 void SetAutoConfirmUninstall(); |
| 50 | 43 |
| 51 // Enables the error console so errors are displayed in the extensions page. | 44 // Enables the error console so errors are displayed in the extensions page. |
| 52 void EnableErrorConsole(); | 45 void EnableErrorConsole(); |
| 53 | 46 |
| 54 // Shrinks the web contents view in order to ensure vertical overflow. | 47 // Shrinks the web contents view in order to ensure vertical overflow. |
| 55 void ShrinkWebContentsView(); | 48 void ShrinkWebContentsView(); |
| 56 | 49 |
| 57 private: | 50 private: |
| 58 bool WaitForExtensionViewsToLoad(); | |
| 59 const extensions::Extension* InstallUnpackedExtension( | |
| 60 const base::FilePath& path); | |
| 61 const extensions::Extension* InstallExtension(const base::FilePath& path); | 51 const extensions::Extension* InstallExtension(const base::FilePath& path); |
| 62 | 52 |
| 63 std::unique_ptr<extensions::ChromeExtensionTestNotificationObserver> | |
| 64 observer_; | |
| 65 | |
| 66 // The default profile to be used. | |
| 67 Profile* profile_; | |
| 68 | |
| 69 // Used to simulate managed extensions (by being registered as a provider). | 53 // Used to simulate managed extensions (by being registered as a provider). |
| 70 extensions::TestManagementPolicyProvider policy_provider_; | 54 extensions::TestManagementPolicyProvider policy_provider_; |
| 71 | 55 |
| 72 base::FilePath test_data_dir_; | 56 base::FilePath test_data_dir_; |
| 73 | 57 |
| 74 // Used to enable the error console. | 58 // Used to enable the error console. |
| 75 std::unique_ptr<extensions::FeatureSwitch::ScopedOverride> | 59 std::unique_ptr<extensions::FeatureSwitch::ScopedOverride> |
| 76 error_console_override_; | 60 error_console_override_; |
| 77 | 61 |
| 78 std::unique_ptr<extensions::ScopedTestDialogAutoConfirm> | 62 std::unique_ptr<extensions::ScopedTestDialogAutoConfirm> |
| 79 uninstall_auto_confirm_; | 63 uninstall_auto_confirm_; |
| 80 | 64 |
| 81 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsUIBrowserTest); | 65 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsUIBrowserTest); |
| 82 }; | 66 }; |
| 83 | 67 |
| 84 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_ | 68 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_ |
| OLD | NEW |