| 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 #include "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "chrome/browser/ui/browser_window.h" | 6 #include "chrome/browser/ui/browser_window.h" |
| 7 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 7 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 8 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" | 8 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" |
| 9 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" | 9 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" |
| 10 #import "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.h" | 10 #import "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } // namespace | 67 } // namespace |
| 68 | 68 |
| 69 class ExtensionMessageBubbleBrowserTestMac | 69 class ExtensionMessageBubbleBrowserTestMac |
| 70 : public ExtensionMessageBubbleBrowserTest { | 70 : public ExtensionMessageBubbleBrowserTest { |
| 71 public: | 71 public: |
| 72 ExtensionMessageBubbleBrowserTestMac() {} | 72 ExtensionMessageBubbleBrowserTestMac() {} |
| 73 ~ExtensionMessageBubbleBrowserTestMac() override {} | 73 ~ExtensionMessageBubbleBrowserTestMac() override {} |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 void SetUpCommandLine(base::CommandLine* command_line) override; | 76 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 77 void CheckBubble(Browser* browser, AnchorPosition anchor) override; | 77 void CheckBubbleNative(Browser* browser, AnchorPosition anchor) override; |
| 78 void CloseBubble(Browser* browser) override; | 78 void CloseBubbleNative(Browser* browser) override; |
| 79 void CheckBubbleIsNotPresent(Browser* browser) override; | 79 void CheckBubbleIsNotPresentNative(Browser* browser) override; |
| 80 | 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleBrowserTestMac); | 81 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleBrowserTestMac); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 void ExtensionMessageBubbleBrowserTestMac::SetUpCommandLine( | 84 void ExtensionMessageBubbleBrowserTestMac::SetUpCommandLine( |
| 85 base::CommandLine* command_line) { | 85 base::CommandLine* command_line) { |
| 86 ExtensionMessageBubbleBrowserTest::SetUpCommandLine(command_line); | 86 ExtensionMessageBubbleBrowserTest::SetUpCommandLine(command_line); |
| 87 [ToolbarActionsBarBubbleMac setAnimationEnabledForTesting:NO]; | 87 [ToolbarActionsBarBubbleMac setAnimationEnabledForTesting:NO]; |
| 88 } | 88 } |
| 89 | 89 |
| 90 void ExtensionMessageBubbleBrowserTestMac::CheckBubble( | 90 void ExtensionMessageBubbleBrowserTestMac::CheckBubbleNative( |
| 91 Browser* browser, | 91 Browser* browser, |
| 92 AnchorPosition anchor) { | 92 AnchorPosition anchor) { |
| 93 ToolbarController* toolbarController = ToolbarControllerForBrowser(browser); | 93 ToolbarController* toolbarController = ToolbarControllerForBrowser(browser); |
| 94 BrowserActionsController* actionsController = | 94 BrowserActionsController* actionsController = |
| 95 [toolbarController browserActionsController]; | 95 [toolbarController browserActionsController]; |
| 96 NSView* anchorView = nil; | 96 NSView* anchorView = nil; |
| 97 ToolbarActionsBarBubbleMac* bubble = [actionsController activeBubble]; | 97 ToolbarActionsBarBubbleMac* bubble = [actionsController activeBubble]; |
| 98 switch (anchor) { | 98 switch (anchor) { |
| 99 case ANCHOR_BROWSER_ACTION: | 99 case ANCHOR_BROWSER_ACTION: |
| 100 anchorView = [actionsController buttonWithIndex:0]; | 100 anchorView = [actionsController buttonWithIndex:0]; |
| 101 break; | 101 break; |
| 102 case ANCHOR_APP_MENU: | 102 case ANCHOR_APP_MENU: |
| 103 anchorView = [toolbarController appMenuButton]; | 103 anchorView = [toolbarController appMenuButton]; |
| 104 break; | 104 break; |
| 105 } | 105 } |
| 106 CheckBubbleAndReferenceView(bubble, anchorView); | 106 CheckBubbleAndReferenceView(bubble, anchorView); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void ExtensionMessageBubbleBrowserTestMac::CloseBubble(Browser* browser) { | 109 void ExtensionMessageBubbleBrowserTestMac::CloseBubbleNative(Browser* browser) { |
| 110 BrowserActionsController* controller = | 110 BrowserActionsController* controller = |
| 111 [ToolbarControllerForBrowser(browser) browserActionsController]; | 111 [ToolbarControllerForBrowser(browser) browserActionsController]; |
| 112 ToolbarActionsBarBubbleMac* bubble = [controller activeBubble]; | 112 ToolbarActionsBarBubbleMac* bubble = [controller activeBubble]; |
| 113 ASSERT_TRUE(bubble); | 113 ASSERT_TRUE(bubble); |
| 114 [bubble close]; | 114 [bubble close]; |
| 115 EXPECT_EQ(nil, [controller activeBubble]); | 115 EXPECT_EQ(nil, [controller activeBubble]); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void ExtensionMessageBubbleBrowserTestMac::CheckBubbleIsNotPresent( | 118 void ExtensionMessageBubbleBrowserTestMac::CheckBubbleIsNotPresentNative( |
| 119 Browser* browser) { | 119 Browser* browser) { |
| 120 EXPECT_EQ( | 120 EXPECT_EQ( |
| 121 nil, | 121 nil, |
| 122 [[ToolbarControllerForBrowser(browser) browserActionsController] | 122 [[ToolbarControllerForBrowser(browser) browserActionsController] |
| 123 activeBubble]); | 123 activeBubble]); |
| 124 } | 124 } |
| 125 | 125 |
| 126 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleBrowserTestMac, | 126 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleBrowserTestMac, |
| 127 ExtensionBubbleAnchoredToExtensionAction) { | 127 ExtensionBubbleAnchoredToExtensionAction) { |
| 128 TestBubbleAnchoredToExtensionAction(); | 128 TestBubbleAnchoredToExtensionAction(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 150 | 150 |
| 151 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleBrowserTestMac, | 151 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleBrowserTestMac, |
| 152 TestUninstallDangerousExtension) { | 152 TestUninstallDangerousExtension) { |
| 153 TestUninstallDangerousExtension(); | 153 TestUninstallDangerousExtension(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleBrowserTestMac, | 156 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleBrowserTestMac, |
| 157 TestDevModeBubbleIsntShownTwice) { | 157 TestDevModeBubbleIsntShownTwice) { |
| 158 TestDevModeBubbleIsntShownTwice(); | 158 TestDevModeBubbleIsntShownTwice(); |
| 159 } | 159 } |
| 160 |
| 161 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleBrowserTestMac, |
| 162 TestBubbleWithMultipleWindows) { |
| 163 TestBubbleWithMultipleWindows(); |
| 164 } |
| OLD | NEW |