Commit aa553244 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

mac: disable GlobalCommandsApiTest GlobalCommand on 10.14

As of 10.14, the API that SendGlobalKeyEventsAndWait() uses to post global
events causes a user prompt to appear, which is an obvious non-starter in test
scenarios, so disable that test for now, and add a DCHECK in
SendGlobalKeyEventsAndWait() to ensure that it is not called on 10.14.

Bug: 892177,904403
Change-Id: Ida0429d7e9914942f354690ecb657803240756ae
Reviewed-on: https://chromium-review.googlesource.com/c/1331135Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607325}
parent d8954b63
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include "base/mac/mac_util.h"
#endif #endif
namespace extensions { namespace extensions {
...@@ -141,6 +142,11 @@ IN_PROC_BROWSER_TEST_F(GlobalCommandsApiTest, MAYBE_GlobalCommand) { ...@@ -141,6 +142,11 @@ IN_PROC_BROWSER_TEST_F(GlobalCommandsApiTest, MAYBE_GlobalCommand) {
host->AddObserver(&observer); host->AddObserver(&observer);
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
// ui_test_utils::SendGlobalKeyEventsAndWait() hangs the test on macOS 10.14 -
// https://crbug.com/904403
if (base::mac::IsAtLeastOS10_14())
return;
// Create an incognito browser to capture the focus. // Create an incognito browser to capture the focus.
Browser* incognito_browser = CreateIncognitoBrowser(); Browser* incognito_browser = CreateIncognitoBrowser();
// Activate Chrome.app so that events are seen on [NSApplication sendEvent:]. // Activate Chrome.app so that events are seen on [NSApplication sendEvent:].
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_cftyperef.h"
#include "base/mac/scoped_objc_class_swizzler.h" #include "base/mac/scoped_objc_class_swizzler.h"
#include "base/run_loop.h" #include "base/run_loop.h"
...@@ -137,6 +138,12 @@ void SendGlobalKeyEventsHelper::SendGlobalKeyEvent(int key_code, ...@@ -137,6 +138,12 @@ void SendGlobalKeyEventsHelper::SendGlobalKeyEvent(int key_code,
base::ScopedCFTypeRef<CGEventRef> key_event( base::ScopedCFTypeRef<CGEventRef> key_event(
CGEventCreateKeyboardEvent(event_source_, key_code, key_down)); CGEventCreateKeyboardEvent(event_source_, key_code, key_down));
CGEventSetFlags(key_event, current_flags); CGEventSetFlags(key_event, current_flags);
// Starting in 10.14, CGEventPost() pops up a modal that asks the user to
// confirm whether the app should be allowed to use accessibility APIs, which
// hangs tests on the bots. https://crbug.com/904403
DCHECK(base::mac::IsAtMostOS10_13());
CGEventPost(event_tap_location_, key_event); CGEventPost(event_tap_location_, key_event);
if (key_down && !first_key_down_code_) if (key_down && !first_key_down_code_)
first_key_down_code_ = key_code; first_key_down_code_ = key_code;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment