Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: chrome/test/data/fullscreen_mouselock/fullscreen_mouselock.html

Issue 438693003: Use the unprefixed Pointer Lock API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/pointerlock/inject_pointer_lock.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Fullscreen and Mouse Lock Scripts</title> 4 <title>Fullscreen and Mouse Lock Scripts</title>
5 <style type="text/css"> 5 <style type="text/css">
6 #HTMLCursor { 6 #HTMLCursor {
7 border: solid black 1px; 7 border: solid black 1px;
8 background: yellow; 8 background: yellow;
9 display: inline; 9 display: inline;
10 position: absolute; 10 position: absolute;
(...skipping 20 matching lines...) Expand all
31 console.log("lockMouse1()"); 31 console.log("lockMouse1()");
32 var target = document.getElementById("lockTarget1"); 32 var target = document.getElementById("lockTarget1");
33 33
34 function failure() { 34 function failure() {
35 console.log("lock failed"); 35 console.log("lock failed");
36 if (callback) { 36 if (callback) {
37 callback("failure"); 37 callback("failure");
38 } 38 }
39 }; 39 };
40 function possibleSuccess() { 40 function possibleSuccess() {
41 if (document.webkitPointerLockElement == target) { 41 if (document.pointerLockElement == target) {
42 console.log("lock success"); 42 console.log("lock success");
43 if (callback) 43 if (callback)
44 callback("success"); 44 callback("success");
45 } else { 45 } else {
46 failure(); 46 failure();
47 } 47 }
48 }; 48 };
49 document.onwebkitpointerlockchange = possibleSuccess; 49 document.onpointerlockchange = possibleSuccess;
50 document.onwebkitpointerlockerror = failure; 50 document.onpointerlockerror = failure;
51 target.webkitRequestPointerLock(); 51 target.requestPointerLock();
52 } 52 }
53 53
54 // In the PyAuto test the fullscreen is initiated, accepted and enters into a 54 // In the PyAuto test the fullscreen is initiated, accepted and enters into a
55 // wait state reading the value of lock_result. One of the two asynchronous 55 // wait state reading the value of lock_result. One of the two asynchronous
56 // functions in the JS will be executed. The PyAuto code waits for lock_result 56 // functions in the JS will be executed. The PyAuto code waits for lock_result
57 // to return "success" or "failure". Sample PyAuto code: 57 // to return "success" or "failure". Sample PyAuto code:
58 // lock_result = self._driver.execute_script('lockMouse1AndSetLockResult()') 58 // lock_result = self._driver.execute_script('lockMouse1AndSetLockResult()')
59 function lockMouseAndSetLockResult(targetId) { 59 function lockMouseAndSetLockResult(targetId) {
60 var target = document.getElementById(targetId); 60 var target = document.getElementById(targetId);
61 lock_result = ""; 61 lock_result = "";
62 62
63 function failure() { 63 function failure() {
64 console.log("lock failed"); 64 console.log("lock failed");
65 lock_result = "failure" 65 lock_result = "failure"
66 }; 66 };
67 function possibleSuccess() { 67 function possibleSuccess() {
68 if (document.webkitPointerLockElement == target) { 68 if (document.pointerLockElement == target) {
69 console.log("lock success"); 69 console.log("lock success");
70 lock_result = "success" 70 lock_result = "success"
71 } else { 71 } else {
72 failure(); 72 failure();
73 } 73 }
74 }; 74 };
75 document.onwebkitpointerlockchange = possibleSuccess; 75 document.onpointerlockchange = possibleSuccess;
76 document.onwebkitpointerlockerror = failure; 76 document.onpointerlockerror = failure;
77 target.webkitRequestPointerLock(); 77 target.requestPointerLock();
78 } 78 }
79 79
80 function lockMouse1AndSetLockResult() { 80 function lockMouse1AndSetLockResult() {
81 console.log("lockMouse1AndSetLockResult()"); 81 console.log("lockMouse1AndSetLockResult()");
82 lockMouseAndSetLockResult("lockTarget1"); 82 lockMouseAndSetLockResult("lockTarget1");
83 } 83 }
84 84
85 // When mouse lock is initiated and accepted, PyAuto test will wait for the 85 // When mouse lock is initiated and accepted, PyAuto test will wait for the
86 // lock_result to return "success" or "failure" to initiate the next action. 86 // lock_result to return "success" or "failure" to initiate the next action.
87 function lockMouse2() { 87 function lockMouse2() {
88 console.log("lockMouse2()"); 88 console.log("lockMouse2()");
89 lockMouseAndSetLockResult("lockTarget2"); 89 lockMouseAndSetLockResult("lockTarget2");
90 } 90 }
91 91
92 function delayedLockMouse1() { 92 function delayedLockMouse1() {
93 console.log("delayedLockMouse1()"); 93 console.log("delayedLockMouse1()");
94 window.setTimeout(lockMouse1, 1010); 94 window.setTimeout(lockMouse1, 1010);
95 // Delay must be over 1 second or the click that initiated the delayed action 95 // Delay must be over 1 second or the click that initiated the delayed action
96 // may still be considered active and treat this as a user gesture. 96 // may still be considered active and treat this as a user gesture.
97 // We want to test a lock not associated with a user gesture. 97 // We want to test a lock not associated with a user gesture.
98 } 98 }
99 99
100 function spamLockMouse2() { 100 function spamLockMouse2() {
101 console.log("spamLockMouse2()") 101 console.log("spamLockMouse2()")
102 window.setInterval(lockMouse2, 111); 102 window.setInterval(lockMouse2, 111);
103 } 103 }
104 104
105 function unlockMouse() { 105 function unlockMouse() {
106 console.log("unlockMouse()"); 106 console.log("unlockMouse()");
107 document.webkitExitPointerLock(); 107 document.exitPointerLock();
108 } 108 }
109 109
110 function enterFullscreenAndLockMouse1() { 110 function enterFullscreenAndLockMouse1() {
111 console.log("enterFullscreenAndLockMouse1()"); 111 console.log("enterFullscreenAndLockMouse1()");
112 enterFullscreen(); 112 enterFullscreen();
113 lockMouse1(); 113 lockMouse1();
114 } 114 }
115 115
116 function lockMouse1AndEnterFullscreen() { 116 function lockMouse1AndEnterFullscreen() {
117 console.log("lockMouse1AndEnterFullscreen()"); 117 console.log("lockMouse1AndEnterFullscreen()");
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 onclick="clickElement(this.id);"> 232 onclick="clickElement(this.id);">
233 anchor link 233 anchor link
234 </a> 234 </a>
235 navigates to an anchor on this page. The browser should not exit tab 235 navigates to an anchor on this page. The browser should not exit tab
236 fullscreen or mouse lock.</p> 236 fullscreen or mouse lock.</p>
237 </div> 237 </div>
238 <p>This text is outside of the container that is made fullscreen. This text 238 <p>This text is outside of the container that is made fullscreen. This text
239 should not be visible when fullscreen.</p> 239 should not be visible when fullscreen.</p>
240 </body> 240 </body>
241 </html> 241 </html>
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/pointerlock/inject_pointer_lock.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698