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

sheriff: garden GlobalKeyboardShortcutsTest on Mac

This change:
1) Removes some stub code that was trying to disable a test
2) Fixes SwitchTabsMac on 10.14+, where SendGlobalKeyEventsAndWait CHECKs

Bug: 852232
Change-Id: I304c12488de83dcf6c361018f359c776a23cf1d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1762485
Auto-Submit: Elly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689173}
parent e6bd736b
......@@ -22,6 +22,7 @@
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "ui/events/event_constants.h"
#include "ui/events/keycodes/keyboard_codes.h"
#import "ui/events/test/cocoa_test_event_utils.h"
using cocoa_test_event_utils::SynthesizeKeyEvent;
......@@ -47,13 +48,6 @@ void SendEvent(NSEvent* ns_event) {
} // namespace
// Test that global keyboard shortcuts are handled by the native window.
// https://crbug.com/852232
#if defined(OS_MACOSX)
#define MAYBE_SwitchTabsMac DISABLED_SwitchTabsMac
#else
#define MAYBE_SwitchTabsMac
#endif
IN_PROC_BROWSER_TEST_F(GlobalKeyboardShortcutsTest, SwitchTabsMac) {
NSWindow* ns_window =
browser()->window()->GetNativeWindow().GetNativeNSWindow();
......@@ -184,13 +178,16 @@ IN_PROC_BROWSER_TEST_F(GlobalKeyboardShortcutsTest, ReopenPreviousTab) {
ASSERT_EQ(tab_strip->GetActiveWebContents()->GetLastCommittedURL(), test_url);
// Close a tab.
ui_test_utils::SendGlobalKeyEventsAndWait(kVK_ANSI_W, ui::EF_COMMAND_DOWN);
ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
browser()->window()->GetNativeWindow(), ui::VKEY_W, false, false, false,
true));
EXPECT_EQ(1, tab_strip->count());
ASSERT_NE(tab_strip->GetActiveWebContents()->GetLastCommittedURL(), test_url);
// Reopen a tab.
ui_test_utils::SendGlobalKeyEventsAndWait(
kVK_ANSI_T, ui::EF_SHIFT_DOWN | ui::EF_COMMAND_DOWN);
ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
browser()->window()->GetNativeWindow(), ui::VKEY_T, false, true, false,
true));
EXPECT_EQ(2, tab_strip->count());
ASSERT_EQ(tab_strip->GetActiveWebContents()->GetLastCommittedURL(), test_url);
}
......
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