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

Unified Diff: chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm

Issue 2908983002: [reland] Bring up BrowserActionInteractiveTest on Mac. (Closed)
Patch Set: respond to comments Created 3 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm
diff --git a/chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm b/chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm
index 2c97e95fe4cb50742c4f4242b696443afe43b8dc..ca7928264f5f2389c7e5a9ca6792af6d355b68af 100644
--- a/chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm
+++ b/chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm
@@ -26,6 +26,7 @@
#include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h"
#include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
#include "chrome/common/chrome_constants.h"
+#import "ui/base/test/windowed_nsnotification_observer.h"
#include "ui/base/theme_provider.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -158,6 +159,23 @@ gfx::NativeView BrowserActionTestUtil::GetPopupNativeView() {
return popup_owner ? popup_owner->GetPopupNativeView() : nil;
}
+bool BrowserActionTestUtil::WaitForPopup() {
+ NSWindow* window = [GetPopupNativeView() window];
+ if (!window)
+ return false;
+
+ if ([window isKeyWindow])
+ return true;
+
+ base::scoped_nsobject<WindowedNSNotificationObserver> waiter(
+ [[WindowedNSNotificationObserver alloc]
+ initForNotification:NSWindowDidBecomeKeyNotification
+ object:window]);
+
+ BOOL notification_observed = [waiter wait];
+ return notification_observed && [window isKeyWindow];
+}
+
bool BrowserActionTestUtil::HasPopup() {
return GetPopupNativeView() != nil;
}
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698