[Chromium] Allow asyncronous response of pointer lock requests in layout tests.
authorscheib@chromium.org <scheib@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Sep 2012 18:08:19 +0000 (18:08 +0000)
committerscheib@chromium.org <scheib@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Sep 2012 18:08:19 +0000 (18:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95628

Reviewed by James Robinson.

Tools:

Future tests need the ability to respond asynchronously that
pointer lock requests have been accepted or rejected. This patch
adds the following:
    testRunner.setPointerLockWillRespondAsynchronously();
    testRunner.didAcquirePointerLock();
    testRunner.didNotAcquirePointerLock();

Tested in existing test:
    pointerlockchange-pointerlockerror-events.html

* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::DRTTestRunner):
(DRTTestRunner::didAcquirePointerLock):
(DRTTestRunner::didNotAcquirePointerLock):
(DRTTestRunner::setPointerLockWillRespondAsynchronously):
* DumpRenderTree/chromium/DRTTestRunner.h:
(DRTTestRunner):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::requestPointerLock):
(WebViewHost::didAcquirePointerLock):
(WebViewHost::didNotAcquirePointerLock):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):
(WebViewHost::setPointerLockWillRespondAsynchronously):

LayoutTests:

Add testing for testRunner.setPointerLockWillRespondAsynchronously().

* pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt:
* pointer-lock/pointerlockchange-pointerlockerror-events.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127473 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt
LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events.html
Tools/ChangeLog
Tools/DumpRenderTree/chromium/DRTTestRunner.cpp
Tools/DumpRenderTree/chromium/DRTTestRunner.h
Tools/DumpRenderTree/chromium/WebViewHost.cpp
Tools/DumpRenderTree/chromium/WebViewHost.h

index dc6d905..6e1892d 100644 (file)
@@ -1,3 +1,15 @@
+2012-09-04  Vincent Scheib  <scheib@chromium.org>
+
+        [Chromium] Allow asyncronous response of pointer lock requests in layout tests.
+        https://bugs.webkit.org/show_bug.cgi?id=95628
+
+        Reviewed by James Robinson.
+
+        Add testing for testRunner.setPointerLockWillRespondAsynchronously().
+
+        * pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt:
+        * pointer-lock/pointerlockchange-pointerlockerror-events.html:
+
 2012-09-04  Andrei Bucur  <abucur@adobe.com>
 
         [CSS Regions] Destroying a render named flow thread without unregistering left-over content nodes triggered an assertion.
index f75145e..ab6df58 100644 (file)
@@ -30,9 +30,13 @@ PASS onwebkitpointerlockchange received after: Unlock targetIframe2 (handler for
 PASS testRunner.setPointerLockWillFailSynchronously is defined.
      Lock with synchronous failure.
 PASS onwebkitpointerlockerror received after: Lock with synchronous failure.
-PASS testRunner.setPointerLockWillFailAsynchronously is defined.
+PASS testRunner.setPointerLockWillRespondAsynchronously is defined.
+PASS testRunner.didAcquirePointerLock is defined.
+PASS testRunner.didNotAcquirePointerLock is defined.
      Lock with asynchronous failure.
 PASS onwebkitpointerlockerror received after: Lock with asynchronous failure.
+     Lock with asynchronous success.
+PASS onwebkitpointerlockchange received after: Lock with asynchronous success.
 PASS successfullyParsed is true
 
 TEST COMPLETE
index b652fe0..7e485f9 100644 (file)
             targetDiv1.webkitRequestPointerLock();
         },
         function () {
-            shouldBeDefined("testRunner.setPointerLockWillFailAsynchronously");
-            testRunner.setPointerLockWillFailAsynchronously();
+            shouldBeDefined("testRunner.setPointerLockWillRespondAsynchronously");
+            shouldBeDefined("testRunner.didAcquirePointerLock");
+            shouldBeDefined("testRunner.didNotAcquirePointerLock");
+            testRunner.setPointerLockWillRespondAsynchronously();
             expectOnlyErrorEvent("Lock with asynchronous failure.");
             targetDiv1.webkitRequestPointerLock();
+            doNextStep();
+        },
+        function () {
+            testRunner.didNotAcquirePointerLock();
+        },
+        function () {
+            testRunner.setPointerLockWillRespondAsynchronously();
+            expectOnlyChangeEvent("Lock with asynchronous success.");
+            targetDiv1.webkitRequestPointerLock();
+            doNextStep();
+        },
+        function () {
+            testRunner.didAcquirePointerLock();
         },
     ];
     doNextStep();
