1 // Copyright 2014 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_TOOLBAR_BROWSER_ACTIONS_BAR_BROWSERTEST_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_BROWSER_ACTIONS_BAR_BROWSERTEST_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/extensions/extension_browsertest.h"
12 #include "extensions/common/feature_switch.h"
14 namespace extensions
{
18 class BrowserActionTestUtil
;
19 class ToolbarActionsModel
;
21 // A platform-independent browser test class for the browser actions bar.
22 class BrowserActionsBarBrowserTest
: public ExtensionBrowserTest
{
24 BrowserActionsBarBrowserTest();
25 ~BrowserActionsBarBrowserTest() override
;
27 void SetUpCommandLine(base::CommandLine
* command_line
) override
;
28 void SetUpOnMainThread() override
;
29 void TearDownOnMainThread() override
;
31 BrowserActionTestUtil
* browser_actions_bar() {
32 return browser_actions_bar_
.get();
34 ToolbarActionsModel
* toolbar_model() { return toolbar_model_
; }
36 // Creates three different extensions, each with a browser action, and adds
37 // them to associated ExtensionService. These can then be accessed via
38 // extension_[a|b|c]().
39 void LoadExtensions();
41 const extensions::Extension
* extension_a() const {
42 return extension_a_
.get();
44 const extensions::Extension
* extension_b() const {
45 return extension_b_
.get();
47 const extensions::Extension
* extension_c() const {
48 return extension_c_
.get();
52 scoped_ptr
<BrowserActionTestUtil
> browser_actions_bar_
;
54 // The associated toolbar model, weak.
55 ToolbarActionsModel
* toolbar_model_
;
57 // Extensions with browser actions used for testing.
58 scoped_refptr
<const extensions::Extension
> extension_a_
;
59 scoped_refptr
<const extensions::Extension
> extension_b_
;
60 scoped_refptr
<const extensions::Extension
> extension_c_
;
62 DISALLOW_COPY_AND_ASSIGN(BrowserActionsBarBrowserTest
);
65 // A test with the extension-action-redesign switch enabled.
66 class BrowserActionsBarRedesignBrowserTest
67 : public BrowserActionsBarBrowserTest
{
69 BrowserActionsBarRedesignBrowserTest();
70 ~BrowserActionsBarRedesignBrowserTest() override
;
72 void SetUpCommandLine(base::CommandLine
* command_line
) override
;
75 // Enable the feature redesign switch.
76 scoped_ptr
<extensions::FeatureSwitch::ScopedOverride
> enable_redesign_
;
78 DISALLOW_COPY_AND_ASSIGN(BrowserActionsBarRedesignBrowserTest
);
81 #endif // CHROME_BROWSER_UI_TOOLBAR_BROWSER_ACTIONS_BAR_BROWSERTEST_H_