Title: [139242] trunk
Revision
139242
Author
christophe.du...@intel.com
Date
2013-01-09 14:36:49 -0800 (Wed, 09 Jan 2013)

Log Message

[WK2] Implement eventSender.scheduleAsynchronousKeyDown
https://bugs.webkit.org/show_bug.cgi?id=93979

Reviewed by Benjamin Poulain.

Tools:

Implement eventSender.scheduleAsynchronousKeyDown() in
WebKitTestRunner.

* WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::createKeyDownMessageBody):
(WTR::EventSendingController::keyDown):
(WTR::EventSendingController::scheduleAsynchronousKeyDown):
* WebKitTestRunner/InjectedBundle/EventSendingController.h:
(EventSendingController):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::didReceiveKeyDownMessageFromInjectedBundle):
(WTR::TestController::didReceiveMessageFromInjectedBundle):
(WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/TestController.h:
(TestController):

LayoutTests:

Update WK2 expectations for tests requiring
eventSender.scheduleAsynchronousKeyDown now that it is
implemented in WebKitTestRunner.

* platform/efl-wk2/TestExpectations:
* platform/gtk-wk2/TestExpectations:
* platform/wk2/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139241 => 139242)


--- trunk/LayoutTests/ChangeLog	2013-01-09 22:30:48 UTC (rev 139241)
+++ trunk/LayoutTests/ChangeLog	2013-01-09 22:36:49 UTC (rev 139242)
@@ -1,3 +1,18 @@
+2013-01-09  Christophe Dumez  <christophe.du...@intel.com>
+
+        [WK2] Implement eventSender.scheduleAsynchronousKeyDown
+        https://bugs.webkit.org/show_bug.cgi?id=93979
+
+        Reviewed by Benjamin Poulain.
+
+        Update WK2 expectations for tests requiring
+        eventSender.scheduleAsynchronousKeyDown now that it is
+        implemented in WebKitTestRunner.
+
+        * platform/efl-wk2/TestExpectations:
+        * platform/gtk-wk2/TestExpectations:
+        * platform/wk2/TestExpectations:
+
 2013-01-09  Dan Winship  <d...@gnome.org>
 
         [Soup] Handle redirection inside WebKit

Modified: trunk/LayoutTests/platform/efl-wk2/TestExpectations (139241 => 139242)


--- trunk/LayoutTests/platform/efl-wk2/TestExpectations	2013-01-09 22:30:48 UTC (rev 139241)
+++ trunk/LayoutTests/platform/efl-wk2/TestExpectations	2013-01-09 22:36:49 UTC (rev 139242)
@@ -305,8 +305,8 @@
 Bug(EFL) editing/spelling/grammar-edit-word.html [ Failure ]
 Bug(EFL) editing/spelling/markers.html [ Failure ]
 
-# WebKitTestRunner needs an implementation for eventSender.scheduleAsynchronousKeyDown
-webkit.org/b/93979 fast/dom/MutationObserver/end-of-task-delivery.html [ Failure ]
+# Fails because MutationObservers are not notified at end-of-task.
+webkit.org/b/78290 fast/dom/MutationObserver/end-of-task-delivery.html [ Failure ]
 
 # testRunner.setUseDeferredFrameLoading() is not implemented in WK2. Skipped so it does not generate PNG results.
 webkit.org/b/93980 http/tests/appcache/load-from-appcache-defer-resume-crash.html [ Skip ]

Modified: trunk/LayoutTests/platform/gtk-wk2/TestExpectations (139241 => 139242)


--- trunk/LayoutTests/platform/gtk-wk2/TestExpectations	2013-01-09 22:30:48 UTC (rev 139241)
+++ trunk/LayoutTests/platform/gtk-wk2/TestExpectations	2013-01-09 22:36:49 UTC (rev 139242)
@@ -175,9 +175,8 @@
 # http://webkit.org/b/93977
 webkit.org/b/93977 fast/dom/Geolocation/page-reload-cancel-permission-requests.html [ Failure ]
 
-# Implement eventSender.scheduleAsynchronousKeyDown
-# http://webkit.org/b/93979
-Bug(GTK) fast/dom/MutationObserver/end-of-task-delivery.html [ Failure Timeout ]
+# Fails because MutationObservers are not notified at end-of-task.
+webkit.org/b/78290 fast/dom/MutationObserver/end-of-task-delivery.html [ Failure Timeout ]
 
 # Implement testRunner.setUseDeferredFrameLoading
 # http://webkit.org/b/93980

