| Index: chrome/test/base/interactive_test_utils_cocoa.mm
|
| diff --git a/chrome/test/base/interactive_test_utils_cocoa.mm b/chrome/test/base/interactive_test_utils_cocoa.mm
|
| index ee4e8c2da936b9515062ee4fa10c43511e27d684..df4de1af0f5cc1fc7409f9c79aa62cbe44c92708 100644
|
| --- a/chrome/test/base/interactive_test_utils_cocoa.mm
|
| +++ b/chrome/test/base/interactive_test_utils_cocoa.mm
|
| @@ -13,6 +13,7 @@
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/browser_window.h"
|
| #import "chrome/browser/ui/cocoa/view_id_util.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| #include "ui/base/cocoa/cocoa_base_utils.h"
|
|
|
| namespace ui_test_utils {
|
| @@ -75,6 +76,12 @@ bool IsViewFocused(const Browser* browser, ViewID vid) {
|
| void ClickOnView(const Browser* browser, ViewID vid) {
|
| NSWindow* window = browser->window()->GetNativeWindow();
|
| DCHECK(window);
|
| + // Fail tests that use ClickOnView() on an inactive window. Tests that do will
|
| + // flake too easily. There seems to be no guarantee that the WindowServer will
|
| + // send the event to the window, or activate it. It isn't enough just to wait
|
| + // for NSWindowDidBecomeKeyNotification after this method.
|
| + EXPECT_TRUE([window isKeyWindow])
|
| + << "ClickOnView() in an inactive window is not robust.";
|
| NSView* view = view_id_util::GetView(window, vid);
|
| DCHECK(view);
|
| MoveMouseToNSViewCenterAndPress(
|
|
|