Chromium Code Reviews| OLD | NEW | 
|---|---|
| 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 28 matching lines...) Expand all Loading... | |
| 39 function() { | 39 function() { | 
| 40 console.log("lock failed"); | 40 console.log("lock failed"); | 
| 41 if (callback) { | 41 if (callback) { | 
| 42 callback("failure"); | 42 callback("failure"); | 
| 43 } | 43 } | 
| 44 } | 44 } | 
| 45 ); | 45 ); | 
| 46 } | 46 } | 
| 47 | 47 | 
| 48 var lock_result1 = ""; | 48 var lock_result1 = ""; | 
| 49 // In the pyAuto test the fullscreen is initiated, accepted and enters into a wa it state | 49 // In the pyAuto test the fullscreen is initiated, accepted and enters into a | 
| 50 // reading the value of lock_result1. One of the two asynchronous functions in t he JS will | 50 // wait state reading the value of lock_result1. One of the two asynchronous | 
| 51 // be executed. The pyAuto code waits for lock_result to return "success" or "fa ilure". | 51 // functions in the JS will be executed. The pyAuto code waits for lock_result | 
| 52 // Sample pyAuto code: lock_result = self._driver.execute_script('lockMouse1AndS etLockResult()') | 52 // to return "success" or "failure". Sample pyAuto code: | 
| 53 // lock_result = self._driver.execute_script('lockMouse1AndSetLockResult()') | |
| 53 function lockMouse1AndSetLockResult() { | 54 function lockMouse1AndSetLockResult() { | 
| 54 console.log("lockMouse1AndSetLockResult()"); | 55 console.log("lockMouse1AndSetLockResult()"); | 
| 55 lock_result1 = ""; | 56 lock_result1 = ""; | 
| 56 navigator.webkitPointer.lock(document.getElementById("lockTarget1"), | 57 navigator.webkitPointer.lock(document.getElementById("lockTarget1"), | 
| 57 function() { | 58 function() { | 
| 58 console.log("lock success"); | 59 console.log("lock success"); | 
| 59 lock_result = "success" | 60 lock_result = "success" | 
| 60 }, | 61 }, | 
| 61 function() { | 62 function() { | 
| 62 console.log("lock failed"); | 63 console.log("lock failed"); | 
| 63 lock_result = "failure" | 64 lock_result = "failure" | 
| 64 } | 65 } | 
| 65 ); | 66 ); | 
| 66 } | 67 } | 
| 67 | 68 | 
| 69 // When mouse lock is initiated and accepted, PyAuto test will wait for the | |
| 70 // lock_result to return "success" or "failure" to initiate the next action. | |
| 68 function lockMouse2() { | 71 function lockMouse2() { | 
| 69 console.log("lockMouse2()"); | 72 console.log("lockMouse2()"); | 
| 70 navigator.webkitPointer.lock(document.getElementById("lockTarget2"), | 73 navigator.webkitPointer.lock(document.getElementById("lockTarget2"), | 
| 71 function(){console.log("lock success")}, | 74 function() { | 
| 72 function(){console.log("lock failed")}); | 75 console.log("lock success"); | 
| 76 lock_result = "success" | |
| 77 }, | |
| 78 function() { | |
| 79 console.log("lock failed") | |
| 80 lock_result = "failure" | |
| 81 } | |
| 82 ); | |
| 73 } | 83 } | 
| 74 | 84 | 
| 75 function delayedLockMouse1() { | 85 function delayedLockMouse1() { | 
| 76 console.log("delayedLockMouse1()"); | 86 console.log("delayedLockMouse1()"); | 
| 77 window.setTimeout(lockMouse1, 1010); | 87 window.setTimeout(lockMouse1, 1010); | 
| 78 // Delay must be over 1 second or the click that initiated the delayed action | 88 // Delay must be over 1 second or the click that initiated the delayed action | 
| 79 // may still be considered active and treat this as a user gesture. | 89 // may still be considered active and treat this as a user gesture. | 
| 80 // We want to test a lock not associated with a user gesture. | 90 // We want to test a lock not associated with a user gesture. | 
| 81 } | 91 } | 
| 82 | 92 | 
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 case "1": lockMouse1(); break; | 170 case "1": lockMouse1(); break; | 
| 161 case "2": lockMouse2(); break; | 171 case "2": lockMouse2(); break; | 
| 162 case "d": delayedLockMouse1(); break; | 172 case "d": delayedLockMouse1(); break; | 
| 163 case "u": unlockMouse(); break; | 173 case "u": unlockMouse(); break; | 
| 164 case "b": enterFullscreenAndLockMouse1(); break; | 174 case "b": enterFullscreenAndLockMouse1(); break; | 
| 165 case "B": lockMouse1AndEnterFullscreen(); break; | 175 case "B": lockMouse1AndEnterFullscreen(); break; | 
| 166 default: moveHTMLCursorToCenter(); break; | 176 default: moveHTMLCursorToCenter(); break; | 
| 167 } | 177 } | 
| 168 }); | 178 }); | 
| 169 } | 179 } | 
| 180 | |
| 170 </script> | 181 </script> | 
| 171 </head> | 182 </head> | 
| 172 <body onload="init()" title="This tooltip should not be shown if the mouse is lo cked."> | 183 <body onload="init()" title="This tooltip should not be shown if the mouse is lo cked."> | 
| 173 <div id="container"> | 184 <div id="container"> | 
| 174 <button id="enterFullscreen" onclick="enterFullscreen();">enterFullscreen() [f]</button><br> | 185 <button id="enterFullscreen" onclick="enterFullscreen();">enterFullscreen() [f]</button><br> | 
| 175 <button id="exitFullscreen" onclick="exitFullscreen();">exitFullscreen() [x] </button><br> | 186 <button id="exitFullscreen" onclick="exitFullscreen();">exitFullscreen() [x] </button><br> | 
| 176 <button id="lockMouse1" onclick="lockMouse1();">lockMouse1() [1]</button><br > | 187 <button id="lockMouse1" onclick="lockMouse1();">lockMouse1() [1]</button><br > | 
| 177 <button id="lockMouse2" onclick="lockMouse2();">lockMouse2() [2]</button><br > | 188 <button id="lockMouse2" onclick="lockMouse2();">lockMouse2() [2]</button><br > | 
| 178 <button id="delayedLockMouse1" onclick="delayedLockMouse1();">delayedLockMou se1() [d]</button><br> | 189 <button id="delayedLockMouse1" onclick="delayedLockMouse1();">delayedLockMou se1() [d]</button><br> | 
| 179 <button id="spamLockMouse2" onclick="spamLockMouse2();">spamLockMouse2()</bu tton><br> | 190 <button id="spamLockMouse2" onclick="spamLockMouse2();">spamLockMouse2()</bu tton><br> | 
| 180 <button id="unlockMouse" onclick="unlockMouse();">unlockMouse() [u]</button> <br> | 191 <button id="unlockMouse" onclick="unlockMouse();">unlockMouse() [u]</button> <br> | 
| 181 <button id="enterFullscreenAndLockMouse1" onclick="enterFullscreenAndLockMou se1()">enterFullscreenAndLockMouse1() [b]</button><br> | 192 <button id="enterFullscreenAndLockMouse1" onclick="enterFullscreenAndLockMou se1()">enterFullscreenAndLockMouse1() [b]</button><br> | 
| 182 <button id="lockMouse1AndEnterFullscreen" onclick="lockMouse1AndEnterFullscr een()">lockMouse1AndEnterFullscreen() [B]</button><br> | 193 <button id="lockMouse1AndEnterFullscreen" onclick="lockMouse1AndEnterFullscr een()">lockMouse1AndEnterFullscreen() [B]</button><br> | 
| 183 <div id="lockTarget1">lockTarget1</div> | 194 <div id="lockTarget1">lockTarget1</div> | 
| 184 <div id="lockTarget2">lockTarget2</div> | 195 <div id="lockTarget2">lockTarget2</div> | 
| 185 <form name="HTMLCursor" id="HTMLCursor">HTMLCursor</form> | 196 <form name="HTMLCursor" id="HTMLCursor">HTMLCursor</form> | 
| 186 <form name="displaytext">...</form> | 197 <form name="displaytext">...</form> | 
| 198 <p>The <a href="#anchor" name="anchor" id="anchor">anchor link</a> navigates to | |
| 
 
Nirnimesh
2012/06/18 22:23:03
stick to 80 chars per line
 
dyu1
2012/06/18 23:06:18
Made all the changes to conform to 80 chars per li
 
 | |
| 199 an anchor on this page. The browser should not exit tab fullscreen or mouse lock.</p> | |
| 187 </div> | 200 </div> | 
| 188 This text is outside of the container that is made fullscreen. This text shoul d not be visible when fullscreen. | 201 <p>This text is outside of the container that is made fullscreen. This text sh ould not be visible when fullscreen.</p> | 
| 189 </body> | 202 </body> | 
| 190 </html> | 203 </html> | 
| OLD | NEW |