Commit 34be567b authored by scheib@chromium.org's avatar 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.

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: http://svn.webkit.org/repository/webkit/trunk@127473 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9e41565f
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.
......@@ -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
......
......@@ -82,10 +82,25 @@
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();
......
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
......
......@@ -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();
}
......
......@@ -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*);
......
......@@ -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()
......
......@@ -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
......
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