Diff
Modified: trunk/LayoutTests/ChangeLog (122157 => 122158)
--- trunk/LayoutTests/ChangeLog 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/ChangeLog 2012-07-09 21:19:26 UTC (rev 122158)
@@ -1,3 +1,33 @@
+2012-07-09 Vincent Scheib <[email protected]>
+
+ Refactor common Pointer Lock test code to a harness.
+ https://bugs.webkit.org/show_bug.cgi?id=90813
+
+ Reviewed by Adrienne Walker.
+
+ * pointer-lock/bug90391-move-then-window-open-crash-expected.txt:
+ * pointer-lock/bug90391-move-then-window-open-crash.html:
+ * pointer-lock/lock-already-locked-expected.txt:
+ * pointer-lock/lock-already-locked.html:
+ * pointer-lock/lock-fail-responses-expected.txt:
+ * pointer-lock/lock-fail-responses.html:
+ * pointer-lock/mouse-event-delivery-expected.txt:
+ * pointer-lock/mouse-event-delivery.html:
+ * pointer-lock/pointer-lock-api-expected.txt:
+ * pointer-lock/pointer-lock-api.html:
+ * pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt:
+ * pointer-lock/pointerlockchange-pointerlockerror-events.html:
+ * pointer-lock/pointerlocklost-event-expected.txt:
+ * pointer-lock/pointerlocklost-event.html:
+ * pointer-lock/resources/pointer-lock-test-harness.js: Added.
+ (doNextStep.else):
+ (doNextStepWithUserGesture):
+ (eventExpected.targetHanderNode.eventHandlerName):
+ (eventExpected):
+ (expectOnlyChangeEvent):
+ (expectOnlyErrorEvent):
+ (expectNoEvents):
+
2012-07-09 Dean Jackson <[email protected]>
Tiled drawing means some elements can disappear behind the page
Modified: trunk/LayoutTests/pointer-lock/bug90391-move-then-window-open-crash-expected.txt (122157 => 122158)
--- trunk/LayoutTests/pointer-lock/bug90391-move-then-window-open-crash-expected.txt 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/pointer-lock/bug90391-move-then-window-open-crash-expected.txt 2012-07-09 21:19:26 UTC (rev 122158)
@@ -11,5 +11,4 @@
PASS successfullyParsed is true
TEST COMPLETE
-doNextStep for manual testing
Modified: trunk/LayoutTests/pointer-lock/bug90391-move-then-window-open-crash.html (122157 => 122158)
--- trunk/LayoutTests/pointer-lock/bug90391-move-then-window-open-crash.html 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/pointer-lock/bug90391-move-then-window-open-crash.html 2012-07-09 21:19:26 UTC (rev 122158)
@@ -2,10 +2,10 @@
<html>
<head>
<script src=""
+<script src=""
</head>
<body>
<div>
- <button _onclick_="doNextStep('manual');">doNextStep for manual testing</button>
<div id="target1"></div>
</div>
<script>
@@ -14,16 +14,6 @@
targetdiv1 = document.getElementById("target1");
- currentStep = 0;
- function doNextStep(manual)
- {
- if (!window.layoutTestController && !manual)
- return;
- if (currentStep < todo.length)
- setTimeout(function () { todo[currentStep++](); }, 0);
- else if (currentStep++ == todo.length)
- setTimeout(function () { finishJSTest(); }, 0);
- }
todo = [
function () {
debug(" Locking targetdiv1.")
@@ -31,7 +21,7 @@
document._onwebkitpointerlockchange_ = function () {
document._onwebkitpointerlockchange_ = null;
testPassed("document.onwebkitpointerlockchange event received.");
- doNextStep('manual');
+ doNextStep();
};
},
function () {
@@ -40,7 +30,7 @@
targetdiv1._onmousemove_ = function () {
if (++mouseMoveEvents == 2) {
targetdiv1._onmousemove_ = null;
- doNextStep('manual');
+ doNextStep();
}
}
if (window.eventSender) {
@@ -54,10 +44,10 @@
window.open();
testPassed("Didn't crash");
document.webkitExitPointerLock();
- doNextStep('manual');
+ doNextStep();
},
];
- doNextStep();
+ doNextStepWithUserGesture();
</script>
<script src=""
</body>
Modified: trunk/LayoutTests/pointer-lock/lock-already-locked-expected.txt (122157 => 122158)
--- trunk/LayoutTests/pointer-lock/lock-already-locked-expected.txt 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/pointer-lock/lock-already-locked-expected.txt 2012-07-09 21:19:26 UTC (rev 122158)
@@ -31,5 +31,4 @@
PASS successfullyParsed is true
TEST COMPLETE
-doNextStep for manual testing
Modified: trunk/LayoutTests/pointer-lock/lock-already-locked.html (122157 => 122158)
--- trunk/LayoutTests/pointer-lock/lock-already-locked.html 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/pointer-lock/lock-already-locked.html 2012-07-09 21:19:26 UTC (rev 122158)
@@ -2,10 +2,10 @@
<html>
<head>
<script src=""
+<script src=""
</head>
<body>
<div>
- <button _onclick_="doNextStep('manual');">doNextStep for manual testing</button>
<div id="target1"></div>
<div id="target2"></div>
</div>
@@ -22,7 +22,7 @@
{
testPassed("document.onwebkitpointerlockchange event received.");
shouldBe("document.webkitPointerLockElement", expectedTargetToBeLockedString);
- doNextStep();
+ doNextStepWithUserGesture();
};
document._onwebkitpointerlockerror_ =
function () { testFailed("document.onwebkitpointerlockerror event received."); finishJSTest(); };
@@ -35,16 +35,6 @@
targetdiv2.addEventListener("webkitpointerlocklost",
function () { shouldBe("expectTarget2Unlock", "true"); });
- currentStep = 0;
- function doNextStep(manual)
- {
- if (!window.layoutTestController && !manual)
- return;
- if (currentStep < todo.length)
- setTimeout(function () { todo[currentStep++](); }, 0);
- else if (currentStep++ == todo.length)
- setTimeout(function () { finishJSTest(); }, 0);
- }
todo = [
function () {
shouldBe("document.webkitPointerLockElement", "null");
@@ -110,7 +100,7 @@
expectedTargetToBeLockedString = "targetdiv2";
},
];
- doNextStep();
+ doNextStepWithUserGesture();
</script>
<script src=""
</body>
Modified: trunk/LayoutTests/pointer-lock/lock-fail-responses.html (122157 => 122158)
--- trunk/LayoutTests/pointer-lock/lock-fail-responses.html 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/pointer-lock/lock-fail-responses.html 2012-07-09 21:19:26 UTC (rev 122158)
@@ -2,6 +2,7 @@
<html>
<head>
<script src=""
+<script src=""
</head>
<body>
<script>
@@ -9,10 +10,6 @@
window.jsTestIsAsync = true;
shouldBeDefined("window.testRunner");
- currentStep = 0;
- function doNextStep() {
- todo[currentStep++]();
- }
todo = [
function () {
testRunner.setPointerLockWillFailSynchronously();
@@ -23,7 +20,7 @@
},
function () {
testPassed("Lock failed (after we called testRunner.setPointerLockWillFailSynchronously)");
- doNextStep();
+ doNextStepWithUserGesture();
});
},
function () {
@@ -38,9 +35,8 @@
doNextStep();
});
},
- finishJSTest
];
- doNextStep();
+ doNextStepWithUserGesture();
</script>
<script src=""
</body>
Modified: trunk/LayoutTests/pointer-lock/mouse-event-delivery-expected.txt (122157 => 122158)
--- trunk/LayoutTests/pointer-lock/mouse-event-delivery-expected.txt 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/pointer-lock/mouse-event-delivery-expected.txt 2012-07-09 21:19:26 UTC (rev 122158)
@@ -32,5 +32,4 @@
PASS successfullyParsed is true
TEST COMPLETE
-doNextStep for manual testing
Modified: trunk/LayoutTests/pointer-lock/mouse-event-delivery.html (122157 => 122158)
--- trunk/LayoutTests/pointer-lock/mouse-event-delivery.html 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/pointer-lock/mouse-event-delivery.html 2012-07-09 21:19:26 UTC (rev 122158)
@@ -2,10 +2,10 @@
<html>
<head>
<script src=""
+<script src=""
</head>
<body id="body">
<div>
- <button _onclick_="doNextStep('manual');">doNextStep for manual testing</button>
<div id="target1"></div>
<div id="target2"></div>
</div>
@@ -22,7 +22,7 @@
{
testPassed("document.onwebkitpointerlockchange event received.");
shouldBe("document.webkitPointerLockElement", expectedTargetToBeLockedString);
- doNextStep('manual');
+ doNextStep();
};
document._onwebkitpointerlockerror_ =
function () { testFailed("document.onwebkitpointerlockerror event received."); finishJSTest(); };
@@ -35,16 +35,6 @@
testPassed("event type: " + e.type + ", target: " + e.target.id + ", received on: " + e.currentTarget.id);
}
- currentStep = 0;
- function doNextStep(manual)
- {
- if (!window.layoutTestController && !manual)
- return;
- if (currentStep < todo.length)
- setTimeout(function () { todo[currentStep++](); }, 0);
- else if (currentStep++ == todo.length)
- setTimeout(function () { finishJSTest(); }, 0);
- }
todo = [
function () {
targetdiv1.webkitRequestPointerLock();
@@ -61,7 +51,7 @@
window.eventSender.mouseDown();
window.eventSender.mouseUp();
}
- doNextStep();
+ doNextStepWithUserGesture();
},
function () {
targetdiv2.webkitRequestPointerLock();
@@ -78,7 +68,7 @@
window.eventSender.mouseDown();
window.eventSender.mouseUp();
}
- doNextStep();
+ doNextStepWithUserGesture();
},
function () {
debug(" Ensure double clicks work as expected, sending 4 clicks.")
@@ -103,10 +93,10 @@
window.eventSender.mouseDown();
window.eventSender.mouseUp();
}
- doNextStep();
+ doNextStepWithUserGesture();
},
];
- doNextStep();
+ doNextStepWithUserGesture();
</script>
<script src=""
</body>
Modified: trunk/LayoutTests/pointer-lock/pointer-lock-api-expected.txt (122157 => 122158)
--- trunk/LayoutTests/pointer-lock/pointer-lock-api-expected.txt 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/pointer-lock/pointer-lock-api-expected.txt 2012-07-09 21:19:26 UTC (rev 122158)
@@ -17,4 +17,4 @@
PASS successfullyParsed is true
TEST COMPLETE
-doNextStep for manual testing
+
Modified: trunk/LayoutTests/pointer-lock/pointer-lock-api.html (122157 => 122158)
--- trunk/LayoutTests/pointer-lock/pointer-lock-api.html 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/pointer-lock/pointer-lock-api.html 2012-07-09 21:19:26 UTC (rev 122158)
@@ -2,23 +2,13 @@
<html>
<head>
<script src=""
+<script src=""
</head>
<body>
-<button _onclick_="doNextStep('manual');">doNextStep for manual testing</button>
<script>
description("Basic API existence test for Pointer Lock.")
window.jsTestIsAsync = true;
- currentStep = 0;
- function doNextStep(manual)
- {
- if (!window.testRunner && !manual)
- return;
- if (currentStep < todo.length)
- setTimeout(function () { todo[currentStep++](); }, 0);
- else if (currentStep++ == todo.length)
- setTimeout(function () { finishJSTest(); }, 0);
- }
todo = [
function () {
shouldBeDefined("navigator.webkitPointer");
@@ -43,7 +33,7 @@
doNextStep();
},
];
- doNextStep();
+ doNextStepWithUserGesture();
</script>
<script src=""
</body>
Modified: trunk/LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt (122157 => 122158)
--- trunk/LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt 2012-07-09 21:19:26 UTC (rev 122158)
@@ -36,5 +36,4 @@
PASS successfullyParsed is true
TEST COMPLETE
-doNextStep for manual testing
Modified: trunk/LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events.html (122157 => 122158)
--- trunk/LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events.html 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events.html 2012-07-09 21:19:26 UTC (rev 122158)
@@ -2,10 +2,10 @@
<html>
<head>
<script src=""
+<script src=""
</head>
<body>
<div>
- <button _onclick_="doNextStep('manual');">doNextStep for manual testing</button>
<div id="target1"></div>
<div id="target2"></div>
<iframe id="iframe1"></iframe>
@@ -20,59 +20,11 @@
targetIframe1 = document.getElementById("iframe1");
targetIframe2 = document.getElementById("iframe2");
- function eventExpected(eventHandlerName, message, expectedCalls, targetHanderNode)
- {
- targetHanderNode[eventHandlerName] = function ()
- {
- switch (expectedCalls--) {
- case 0:
- testFailed(eventHandlerName + " received after: " + message);
- finishJSTest();
- break;
- case 1:
- doNextStep();
- default:
- testPassed(eventHandlerName + " received after: " + message);
- };
- };
- };
-
- function expectOnlyChangeEvent(message, targetDocument) {
- debug(" " + message);
- targetDocument = targetDocument !== undefined ? targetDocument : document;
- eventExpected("onwebkitpointerlockchange", message, 1, targetDocument);
- eventExpected("onwebkitpointerlockerror", message, 0, targetDocument);
- };
-
- function expectOnlyErrorEvent(message, targetDocument) {
- debug(" " + message);
- targetDocument = targetDocument !== undefined ? targetDocument : document;
- eventExpected("onwebkitpointerlockchange", message, 0, targetDocument);
- eventExpected("onwebkitpointerlockerror", message, 1, targetDocument);
- };
-
- function expectNoEvents(message, targetDocument) {
- debug(" " + message);
- targetDocument = targetDocument !== undefined ? targetDocument : document;
- eventExpected("onwebkitpointerlockchange", message, 0, targetDocument);
- eventExpected("onwebkitpointerlockerror", message, 0, targetDocument);
- };
-
- currentStep = 0;
- function doNextStep(manual)
- {
- if (!window.testRunner && !manual)
- return;
- if (currentStep < todo.length)
- setTimeout(function () { todo[currentStep++](); }, 0);
- else if (currentStep++ == todo.length)
- setTimeout(function () { finishJSTest(); }, 0);
- }
todo = [
function () {
expectNoEvents("Unlock.");
document.webkitExitPointerLock();
- doNextStep();
+ doNextStepWithUserGesture();
},
function () {
expectOnlyChangeEvent("Lock targetDiv1.");
Modified: trunk/LayoutTests/pointer-lock/pointerlocklost-event.html (122157 => 122158)
--- trunk/LayoutTests/pointer-lock/pointerlocklost-event.html 2012-07-09 21:19:16 UTC (rev 122157)
+++ trunk/LayoutTests/pointer-lock/pointerlocklost-event.html 2012-07-09 21:19:26 UTC (rev 122158)
@@ -2,6 +2,7 @@
<html>
<head>
<script src=""
+<script src=""
</head>
<body>
<div>
@@ -48,10 +49,6 @@
}
}
- currentStep = 0;
- function doNextStep() {
- setTimeout(function () { todo[currentStep++](); }, 0);
- }
todo = [
function () {
navigator.webkitPointer.lock(targetdiv,
@@ -74,7 +71,7 @@
// locklostHandler will catch unlocks and call doNextStep to bring us here.
shouldBe("document.webkitPointerLockElement", "null");
shouldBe("navigator.webkitPointer.isLocked", "false");
- doNextStep();
+ doNextStepWithUserGesture();
},
function () {
navigator.webkitPointer.lock(targetdiv,
@@ -100,9 +97,8 @@
shouldBe("document.webkitPointerLockElement", "null");
doNextStep();
},
- finishJSTest
];
- doNextStep();
+ doNextStepWithUserGesture();
</script>
<script src=""
</body>
Added: trunk/LayoutTests/pointer-lock/resources/pointer-lock-test-harness.js (0 => 122158)
--- trunk/LayoutTests/pointer-lock/resources/pointer-lock-test-harness.js (rev 0)
+++ trunk/LayoutTests/pointer-lock/resources/pointer-lock-test-harness.js 2012-07-09 21:19:26 UTC (rev 122158)
@@ -0,0 +1,64 @@
+// Automatically add doNextStepButton to document for manual tests.
+if (!window.testRunner) {
+ setTimeout(function () {
+ doNextStepButton = document.body.insertBefore(document.createElement("button"), document.body.firstChild);
+ doNextStepButton._onclick_ = doNextStep;
+ doNextStepButton.innerText = "doNextStep button for manual testing. Use keyboard to select button and press (TAB, then SPACE).";
+ }, 0);
+}
+
+function doNextStep()
+{
+ if (typeof(currentStep) == "undefined")
+ currentStep = 0;
+
+ if (currentStep < todo.length)
+ setTimeout(function () { todo[currentStep++](); }, 0);
+ else if (currentStep++ == todo.length)
+ setTimeout(function () { finishJSTest(); }, 0);
+}
+
+function doNextStepWithUserGesture()
+{
+ if (!window.testRunner)
+ return; // Wait for human to press doNextStep button.
+ doNextStep();
+}
+
+function eventExpected(eventHandlerName, message, expectedCalls, targetHanderNode)
+{
+ targetHanderNode[eventHandlerName] = function () {
+ switch (expectedCalls--) {
+ case 0:
+ testFailed(eventHandlerName + " received after: " + message);
+ finishJSTest();
+ break;
+ case 1:
+ doNextStep();
+ default:
+ testPassed(eventHandlerName + " received after: " + message);
+ };
+ };
+};
+
+function expectOnlyChangeEvent(message, targetDocument) {
+ debug(" " + message);
+ targetDocument = targetDocument !== undefined ? targetDocument : document;
+ eventExpected("onwebkitpointerlockchange", message, 1, targetDocument);
+ eventExpected("onwebkitpointerlockerror", message, 0, targetDocument);
+};
+
+function expectOnlyErrorEvent(message, targetDocument) {
+ debug(" " + message);
+ targetDocument = targetDocument !== undefined ? targetDocument : document;
+ eventExpected("onwebkitpointerlockchange", message, 0, targetDocument);
+ eventExpected("onwebkitpointerlockerror", message, 1, targetDocument);
+};
+
+function expectNoEvents(message, targetDocument) {
+ debug(" " + message);
+ targetDocument = targetDocument !== undefined ? targetDocument : document;
+ eventExpected("onwebkitpointerlockchange", message, 0, targetDocument);
+ eventExpected("onwebkitpointerlockerror", message, 0, targetDocument);
+};
+
Property changes on: trunk/LayoutTests/pointer-lock/resources/pointer-lock-test-harness.js
___________________________________________________________________
Added: svn:eol-style