index 53609e2..fad525d 100644 (file)
@@ -1,3 +1,35 @@
+2012-09-04  Vincent Scheib  <scheib@chromium.org>
+
+        [Chromium] Allow asyncronous response of pointer lock requests in layout tests.
+        https://bugs.webkit.org/show_bug.cgi?id=95628
+
+        Reviewed by James Robinson.
+
+        Future tests need the ability to respond asynchronously that
+        pointer lock requests have been accepted or rejected. This patch
+        adds the following:
+            testRunner.setPointerLockWillRespondAsynchronously();
+            testRunner.didAcquirePointerLock();
+            testRunner.didNotAcquirePointerLock();
+
+        Tested in existing test:
+            pointerlockchange-pointerlockerror-events.html
+
+        * DumpRenderTree/chromium/DRTTestRunner.cpp:
+        (DRTTestRunner::DRTTestRunner):
+        (DRTTestRunner::didAcquirePointerLock):
+        (DRTTestRunner::didNotAcquirePointerLock):
+        (DRTTestRunner::setPointerLockWillRespondAsynchronously):
+        * DumpRenderTree/chromium/DRTTestRunner.h:
+        (DRTTestRunner):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::requestPointerLock):
+        (WebViewHost::didAcquirePointerLock):
+        (WebViewHost::didNotAcquirePointerLock):
+        * DumpRenderTree/chromium/WebViewHost.h:
+        (WebViewHost):
+        (WebViewHost::setPointerLockWillRespondAsynchronously):
+
 2012-09-03  Ryuan Choi  <ryuan.choi@samsung.com>
 
         [EFL] Change the focus when the web view is clicked in MiniBrowser and EWebLauncher
index b7e1291..0bee8a9 100644 (file)
@@ -124,7 +124,9 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
     bindMethod("clearAllDatabases", &DRTTestRunner::clearAllDatabases);
     bindMethod("closeWebInspector", &DRTTestRunner::closeWebInspector);
 #if ENABLE(POINTER_LOCK)
+    bindMethod("didAcquirePointerLock", &DRTTestRunner::didAcquirePointerLock);
     bindMethod("didLosePointerLock", &DRTTestRunner::didLosePointerLock);
+    bindMethod("didNotAcquirePointerLock", &DRTTestRunner::didNotAcquirePointerLock);
 #endif
     bindMethod("disableAutoResizeMode", &DRTTestRunner::disableAutoResizeMode);
     bindMethod("disableImageLoading", &DRTTestRunner::disableImageLoading);
@@ -212,7 +214,7 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
     bindMethod("setPageVisibility", &DRTTestRunner::setPageVisibility);
     bindMethod("setPluginsEnabled", &DRTTestRunner::setPluginsEnabled);
 #if ENABLE(POINTER_LOCK)
-    bindMethod("setPointerLockWillFailAsynchronously", &DRTTestRunner::setPointerLockWillFailAsynchronously);
+    bindMethod("setPointerLockWillRespondAsynchronously", &DRTTestRunner::setPointerLockWillRespondAsynchronously);
     bindMethod("setPointerLockWillFailSynchronously", &DRTTestRunner::setPointerLockWillFailSynchronously);
 #endif
     bindMethod("setPopupBlockingEnabled", &DRTTestRunner::setPopupBlockingEnabled);
@@ -2327,15 +2329,27 @@ void DRTTestRunner::setHasCustomFullScreenBehavior(const CppArgumentList& argume
 }
 
 #if ENABLE(POINTER_LOCK)
+void DRTTestRunner::didAcquirePointerLock(const CppArgumentList&, CppVariant* result)
+{
+    m_shell->webViewHost()->didAcquirePointerLock();
+    result->setNull();
+}
+
+void DRTTestRunner::didNotAcquirePointerLock(const CppArgumentList&, CppVariant* result)
+{
+    m_shell->webViewHost()->didNotAcquirePointerLock();
+    result->setNull();
+}
+
 void DRTTestRunner::didLosePointerLock(const CppArgumentList&, CppVariant* result)
 {
     m_shell->webViewHost()->didLosePointerLock();
     result->setNull();
 }
 
