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