| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_BROWSERTEST_H_ | 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_BROWSERTEST_H_ |
| 6 #define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_BROWSERTEST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/ui/toolbar/browser_actions_bar_browsertest.h" | 11 #include "chrome/browser/ui/toolbar/browser_actions_bar_browsertest.h" |
| 12 | 12 |
| 13 namespace extensions { | 13 namespace extensions { |
| 14 class TestExtensionDir; | 14 class TestExtensionDir; |
| 15 } | 15 } |
| 16 | 16 |
| 17 class ToolbarActionsBarBubbleViews; |
| 18 |
| 17 class ExtensionMessageBubbleBrowserTest | 19 class ExtensionMessageBubbleBrowserTest |
| 18 : public BrowserActionsBarBrowserTest { | 20 : public BrowserActionsBarBrowserTest { |
| 19 protected: | 21 protected: |
| 20 enum AnchorPosition { | 22 enum AnchorPosition { |
| 21 ANCHOR_BROWSER_ACTION, | 23 ANCHOR_BROWSER_ACTION, |
| 22 ANCHOR_APP_MENU, | 24 ANCHOR_APP_MENU, |
| 23 }; | 25 }; |
| 24 | 26 |
| 25 ExtensionMessageBubbleBrowserTest(); | 27 ExtensionMessageBubbleBrowserTest(); |
| 26 ~ExtensionMessageBubbleBrowserTest() override; | 28 ~ExtensionMessageBubbleBrowserTest() override; |
| 27 | 29 |
| 30 // Returns the toolkit-views bubble that is currently attached to |browser|. |
| 31 // Returns null if there is no bubble showing. Implemented in platform files. |
| 32 static ToolbarActionsBarBubbleViews* GetViewsBubbleForBrowser( |
| 33 Browser* browser); |
| 34 |
| 35 // Returns the expected test anchor bounds on |browser| which may be a Cocoa |
| 36 // browser or a Views browser. Implemented in platform files. |
| 37 static gfx::Rect GetAnchorReferenceBoundsForBrowser(Browser* browser, |
| 38 AnchorPosition anchor); |
| 39 |
| 28 // BrowserActionsBarBrowserTest: | 40 // BrowserActionsBarBrowserTest: |
| 29 void SetUpCommandLine(base::CommandLine* command_line) override; | 41 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 30 void TearDownOnMainThread() override; | 42 void TearDownOnMainThread() override; |
| 31 | 43 |
| 32 // Checks the position of the bubble present in the given |browser|, when the | 44 // Checks the position of the bubble present in the given |browser|, when the |
| 33 // bubble should be anchored at the given |anchor| and that the toolbar model | 45 // bubble should be anchored at the given |anchor| and that the toolbar model |
| 34 // is correctly highlighting. | 46 // is correctly highlighting. |
| 35 void CheckBubble(Browser* browser, | 47 void CheckBubble(Browser* browser, |
| 36 AnchorPosition anchor, | 48 AnchorPosition anchor, |
| 37 bool should_be_highlighting); | 49 bool should_be_highlighting); |
| 38 // Performs the platform-specific checks. | 50 // Performs the platform-specific checks. |
| 39 virtual void CheckBubbleNative(Browser* browser, AnchorPosition anchor) = 0; | 51 virtual void CheckBubbleNative(Browser* browser, AnchorPosition anchor) = 0; |
| 40 | 52 |
| 41 // Closes the bubble present in the given |browser|. | 53 // Closes the bubble present in the given |browser|. |
| 42 void CloseBubble(Browser* browser); | 54 virtual void CloseBubble(Browser* browser); |
| 43 // Performs the platform-specific close. | 55 // Performs the platform-specific close. |
| 44 virtual void CloseBubbleNative(Browser* browser) = 0; | 56 virtual void CloseBubbleNative(Browser* browser) = 0; |
| 45 | 57 |
| 46 // Checks that there is no active bubble for the given |browser|. | 58 // Checks that there is no active bubble for the given |browser|. |
| 47 // We specify whether or not the toolbar model should be highlighting or there | 59 // We specify whether or not the toolbar model should be highlighting or there |
| 48 // is a bubble active since another browser window may have an active bubble. | 60 // is a bubble active since another browser window may have an active bubble. |
| 49 void CheckBubbleIsNotPresent(Browser* browser, | 61 void CheckBubbleIsNotPresent(Browser* browser, |
| 50 bool should_profile_have_bubble, | 62 bool should_profile_have_bubble, |
| 51 bool should_be_highlighting); | 63 bool should_be_highlighting); |
| 52 // Performs the platform-specific checks. | 64 // Performs the platform-specific checks. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 dev_mode_bubble_override_; | 145 dev_mode_bubble_override_; |
| 134 | 146 |
| 135 // The backing directory for a custom extension loaded during a test. Null if | 147 // The backing directory for a custom extension loaded during a test. Null if |
| 136 // no custom extension is loaded. | 148 // no custom extension is loaded. |
| 137 std::unique_ptr<extensions::TestExtensionDir> custom_extension_dir_; | 149 std::unique_ptr<extensions::TestExtensionDir> custom_extension_dir_; |
| 138 | 150 |
| 139 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleBrowserTest); | 151 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleBrowserTest); |
| 140 }; | 152 }; |
| 141 | 153 |
| 142 #endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_BROWSERTEST_H_ | 154 #endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_BROWSERTEST_H_ |
| OLD | NEW |