-void DRTTestRunner::setPointerLockWillFailAsynchronously(const CppArgumentList&, CppVariant* result)
+void DRTTestRunner::setPointerLockWillRespondAsynchronously(const CppArgumentList&, CppVariant* result)
 {
-    m_shell->webViewHost()->setPointerLockWillFailAsynchronously();
+    m_shell->webViewHost()->setPointerLockWillRespondAsynchronously();
     result->setNull();
 }
 
index 2fffd59..f8a5867 100644 (file)
@@ -416,9 +416,11 @@ public:
     void setAutomaticLinkDetectionEnabled(bool);
 
 #if ENABLE(POINTER_LOCK)
+    void didAcquirePointerLock(const CppArgumentList&, CppVariant*);
+    void didNotAcquirePointerLock(const CppArgumentList&, CppVariant*);
     void didLosePointerLock(const CppArgumentList&, CppVariant*);
     void setPointerLockWillFailSynchronously(const CppArgumentList&, CppVariant*);
-    void setPointerLockWillFailAsynchronously(const CppArgumentList&, CppVariant*);
+    void setPointerLockWillRespondAsynchronously(const CppArgumentList&, CppVariant*);
 #endif
 
     void workerThreadCount(CppVariant*);
index e86d61b..55e4d84 100644 (file)
@@ -864,9 +864,8 @@ bool WebViewHost::requestPointerLock()
     case PointerLockWillSucceed:
         postDelayedTask(new HostMethodTask(this, &WebViewHost::didAcquirePointerLock), 0);
         return true;
-    case PointerLockWillFailAsync:
+    case PointerLockWillRespondAsync:
         ASSERT(!m_pointerLocked);
-        postDelayedTask(new HostMethodTask(this, &WebViewHost::didNotAcquirePointerLock), 0);
         return true;
     case PointerLockWillFailSync:
         ASSERT(!m_pointerLocked);
@@ -891,6 +890,9 @@ void WebViewHost::didAcquirePointerLock()
 {
     m_pointerLocked = true;
     webWidget()->didAcquirePointerLock();
+
+    // Reset planned result to default.
+    m_pointerLockPlannedResult = PointerLockWillSucceed;
 }
 
 void WebViewHost::didNotAcquirePointerLock()
@@ -898,6 +900,9 @@ void WebViewHost::didNotAcquirePointerLock()
     ASSERT(!m_pointerLocked);
     m_pointerLocked = false;
     webWidget()->didNotAcquirePointerLock();
+
+    // Reset planned result to default.
+    m_pointerLockPlannedResult = PointerLockWillSucceed;
 }
 
 void WebViewHost::didLosePointerLock()
index caee3cb..4a3627f 100644 (file)
@@ -128,8 +128,10 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
 #endif
 
 #if ENABLE(POINTER_LOCK)
+    void didAcquirePointerLock();
+    void didNotAcquirePointerLock();
     void didLosePointerLock();
-    void setPointerLockWillFailAsynchronously() { m_pointerLockPlannedResult = PointerLockWillFailAsync; }
+    void setPointerLockWillRespondAsynchronously() { m_pointerLockPlannedResult = PointerLockWillRespondAsync; }
     void setPointerLockWillFailSynchronously() { m_pointerLockPlannedResult = PointerLockWillFailSync; }
 #endif
 
@@ -340,11 +342,6 @@ private:
     void resetScrollRect();
     void discardBackingStore();
 
-#if ENABLE(POINTER_LOCK)
-    void didAcquirePointerLock();
-    void didNotAcquirePointerLock();
-#endif
-
 #if ENABLE(MEDIA_STREAM)
     WebKit::WebUserMediaClientMock* userMediaClientMock();
     webkit_support::TestMediaStreamClient* testMediaStreamClient();
@@ -449,7 +446,7 @@ private:
     bool m_pointerLocked;
     enum {
         PointerLockWillSucceed,
-        PointerLockWillFailAsync,
+        PointerLockWillRespondAsync,
         PointerLockWillFailSync
     } m_pointerLockPlannedResult;
 #endif