| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/extensions/browser_action_test_util.h" | 5 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 186 } |
| 187 | 187 |
| 188 void BrowserActionTestUtil::SetWidth(int width) { | 188 void BrowserActionTestUtil::SetWidth(int width) { |
| 189 BrowserActionsContainerView* containerView = | 189 BrowserActionsContainerView* containerView = |
| 190 [GetController(browser_, test_helper_.get()) containerView]; | 190 [GetController(browser_, test_helper_.get()) containerView]; |
| 191 NSRect frame = [containerView frame]; | 191 NSRect frame = [containerView frame]; |
| 192 frame.size.width = width; | 192 frame.size.width = width; |
| 193 [containerView setFrame:frame]; | 193 [containerView setFrame:frame]; |
| 194 } | 194 } |
| 195 | 195 |
| 196 bool BrowserActionTestUtil::IsHighlightingForSurfacingBubble() { |
| 197 BrowserActionsContainerView* containerView = |
| 198 [GetController(browser_, test_helper_.get()) containerView]; |
| 199 return [containerView trackingEnabled] && [containerView isHighlighting]; |
| 200 } |
| 201 |
| 196 ToolbarActionsBar* BrowserActionTestUtil::GetToolbarActionsBar() { | 202 ToolbarActionsBar* BrowserActionTestUtil::GetToolbarActionsBar() { |
| 197 return [GetController(browser_, test_helper_.get()) toolbarActionsBar]; | 203 return [GetController(browser_, test_helper_.get()) toolbarActionsBar]; |
| 198 } | 204 } |
| 199 | 205 |
| 200 scoped_ptr<BrowserActionTestUtil> BrowserActionTestUtil::CreateOverflowBar() { | 206 scoped_ptr<BrowserActionTestUtil> BrowserActionTestUtil::CreateOverflowBar() { |
| 201 CHECK(!GetToolbarActionsBar()->in_overflow_mode()) | 207 CHECK(!GetToolbarActionsBar()->in_overflow_mode()) |
| 202 << "Only a main bar can create an overflow bar!"; | 208 << "Only a main bar can create an overflow bar!"; |
| 203 return make_scoped_ptr(new BrowserActionTestUtil(browser_, this)); | 209 return make_scoped_ptr(new BrowserActionTestUtil(browser_, this)); |
| 204 } | 210 } |
| 205 | 211 |
| 206 // static | 212 // static |
| 207 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { | 213 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { |
| 208 return gfx::Size(NSSizeToCGSize([ExtensionPopupController minPopupSize])); | 214 return gfx::Size(NSSizeToCGSize([ExtensionPopupController minPopupSize])); |
| 209 } | 215 } |
| 210 | 216 |
| 211 // static | 217 // static |
| 212 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { | 218 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { |
| 213 return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize])); | 219 return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize])); |
| 214 } | 220 } |
| 215 | 221 |
| 216 BrowserActionTestUtil::BrowserActionTestUtil(Browser* browser, | 222 BrowserActionTestUtil::BrowserActionTestUtil(Browser* browser, |
| 217 BrowserActionTestUtil* main_bar) | 223 BrowserActionTestUtil* main_bar) |
| 218 : browser_(browser), | 224 : browser_(browser), |
| 219 test_helper_(new TestToolbarActionsBarHelperCocoa( | 225 test_helper_(new TestToolbarActionsBarHelperCocoa( |
| 220 browser_, GetController(browser_, main_bar->test_helper_.get()))) { | 226 browser_, GetController(browser_, main_bar->test_helper_.get()))) { |
| 221 } | 227 } |
| OLD | NEW |