Changeset 122158 in webkit


Ignore:
Timestamp:
Jul 9, 2012 2:19:26 PM (12 years ago)
Author:
scheib@chromium.org
Message:

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):

Location:
trunk/LayoutTests
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r122152 r122158  
     12012-07-09  Vincent Scheib  <scheib@chromium.org>
     2
     3        Refactor common Pointer Lock test code to a harness.
     4        https://bugs.webkit.org/show_bug.cgi?id=90813
     5
     6        Reviewed by Adrienne Walker.
     7
     8        * pointer-lock/bug90391-move-then-window-open-crash-expected.txt:
     9        * pointer-lock/bug90391-move-then-window-open-crash.html:
     10        * pointer-lock/lock-already-locked-expected.txt:
     11        * pointer-lock/lock-already-locked.html:
     12        * pointer-lock/lock-fail-responses-expected.txt:
     13        * pointer-lock/lock-fail-responses.html:
     14        * pointer-lock/mouse-event-delivery-expected.txt:
     15        * pointer-lock/mouse-event-delivery.html:
     16        * pointer-lock/pointer-lock-api-expected.txt:
     17        * pointer-lock/pointer-lock-api.html:
     18        * pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt:
     19        * pointer-lock/pointerlockchange-pointerlockerror-events.html:
     20        * pointer-lock/pointerlocklost-event-expected.txt:
     21        * pointer-lock/pointerlocklost-event.html:
     22        * pointer-lock/resources/pointer-lock-test-harness.js: Added.
     23        (doNextStep.else):
     24        (doNextStepWithUserGesture):
     25        (eventExpected.targetHanderNode.eventHandlerName):
     26        (eventExpected):
     27        (expectOnlyChangeEvent):
     28        (expectOnlyErrorEvent):
     29        (expectNoEvents):
     30
    1312012-07-09  Dean Jackson  <dino@apple.com>
    232
  • trunk/LayoutTests/pointer-lock/bug90391-move-then-window-open-crash-expected.txt

    r121909 r122158  
    1212
    1313TEST COMPLETE
    14 doNextStep for manual testing
    1514
  • trunk/LayoutTests/pointer-lock/bug90391-move-then-window-open-crash.html

    r121909 r122158  
    33<head>
    44<script src="../fast/js/resources/js-test-pre.js"></script>
     5<script src="resources/pointer-lock-test-harness.js"></script>
    56</head>
    67<body>
    78<div>
    8   <button onclick="doNextStep('manual');">doNextStep for manual testing</button>
    99  <div id="target1"></div>
    1010</div>
     
    1515    targetdiv1 = document.getElementById("target1");
    1616
    17     currentStep = 0;
    18     function doNextStep(manual)
    19     {
    20         if (!window.layoutTestController && !manual)
    21             return;
    22         if (currentStep < todo.length)
    23             setTimeout(function () { todo[currentStep++](); }, 0);
    24         else if (currentStep++ == todo.length)
    25             setTimeout(function () { finishJSTest(); }, 0);
    26     }
    2717    todo = [
    2818        function () {
     
    3222                document.onwebkitpointerlockchange = null;
    3323                testPassed("document.onwebkitpointerlockchange event received.");
    34                 doNextStep('manual');
     24                doNextStep();
    3525            };
    3626        },
     
    4131                if (++mouseMoveEvents == 2) {
    4232                    targetdiv1.onmousemove = null;
    43                     doNextStep('manual');
     33                    doNextStep();
    4434                }
    4535            }
     
    5545            testPassed("Didn't crash");
    5646            document.webkitExitPointerLock();
    57             doNextStep('manual');
     47            doNextStep();
    5848        },
    5949    ];
    60     doNextStep();
     50    doNextStepWithUserGesture();
    6151</script>
    6252<script src="../fast/js/resources/js-test-post.js"></script>
  • trunk/LayoutTests/pointer-lock/lock-already-locked-expected.txt

    r120486 r122158  
    3232
    3333TEST COMPLETE
    34 doNextStep for manual testing
    3534
  • trunk/LayoutTests/pointer-lock/lock-already-locked.html

    r120486 r122158  
    33<head>
    44<script src="../fast/js/resources/js-test-pre.js"></script>
     5<script src="resources/pointer-lock-test-harness.js"></script>
    56</head>
    67<body>
    78<div>
    8   <button onclick="doNextStep('manual');">doNextStep for manual testing</button>
    99  <div id="target1"></div>
    1010  <div id="target2"></div>
     
    2323            testPassed("document.onwebkitpointerlockchange event received.");
    2424            shouldBe("document.webkitPointerLockElement", expectedTargetToBeLockedString);
    25             doNextStep();
     25            doNextStepWithUserGesture();
    2626        };
    2727    document.onwebkitpointerlockerror =
     
    3636        function () { shouldBe("expectTarget2Unlock", "true"); });
    3737
    38     currentStep = 0;
    39     function doNextStep(manual)
    40     {
    41         if (!window.layoutTestController && !manual)
    42             return;
    43         if (currentStep < todo.length)
    44             setTimeout(function () { todo[currentStep++](); }, 0);
    45         else if (currentStep++ == todo.length)
    46             setTimeout(function () { finishJSTest(); }, 0);
    47     }
    4838    todo = [
    4939        function () {
     
    111101        },
    112102    ];
    113     doNextStep();
     103    doNextStepWithUserGesture();
    114104</script>
    115105<script src="../fast/js/resources/js-test-post.js"></script>
  • trunk/LayoutTests/pointer-lock/lock-fail-responses.html

    r120417 r122158  
    33<head>
    44<script src="../fast/js/resources/js-test-pre.js"></script>
     5<script src="resources/pointer-lock-test-harness.js"></script>
    56</head>
    67<body>
     
    1011    shouldBeDefined("window.testRunner");
    1112
    12     currentStep = 0;
    13     function doNextStep() {
    14       todo[currentStep++]();
    15     }
    1613    todo = [
    1714        function () {
     
    2421                function () {
    2522                    testPassed("Lock failed (after we called testRunner.setPointerLockWillFailSynchronously)");
    26                     doNextStep();
     23                    doNextStepWithUserGesture();
    2724                });
    2825        },
     
    3936                });
    4037        },
    41         finishJSTest
    4238    ];
    43     doNextStep();
     39    doNextStepWithUserGesture();
    4440</script>
    4541<script src="../fast/js/resources/js-test-post.js"></script>
  • trunk/LayoutTests/pointer-lock/mouse-event-delivery-expected.txt

    r120486 r122158  
    3333
    3434TEST COMPLETE
    35 doNextStep for manual testing
    3635
  • trunk/LayoutTests/pointer-lock/mouse-event-delivery.html

    r120486 r122158  
    33<head>
    44<script src="../fast/js/resources/js-test-pre.js"></script>
     5<script src="resources/pointer-lock-test-harness.js"></script>
    56</head>
    67<body id="body">
    78<div>
    8   <button onclick="doNextStep('manual');">doNextStep for manual testing</button>
    99  <div id="target1"></div>
    1010  <div id="target2"></div>
     
    2323            testPassed("document.onwebkitpointerlockchange event received.");
    2424            shouldBe("document.webkitPointerLockElement", expectedTargetToBeLockedString);
    25             doNextStep('manual');
     25            doNextStep();
    2626        };
    2727    document.onwebkitpointerlockerror =
     
    3636    }
    3737
    38     currentStep = 0;
    39     function doNextStep(manual)
    40     {
    41         if (!window.layoutTestController && !manual)
    42             return;
    43         if (currentStep < todo.length)
    44             setTimeout(function () { todo[currentStep++](); }, 0);
    45         else if (currentStep++ == todo.length)
    46             setTimeout(function () { finishJSTest(); }, 0);
    47     }
    4838    todo = [
    4939        function () {
     
    6252                window.eventSender.mouseUp();
    6353            }
    64             doNextStep();
     54            doNextStepWithUserGesture();
    6555        },
    6656        function () {
     
    7969                window.eventSender.mouseUp();
    8070            }
    81             doNextStep();
     71            doNextStepWithUserGesture();
    8272        },
    8373        function () {
     
    10494                window.eventSender.mouseUp();
    10595            }
    106             doNextStep();
     96            doNextStepWithUserGesture();
    10797        },
    10898    ];
    109     doNextStep();
     99    doNextStepWithUserGesture();
    110100</script>
    111101<script src="../fast/js/resources/js-test-post.js"></script>
  • trunk/LayoutTests/pointer-lock/pointer-lock-api-expected.txt

    r120486 r122158  
    1818
    1919TEST COMPLETE
    20 doNextStep for manual testing
     20
  • trunk/LayoutTests/pointer-lock/pointer-lock-api.html

    r120486 r122158  
    33<head>
    44<script src="../fast/js/resources/js-test-pre.js"></script>
     5<script src="resources/pointer-lock-test-harness.js"></script>
    56</head>
    67<body>
    7 <button onclick="doNextStep('manual');">doNextStep for manual testing</button>
    88<script>
    99    description("Basic API existence test for Pointer Lock.")
    1010    window.jsTestIsAsync = true;
    1111
    12     currentStep = 0;
    13     function doNextStep(manual)
    14     {
    15         if (!window.testRunner && !manual)
    16             return;
    17         if (currentStep < todo.length)
    18             setTimeout(function () { todo[currentStep++](); }, 0);
    19         else if (currentStep++ == todo.length)
    20             setTimeout(function () { finishJSTest(); }, 0);
    21     }
    2212    todo = [
    2313        function () {
     
    4434        },
    4535    ];
    46     doNextStep();
     36    doNextStepWithUserGesture();
    4737</script>
    4838<script src="../fast/js/resources/js-test-post.js"></script>
  • trunk/LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt

    r120486 r122158  
    3737
    3838TEST COMPLETE
    39 doNextStep for manual testing
    4039 
  • trunk/LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events.html

    r120486 r122158  
    33<head>
    44<script src="../fast/js/resources/js-test-pre.js"></script>
     5<script src="resources/pointer-lock-test-harness.js"></script>
    56</head>
    67<body>
    78<div>
    8   <button onclick="doNextStep('manual');">doNextStep for manual testing</button>
    99  <div id="target1"></div>
    1010  <div id="target2"></div>
     
    2121    targetIframe2 = document.getElementById("iframe2");
    2222
    23     function eventExpected(eventHandlerName, message, expectedCalls, targetHanderNode)
    24     {
    25         targetHanderNode[eventHandlerName] = function ()
    26             {
    27                 switch (expectedCalls--) {
    28                 case 0:
    29                     testFailed(eventHandlerName + " received after: " + message);
    30                     finishJSTest();
    31                     break;
    32                 case 1:
    33                     doNextStep();
    34                 default:
    35                     testPassed(eventHandlerName + " received after: " + message);
    36                 };
    37             };
    38     };
    39 
    40     function expectOnlyChangeEvent(message, targetDocument) {
    41         debug("     " + message);
    42         targetDocument = targetDocument !== undefined ? targetDocument : document;
    43         eventExpected("onwebkitpointerlockchange", message, 1, targetDocument);
    44         eventExpected("onwebkitpointerlockerror", message, 0, targetDocument);
    45     };
    46 
    47     function expectOnlyErrorEvent(message, targetDocument) {
    48         debug("     " + message);
    49         targetDocument = targetDocument !== undefined ? targetDocument : document;
    50         eventExpected("onwebkitpointerlockchange", message, 0, targetDocument);
    51         eventExpected("onwebkitpointerlockerror", message, 1, targetDocument);
    52     };
    53 
    54     function expectNoEvents(message, targetDocument) {
    55         debug("     " + message);
    56         targetDocument = targetDocument !== undefined ? targetDocument : document;
    57         eventExpected("onwebkitpointerlockchange", message, 0, targetDocument);
    58         eventExpected("onwebkitpointerlockerror", message, 0, targetDocument);
    59     };
    60 
    61     currentStep = 0;
    62     function doNextStep(manual)
    63     {
    64         if (!window.testRunner && !manual)
    65             return;
    66         if (currentStep < todo.length)
    67             setTimeout(function () { todo[currentStep++](); }, 0);
    68         else if (currentStep++ == todo.length)
    69             setTimeout(function () { finishJSTest(); }, 0);
    70     }
    7123    todo = [
    7224        function () {
    7325            expectNoEvents("Unlock.");
    7426            document.webkitExitPointerLock();
    75             doNextStep();
     27            doNextStepWithUserGesture();
    7628        },
    7729        function () {
  • trunk/LayoutTests/pointer-lock/pointerlocklost-event.html

    r120417 r122158  
    33<head>
    44<script src="../fast/js/resources/js-test-pre.js"></script>
     5<script src="resources/pointer-lock-test-harness.js"></script>
    56</head>
    67<body>
     
    4950    }
    5051
    51     currentStep = 0;
    52     function doNextStep() {
    53       setTimeout(function () { todo[currentStep++](); }, 0);
    54     }
    5552    todo = [
    5653        function () {
     
    7572            shouldBe("document.webkitPointerLockElement", "null");
    7673            shouldBe("navigator.webkitPointer.isLocked", "false");
    77             doNextStep();
     74            doNextStepWithUserGesture();
    7875        },
    7976        function () {
     
    10198            doNextStep();
    10299        },
    103         finishJSTest
    104100    ];
    105     doNextStep();
     101    doNextStepWithUserGesture();
    106102</script>
    107103<script src="../fast/js/resources/js-test-post.js"></script>
Note: See TracChangeset for help on using the changeset viewer.