Modified: trunk/LayoutTests/platform/wk2/TestExpectations (139241 => 139242)


--- trunk/LayoutTests/platform/wk2/TestExpectations	2013-01-09 22:30:48 UTC (rev 139241)
+++ trunk/LayoutTests/platform/wk2/TestExpectations	2013-01-09 22:36:49 UTC (rev 139242)
@@ -512,10 +512,6 @@
 fast/forms/input-autofilled.html
 fast/forms/reset-autofilled.html
 
-# WebKitTestRunner needs a more-complete implementation of eventSender
-# https://bugs.webkit.org/show_bug.cgi?id=42194
-fast/dom/MutationObserver/inline-event-listener.html
-
 # WebKitTestRunner needs eventSender.contextClick()
 # https://bugs.webkit.org/show_bug.cgi?id=86881
 editing/selection/context-menu-text-selection.html

Modified: trunk/Tools/ChangeLog (139241 => 139242)


--- trunk/Tools/ChangeLog	2013-01-09 22:30:48 UTC (rev 139241)
+++ trunk/Tools/ChangeLog	2013-01-09 22:36:49 UTC (rev 139242)
@@ -1,3 +1,27 @@
+2013-01-09  Christophe Dumez  <christophe.du...@intel.com>
+
+        [WK2] Implement eventSender.scheduleAsynchronousKeyDown
+        https://bugs.webkit.org/show_bug.cgi?id=93979
+
+        Reviewed by Benjamin Poulain.
+
+        Implement eventSender.scheduleAsynchronousKeyDown() in
+        WebKitTestRunner.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
+        * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+        (WTR::createKeyDownMessageBody):
+        (WTR::EventSendingController::keyDown):
+        (WTR::EventSendingController::scheduleAsynchronousKeyDown):
+        * WebKitTestRunner/InjectedBundle/EventSendingController.h:
+        (EventSendingController):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::didReceiveKeyDownMessageFromInjectedBundle):
+        (WTR::TestController::didReceiveMessageFromInjectedBundle):
+        (WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):
+        * WebKitTestRunner/TestController.h:
+        (TestController):
+
 2013-01-09  Jochen Eisinger  <joc...@chromium.org>
 
         [chromium] move resource load callback dumping to TestRunner library

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl (139241 => 139242)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl	2013-01-09 22:30:48 UTC (rev 139241)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl	2013-01-09 22:36:49 UTC (rev 139242)
@@ -35,6 +35,7 @@
     void leapForward(in long milliseconds);
 
     void keyDown(in DOMString key, in object modifierArray, in long location);
+    void scheduleAsynchronousKeyDown(in DOMString key);
 
     // Zoom functions.
     void textZoomIn();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (139241 => 139242)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp	2013-01-09 22:30:48 UTC (rev 139241)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp	2013-01-09 22:36:49 UTC (rev 139242)
@@ -247,14 +247,8 @@
     WKBundlePostMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), mouseUpMessageBody.get());
 }
 
-void EventSendingController::keyDown(JSStringRef key, JSValueRef modifierArray, int location)
+static WKRetainPtr<WKMutableDictionaryRef> createKeyDownMessageBody(JSStringRef key, WKEventModifiers modifiers, int location)
 {
-    WKBundlePageRef page = InjectedBundle::shared().page()->page();
-    WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);
-    JSContextRef context = WKBundleFrameGetJavaScriptContext(frame);
-    WKEventModifiers modifiers = parseModifierArray(context, modifierArray);
-
-    WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
     WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
 
     WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
@@ -272,9 +266,30 @@
     WKRetainPtr<WKUInt64Ref> locationRef(AdoptWK, WKUInt64Create(location));
     WKDictionaryAddItem(EventSenderMessageBody.get(), locationKey.get(), locationRef.get());
 
-    WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+    return EventSenderMessageBody;
 }
 
