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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_
6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_
8 #include "chrome/browser/extensions/extension_test_notification_observer.h"
9 #include "chrome/common/extensions/features/feature_channel.h"
10 #include "chrome/test/base/web_ui_browser_test.h"
11 #include "extensions/browser/test_management_policy.h"
12 #include "extensions/common/extension.h"
13 #include "extensions/common/feature_switch.h"
17 // C++ test fixture used by extension_settings_browsertest.js.
18 class ExtensionSettingsUIBrowserTest
: public WebUIBrowserTest
{
20 ExtensionSettingsUIBrowserTest();
21 ~ExtensionSettingsUIBrowserTest() override
;
24 // Get the profile to use.
25 Profile
* GetProfile();
27 const std::string
& last_loaded_extension_id() {
28 return observer_
->last_loaded_extension_id();
31 void SetUpOnMainThread() override
;
33 void InstallGoodExtension();
35 void InstallErrorsExtension();
37 void InstallSharedModule();
39 void InstallPackagedApp();
41 void AddManagedPolicyProvider();
43 void SetAutoConfirmUninstall();
45 // Enables the error console so errors are displayed in the extensions page.
46 void EnableErrorConsole();
49 bool WaitForExtensionViewsToLoad();
50 const extensions::Extension
* InstallUnpackedExtension(
51 const base::FilePath
& path
);
52 const extensions::Extension
* InstallExtension(const base::FilePath
& path
);
54 scoped_ptr
<ExtensionTestNotificationObserver
> observer_
;
56 // The default profile to be used.
59 // Used to simulate managed extensions (by being registered as a provider).
60 extensions::TestManagementPolicyProvider policy_provider_
;
62 base::FilePath test_data_dir_
;
64 // Used to enable the error console.
65 scoped_ptr
<extensions::FeatureSwitch::ScopedOverride
> error_console_override_
;
67 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsUIBrowserTest
);
70 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_