- Revision
- 186694
- Author
- [email protected]
- Date
- 2015-07-10 16:09:59 -0700 (Fri, 10 Jul 2015)
Log Message
[Mac] Unable to dismiss context menu during test runs
https://bugs.webkit.org/show_bug.cgi?id=146836
Reviewed by Tim Horton.
Since Context Menus are modal, the test system would block on the displayed context menu,
causing tests to fail. Instead, we should do what WK1 was doing, which is to perform the
mouse click and generate the menu contents, but not ask AppKit to display it.
Drive-by fix: We did not handle 'escape' key presses. This is also fixed.
* DumpRenderTree/mac/EventSendingController.mm:
(-[EventSendingController keyDown:withModifiers:withLocation:]): Handle the 'escape' character.
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::EventSendingController::mouseMoveTo): Keep track of the current mouse position.
(WTR::EventSendingController::contextClick): Don't emit an actual context menu invocation and then
copy the menu items. Instead, use WKBundlePageCopyContentMenuAtPointInWindow to do all the same
work without actually calling on AppKit to display the menu.
ask WebCore to do all the work EXCEPT displaying the menu.
* WebKitTestRunner/InjectedBundle/EventSendingController.h:
* WebKitTestRunner/mac/EventSenderProxy.mm:
(WTR::EventSenderProxy::keyDown): Handle the 'escape' character.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (186693 => 186694)
--- trunk/Tools/ChangeLog 2015-07-10 22:29:07 UTC (rev 186693)
+++ trunk/Tools/ChangeLog 2015-07-10 23:09:59 UTC (rev 186694)
@@ -1,3 +1,28 @@
+2015-07-10 Brent Fulgham <[email protected]>
+
+ [Mac] Unable to dismiss context menu during test runs
+ https://bugs.webkit.org/show_bug.cgi?id=146836
+
+ Reviewed by Tim Horton.
+
+ Since Context Menus are modal, the test system would block on the displayed context menu,
+ causing tests to fail. Instead, we should do what WK1 was doing, which is to perform the
+ mouse click and generate the menu contents, but not ask AppKit to display it.
+
+ Drive-by fix: We did not handle 'escape' key presses. This is also fixed.
+
+ * DumpRenderTree/mac/EventSendingController.mm:
+ (-[EventSendingController keyDown:withModifiers:withLocation:]): Handle the 'escape' character.
+ * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+ (WTR::EventSendingController::mouseMoveTo): Keep track of the current mouse position.
+ (WTR::EventSendingController::contextClick): Don't emit an actual context menu invocation and then
+ copy the menu items. Instead, use WKBundlePageCopyContentMenuAtPointInWindow to do all the same
+ work without actually calling on AppKit to display the menu.
+ ask WebCore to do all the work EXCEPT displaying the menu.
+ * WebKitTestRunner/InjectedBundle/EventSendingController.h:
+ * WebKitTestRunner/mac/EventSenderProxy.mm:
+ (WTR::EventSenderProxy::keyDown): Handle the 'escape' character.
+
2015-07-09 Filip Pizlo <[email protected]>
It should be possible to run the OSR exit fuzzer
Modified: trunk/Tools/DumpRenderTree/mac/EventSendingController.mm (186693 => 186694)
--- trunk/Tools/DumpRenderTree/mac/EventSendingController.mm 2015-07-10 22:29:07 UTC (rev 186693)
+++ trunk/Tools/DumpRenderTree/mac/EventSendingController.mm 2015-07-10 23:09:59 UTC (rev 186694)
@@ -968,6 +968,8 @@
keyCode = 0x02;
else if ([character isEqualToString:@"e"])
keyCode = 0x0E;
+ else if ([character isEqualToString:@"\x1b"])
+ keyCode = 0x1B;
KeyMappingEntry table[] = {
{0x2F, 0x41, '.', nil},
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (186693 => 186694)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp 2015-07-10 22:29:07 UTC (rev 186693)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp 2015-07-10 23:09:59 UTC (rev 186694)
@@ -250,6 +250,8 @@
WKRetainPtr<WKDoubleRef> yRef(AdoptWK, WKDoubleCreate(y));
WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
+ m_position = WKPointMake(x, y);
+
WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
@@ -473,11 +475,7 @@
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
#if ENABLE(CONTEXT_MENUS)
- // Do mouse context click.
- mouseDown(2, 0);
- mouseUp(2, 0);
-
- WKRetainPtr<WKArrayRef> menuEntries = adoptWK(WKBundlePageCopyContextMenuItems(page));
+ WKRetainPtr<WKArrayRef> menuEntries = adoptWK(WKBundlePageCopyContextMenuAtPointInWindow(page, m_position));
JSValueRef arrayResult = JSObjectMakeArray(context, 0, 0, 0);
JSObjectRef arrayObj = JSValueToObject(context, arrayResult, 0);
size_t entriesSize = WKArrayGetSize(menuEntries.get());
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h (186693 => 186694)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h 2015-07-10 22:29:07 UTC (rev 186693)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h 2015-07-10 23:09:59 UTC (rev 186694)
@@ -85,6 +85,7 @@
private:
EventSendingController();
+ WKPoint m_position;
};
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm (186693 => 186694)
--- trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm 2015-07-10 22:29:07 UTC (rev 186693)
+++ trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm 2015-07-10 23:09:59 UTC (rev 186694)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2014-2015 Apple Inc. All rights reserved.
* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
*
* Redistribution and use in source and binary forms, with or without
@@ -563,6 +563,8 @@
keyCode = 0x02;
else if ([character isEqualToString:@"e"])
keyCode = 0x0E;
+ else if ([character isEqualToString:@"\x1b"])
+ keyCode = 0x1B;
KeyMappingEntry table[] = {
{0x2F, 0x41, '.', nil},