+void EventSendingController::keyDown(JSStringRef key, JSValueRef modifierArray, int location)
+{
+    WKBundlePageRef page = InjectedBundle::shared().page()->page();
+    WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);
+    JSContextRef context = WKBundleFrameGetJavaScriptContext(frame);
+    WKEventModifiers modifiers = parseModifierArray(context, modifierArray);
+
+    WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
+    WKRetainPtr<WKMutableDictionaryRef> keyDownMessageBody = createKeyDownMessageBody(key, modifiers, location);
+
+    WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), keyDownMessageBody.get(), 0);
+}
+
+void EventSendingController::scheduleAsynchronousKeyDown(JSStringRef key)
+{
+    WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
+    WKRetainPtr<WKMutableDictionaryRef> keyDownMessageBody = createKeyDownMessageBody(key, 0 /* modifiers */, 0 /* location */);
+
+    WKBundlePostMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), keyDownMessageBody.get());
+}
+
 void EventSendingController::mouseScrollBy(int x, int y)
 {
     WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h (139241 => 139242)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h	2013-01-09 22:30:48 UTC (rev 139241)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h	2013-01-09 22:36:49 UTC (rev 139242)
@@ -57,6 +57,7 @@
     void scheduleAsynchronousClick();
 
     void keyDown(JSStringRef key, JSValueRef modifierArray, int location);
+    void scheduleAsynchronousKeyDown(JSStringRef key);
 
     // Zoom functions.
     void textZoomIn();

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (139241 => 139242)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2013-01-09 22:30:48 UTC (rev 139241)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2013-01-09 22:36:49 UTC (rev 139242)
@@ -778,6 +778,26 @@
     *returnData = static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveSynchronousMessageFromInjectedBundle(messageName, messageBody).leakRef();
 }
 
+void TestController::didReceiveKeyDownMessageFromInjectedBundle(WKDictionaryRef messageBodyDictionary, bool synchronous)
+{
+    WKRetainPtr<WKStringRef> keyKey = adoptWK(WKStringCreateWithUTF8CString("Key"));
+    WKStringRef key = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, keyKey.get()));
+
+    WKRetainPtr<WKStringRef> modifiersKey = adoptWK(WKStringCreateWithUTF8CString("Modifiers"));
+    WKEventModifiers modifiers = static_cast<WKEventModifiers>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, modifiersKey.get()))));
+
+    WKRetainPtr<WKStringRef> locationKey = adoptWK(WKStringCreateWithUTF8CString("Location"));
+    unsigned location = static_cast<unsigned>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, locationKey.get()))));
+
+    if (synchronous)
+        WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), true);
+
+    m_eventSenderProxy->keyDown(key, modifiers, location);
+
+    if (synchronous)
+        WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false);
+}
+
 void TestController::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody)
 {
 #if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
@@ -804,6 +824,13 @@
 
             return;
         }
+
+        if (WKStringIsEqualToUTF8CString(subMessageName, "KeyDown")) {
+            didReceiveKeyDownMessageFromInjectedBundle(messageBodyDictionary, false);
+
+            return;
+        }
+
         ASSERT_NOT_REACHED();
     }
 #endif
@@ -825,19 +852,8 @@
         WKStringRef subMessageName = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, subMessageKey.get()));
 
         if (WKStringIsEqualToUTF8CString(subMessageName, "KeyDown")) {
-            WKRetainPtr<WKStringRef> keyKey = adoptWK(WKStringCreateWithUTF8CString("Key"));
-            WKStringRef key = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, keyKey.get()));
+            didReceiveKeyDownMessageFromInjectedBundle(messageBodyDictionary, true);
 
-            WKRetainPtr<WKStringRef> modifiersKey = adoptWK(WKStringCreateWithUTF8CString("Modifiers"));
-            WKEventModifiers modifiers = static_cast<WKEventModifiers>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, modifiersKey.get()))));
-
-            WKRetainPtr<WKStringRef> locationKey = adoptWK(WKStringCreateWithUTF8CString("Location"));
-            unsigned location = static_cast<unsigned>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, locationKey.get()))));
-
-            // Forward to WebProcess
-            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), true);
-            m_eventSenderProxy->keyDown(key, modifiers, location);
-            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false);
             return 0;
         }
 

Modified: trunk/Tools/WebKitTestRunner/TestController.h (139241 => 139242)


--- trunk/Tools/WebKitTestRunner/TestController.h	2013-01-09 22:30:48 UTC (rev 139241)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2013-01-09 22:36:49 UTC (rev 139242)
@@ -113,6 +113,8 @@
     void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
     WKRetainPtr<WKTypeRef> didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
 
+    void didReceiveKeyDownMessageFromInjectedBundle(WKDictionaryRef messageBodyDictionary, bool synchronous);
+
     // WKPageLoaderClient
     static void didCommitLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void*);
     void didCommitLoadForFrame(WKPageRef, WKFrameRef);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to