OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
5 <script src="../http/tests/resources/pointer-lock/pointer-lock-test-harness.js">
</script> | 5 <script src="../http/tests/resources/pointer-lock/pointer-lock-test-harness.js">
</script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <div> | 8 <div> |
9 <div id="target1"></div> | 9 <div id="target1"></div> |
10 <div id="target2"></div> | 10 <div id="target2"></div> |
(...skipping 13 matching lines...) Expand all Loading... |
24 function errorIfEventsBubble() { | 24 function errorIfEventsBubble() { |
25 testFailed("Events must not bubble to the window."); | 25 testFailed("Events must not bubble to the window."); |
26 finishJSTest(); | 26 finishJSTest(); |
27 } | 27 } |
28 window.addEventListener("webkitpointerlockchange", errorIfEventsBubble); | 28 window.addEventListener("webkitpointerlockchange", errorIfEventsBubble); |
29 window.addEventListener("webkitpointerlockerror", errorIfEventsBubble); | 29 window.addEventListener("webkitpointerlockerror", errorIfEventsBubble); |
30 | 30 |
31 todo = [ | 31 todo = [ |
32 function () { | 32 function () { |
33 expectNoEvents("Unlock."); | 33 expectNoEvents("Unlock."); |
34 document.webkitExitPointerLock(); | 34 document.exitPointerLock(); |
35 doNextStepWithUserGesture(); | 35 doNextStepWithUserGesture(); |
36 }, | 36 }, |
37 function () { | 37 function () { |
38 expectOnlyChangeEvent("Lock targetDiv1."); | 38 expectOnlyChangeEvent("Lock targetDiv1."); |
39 targetDiv1.requestPointerLock(); | 39 targetDiv1.requestPointerLock(); |
40 }, | 40 }, |
41 function () { | 41 function () { |
42 expectOnlyChangeEvent("Unlock again."); | 42 expectOnlyChangeEvent("Unlock again."); |
43 document.webkitExitPointerLock(); | 43 document.exitPointerLock(); |
44 }, | 44 }, |
45 function () { | 45 function () { |
46 expectOnlyChangeEvent("Lock targetDiv1 again."); | 46 expectOnlyChangeEvent("Lock targetDiv1 again."); |
47 targetDiv1.requestPointerLock(); | 47 targetDiv1.requestPointerLock(); |
48 }, | 48 }, |
49 function () { | 49 function () { |
50 expectOnlyChangeEvent("Lock targetDiv2."); | 50 expectOnlyChangeEvent("Lock targetDiv2."); |
51 targetDiv2.requestPointerLock(); | 51 targetDiv2.requestPointerLock(); |
52 }, | 52 }, |
53 function () { | 53 function () { |
54 expectOnlyChangeEvent("Lock targetDiv2 again."); | 54 expectOnlyChangeEvent("Lock targetDiv2 again."); |
55 targetDiv2.requestPointerLock(); | 55 targetDiv2.requestPointerLock(); |
56 }, | 56 }, |
57 function () { | 57 function () { |
58 expectOnlyChangeEvent("Unlock targetDiv2."); | 58 expectOnlyChangeEvent("Unlock targetDiv2."); |
59 document.webkitExitPointerLock(); | 59 document.exitPointerLock(); |
60 }, | 60 }, |
61 function () { | 61 function () { |
62 targetIframe1.src = "about:blank"; | 62 targetIframe1.src = "about:blank"; |
63 targetIframe1.onload = function () { doNextStep(); } | 63 targetIframe1.onload = function () { doNextStep(); } |
64 }, | 64 }, |
65 function () { | 65 function () { |
66 targetIframe2.src = "about:blank"; | 66 targetIframe2.src = "about:blank"; |
67 targetIframe2.onload = function () { doNextStep(); } | 67 targetIframe2.onload = function () { doNextStep(); } |
68 }, | 68 }, |
69 function () { | 69 function () { |
70 expectNoEvents("Lock targetIframe1."); | 70 expectNoEvents("Lock targetIframe1."); |
71 expectOnlyChangeEvent("Lock targetIframe1 (handler for iframe1).", t
argetIframe1.contentDocument); | 71 expectOnlyChangeEvent("Lock targetIframe1 (handler for iframe1).", t
argetIframe1.contentDocument); |
72 targetIframe1.contentDocument.body.requestPointerLock(); | 72 targetIframe1.contentDocument.body.requestPointerLock(); |
73 }, | 73 }, |
74 function () { | 74 function () { |
75 expectNoEvents("Lock targetIframe2."); | 75 expectNoEvents("Lock targetIframe2."); |
76 expectNoEvents("Lock targetIframe2 (handler for iframe1).", targetIf
rame1.contentDocument); | 76 expectNoEvents("Lock targetIframe2 (handler for iframe1).", targetIf
rame1.contentDocument); |
77 expectOnlyErrorEvent("Lock targetIframe2 (handler for iframe2).", ta
rgetIframe2.contentDocument); | 77 expectOnlyErrorEvent("Lock targetIframe2 (handler for iframe2).", ta
rgetIframe2.contentDocument); |
78 targetIframe2.contentDocument.body.requestPointerLock(); | 78 targetIframe2.contentDocument.body.requestPointerLock(); |
79 }, | 79 }, |
80 function () { | 80 function () { |
81 expectNoEvents("Unlock targetIframe2."); | 81 expectNoEvents("Unlock targetIframe2."); |
82 expectOnlyChangeEvent("Unlock targetIframe2 (handler for iframe1).",
targetIframe1.contentDocument); | 82 expectOnlyChangeEvent("Unlock targetIframe2 (handler for iframe1).",
targetIframe1.contentDocument); |
83 expectNoEvents("Unlock targetIframe2 (handler for iframe2).", target
Iframe2.contentDocument); | 83 expectNoEvents("Unlock targetIframe2 (handler for iframe2).", target
Iframe2.contentDocument); |
84 targetIframe1.contentDocument.webkitExitPointerLock(); | 84 targetIframe1.contentDocument.exitPointerLock(); |
85 }, | 85 }, |
86 function () { | 86 function () { |
87 shouldBeDefined("testRunner.setPointerLockWillFailSynchronously"); | 87 shouldBeDefined("testRunner.setPointerLockWillFailSynchronously"); |
88 testRunner.setPointerLockWillFailSynchronously(); | 88 testRunner.setPointerLockWillFailSynchronously(); |
89 expectOnlyErrorEvent("Lock with synchronous failure."); | 89 expectOnlyErrorEvent("Lock with synchronous failure."); |
90 targetDiv1.requestPointerLock(); | 90 targetDiv1.requestPointerLock(); |
91 }, | 91 }, |
92 function () { | 92 function () { |
93 shouldBeDefined("testRunner.setPointerLockWillRespondAsynchronously"
); | 93 shouldBeDefined("testRunner.setPointerLockWillRespondAsynchronously"
); |
94 shouldBeDefined("testRunner.didAcquirePointerLock"); | 94 shouldBeDefined("testRunner.didAcquirePointerLock"); |
(...skipping 13 matching lines...) Expand all Loading... |
108 doNextStep(); | 108 doNextStep(); |
109 }, | 109 }, |
110 function () { | 110 function () { |
111 testRunner.didAcquirePointerLock(); | 111 testRunner.didAcquirePointerLock(); |
112 }, | 112 }, |
113 ]; | 113 ]; |
114 doNextStep(); | 114 doNextStep(); |
115 </script> | 115 </script> |
116 </body> | 116 </body> |
117 </html> | 117 </html> |
OLD | NEW |