Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: chrome/browser/extensions/browser_action_test_util_mac.mm

Issue 506069: [Mac] Port browser action popup test to mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "browser_action_test_util.h" 5 #include "browser_action_test_util.h"
6 6
7 #include "base/gfx/rect.h"
8 #include "base/gfx/size.h"
7 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
8 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
9 #import "chrome/browser/cocoa/browser_window_cocoa.h" 11 #import "chrome/browser/cocoa/browser_window_cocoa.h"
10 #import "chrome/browser/cocoa/browser_window_controller.h" 12 #import "chrome/browser/cocoa/browser_window_controller.h"
11 #import "chrome/browser/cocoa/extensions/browser_actions_controller.h" 13 #import "chrome/browser/cocoa/extensions/browser_actions_controller.h"
14 #import "chrome/browser/cocoa/extensions/extension_popup_controller.h"
12 #import "chrome/browser/cocoa/toolbar_controller.h" 15 #import "chrome/browser/cocoa/toolbar_controller.h"
13 16
14 namespace { 17 namespace {
15 18
16 BrowserActionsController* GetController(Browser* browser) { 19 BrowserActionsController* GetController(Browser* browser) {
17 BrowserWindowCocoa* window = 20 BrowserWindowCocoa* window =
18 static_cast<BrowserWindowCocoa*>(browser->window()); 21 static_cast<BrowserWindowCocoa*>(browser->window());
19 22
20 return [[window->cocoa_controller() toolbarController] 23 return [[window->cocoa_controller() toolbarController]
21 browserActionsController]; 24 browserActionsController];
(...skipping 15 matching lines...) Expand all
37 40
38 void BrowserActionTestUtil::Press(int index) { 41 void BrowserActionTestUtil::Press(int index) {
39 NSButton* button = GetButton(browser_, index); 42 NSButton* button = GetButton(browser_, index);
40 [button performClick:nil]; 43 [button performClick:nil];
41 } 44 }
42 45
43 std::string BrowserActionTestUtil::GetTooltip(int index) { 46 std::string BrowserActionTestUtil::GetTooltip(int index) {
44 NSString* tooltip = [GetButton(browser_, index) toolTip]; 47 NSString* tooltip = [GetButton(browser_, index) toolTip];
45 return base::SysNSStringToUTF8(tooltip); 48 return base::SysNSStringToUTF8(tooltip);
46 } 49 }
50
51 bool BrowserActionTestUtil::HasPopup() {
52 return [GetController(browser_) popup] != nil;
53 }
54
55 gfx::Rect BrowserActionTestUtil::GetPopupBounds() {
56 NSRect bounds = [[[GetController(browser_) popup] view] bounds];
57 return gfx::Rect(NSRectToCGRect(bounds));
58 }
59
60 bool BrowserActionTestUtil::HidePopup() {
61 [GetController(browser_) hidePopup];
62 return !HasPopup();
63 }
64
65 gfx::Size BrowserActionTestUtil::GetMinPopupSize() {
66 return gfx::Size(NSSizeToCGSize([ExtensionPopupController minPopupSize]));
67 }
68
69 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() {
70 return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize]));
71 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/browser_action_test_util.h ('k') | chrome/browser/extensions/browser_action_test_util_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698