Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / webui / extensions / extension_settings_browsertest.h
blob71ee675b5407bd71601aff951ca1983ac2581176
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/extension_dialog_auto_confirm.h"
12 #include "extensions/browser/test_management_policy.h"
13 #include "extensions/common/extension.h"
14 #include "extensions/common/feature_switch.h"
16 class Profile;
18 // C++ test fixture used by extension_settings_browsertest.js.
19 class ExtensionSettingsUIBrowserTest : public WebUIBrowserTest {
20 public:
21 ExtensionSettingsUIBrowserTest();
22 ~ExtensionSettingsUIBrowserTest() override;
24 protected:
25 // Get the profile to use.
26 Profile* GetProfile();
28 const std::string& last_loaded_extension_id() {
29 return observer_->last_loaded_extension_id();
32 void SetUpOnMainThread() override;
34 void InstallGoodExtension();
36 void InstallErrorsExtension();
38 void InstallSharedModule();
40 void InstallPackagedApp();
42 void AddManagedPolicyProvider();
44 void SetAutoConfirmUninstall();
46 // Enables the error console so errors are displayed in the extensions page.
47 void EnableErrorConsole();
49 // Shrinks the web contents view in order to ensure vertical overflow.
50 void ShrinkWebContentsView();
52 private:
53 bool WaitForExtensionViewsToLoad();
54 const extensions::Extension* InstallUnpackedExtension(
55 const base::FilePath& path);
56 const extensions::Extension* InstallExtension(const base::FilePath& path);
58 scoped_ptr<ExtensionTestNotificationObserver> observer_;
60 // The default profile to be used.
61 Profile* profile_;
63 // Used to simulate managed extensions (by being registered as a provider).
64 extensions::TestManagementPolicyProvider policy_provider_;
66 base::FilePath test_data_dir_;
68 // Used to enable the error console.
69 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> error_console_override_;
71 scoped_ptr<extensions::ScopedTestDialogAutoConfirm> uninstall_auto_confirm_;
73 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsUIBrowserTest);
76 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_