| 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 "base/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 return | 150 return |
| 151 [GetButton(browser_, test_helper_.get(), index) viewController]->GetId(); | 151 [GetButton(browser_, test_helper_.get(), index) viewController]->GetId(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 std::string BrowserActionTestUtil::GetTooltip(int index) { | 154 std::string BrowserActionTestUtil::GetTooltip(int index) { |
| 155 NSString* tooltip = [GetButton(browser_, test_helper_.get(), index) toolTip]; | 155 NSString* tooltip = [GetButton(browser_, test_helper_.get(), index) toolTip]; |
| 156 return base::SysNSStringToUTF8(tooltip); | 156 return base::SysNSStringToUTF8(tooltip); |
| 157 } | 157 } |
| 158 | 158 |
| 159 gfx::NativeView BrowserActionTestUtil::GetPopupNativeView() { | 159 gfx::NativeView BrowserActionTestUtil::GetPopupNativeView() { |
| 160 return [[ExtensionPopupController popup] view]; | 160 ToolbarActionViewController* popup_owner = |
| 161 GetToolbarActionsBar()->popup_owner(); |
| 162 return popup_owner ? popup_owner->GetPopupNativeView() : nullptr; |
| 161 } | 163 } |
| 162 | 164 |
| 163 bool BrowserActionTestUtil::HasPopup() { | 165 bool BrowserActionTestUtil::HasPopup() { |
| 164 return [ExtensionPopupController popup] != nil; | 166 return GetPopupNativeView() != nullptr; |
| 165 } | 167 } |
| 166 | 168 |
| 167 gfx::Size BrowserActionTestUtil::GetPopupSize() { | 169 gfx::Size BrowserActionTestUtil::GetPopupSize() { |
| 168 NSRect bounds = [[[ExtensionPopupController popup] view] bounds]; | 170 NSRect bounds = [[[ExtensionPopupController popup] view] bounds]; |
| 169 return gfx::Size(NSSizeToCGSize(bounds.size)); | 171 return gfx::Size(NSSizeToCGSize(bounds.size)); |
| 170 } | 172 } |
| 171 | 173 |
| 172 bool BrowserActionTestUtil::HidePopup() { | 174 bool BrowserActionTestUtil::HidePopup() { |
| 173 ExtensionPopupController* controller = [ExtensionPopupController popup]; | 175 ExtensionPopupController* controller = [ExtensionPopupController popup]; |
| 174 // The window must be gone or we'll fail a unit test with windows left open. | 176 // The window must be gone or we'll fail a unit test with windows left open. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { | 225 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { |
| 224 return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize])); | 226 return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize])); |
| 225 } | 227 } |
| 226 | 228 |
| 227 BrowserActionTestUtil::BrowserActionTestUtil(Browser* browser, | 229 BrowserActionTestUtil::BrowserActionTestUtil(Browser* browser, |
| 228 BrowserActionTestUtil* main_bar) | 230 BrowserActionTestUtil* main_bar) |
| 229 : browser_(browser), | 231 : browser_(browser), |
| 230 test_helper_(new TestToolbarActionsBarHelperCocoa( | 232 test_helper_(new TestToolbarActionsBarHelperCocoa( |
| 231 browser_, GetController(browser_, main_bar->test_helper_.get()))) { | 233 browser_, GetController(browser_, main_bar->test_helper_.get()))) { |
| 232 } | 234 } |
| OLD | NEW |