#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h"
#import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
+#import "chrome/browser/ui/cocoa/extensions/browser_action_button.h"
#import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
#import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
#import "chrome/browser/ui/cocoa/info_bubble_window.h"
browserActionsController];
}
-NSButton* GetButton(Browser* browser, int index) {
+BrowserActionButton* GetButton(Browser* browser, int index) {
return [GetController(browser) buttonWithIndex:index];
}
return [GetController(browser_) buttonCount];
}
-ExtensionAction* BrowserActionTestUtil::GetExtensionAction(int index) {
- NOTREACHED();
- return NULL;
+int BrowserActionTestUtil::VisibleBrowserActions() {
+ return [GetController(browser_) visibleButtonCount];
}
void BrowserActionTestUtil::InspectPopup(int index) {
[button performClick:nil];
}
+std::string BrowserActionTestUtil::GetExtensionId(int index) {
+ return [GetButton(browser_, index) viewController]->GetId();
+}
+
std::string BrowserActionTestUtil::GetTooltip(int index) {
NSString* tooltip = [GetButton(browser_, index) toolTip];
return base::SysNSStringToUTF8(tooltip);
return [ExtensionPopupController popup] != nil;
}
-gfx::Rect BrowserActionTestUtil::GetPopupBounds() {
+gfx::Size BrowserActionTestUtil::GetPopupSize() {
NSRect bounds = [[[ExtensionPopupController popup] view] bounds];
- return gfx::Rect(NSRectToCGRect(bounds));
+ return gfx::Size(NSSizeToCGSize(bounds.size));
}
bool BrowserActionTestUtil::HidePopup() {
return !HasPopup();
}
+// static
+void BrowserActionTestUtil::DisableAnimations() {
+}
+
+// static
+void BrowserActionTestUtil::EnableAnimations() {
+}
+
+// static
gfx::Size BrowserActionTestUtil::GetMinPopupSize() {
return gfx::Size(NSSizeToCGSize([ExtensionPopupController minPopupSize]));
}
+// static
gfx::Size BrowserActionTestUtil::GetMaxPopupSize() {
return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize]));
}