Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>Pointer Events pointer lock tests</title> | |
| 5 <meta name="viewport" content="width=device-width"> | |
| 6 <link rel="stylesheet" type="text/css" href="../pointerevent_styles.css" > | |
| 7 <script src="/resources/testharness.js"></script> | |
| 8 <script src="/resources/testharnessreport.js"></script> | |
| 9 <!-- Additional helper script for common checks across event types --> | |
| 10 <script type="text/javascript" src="../pointerevent_support.js"></script > | |
| 11 <script> | |
| 12 var capture_count = 0; | |
| 13 var mouse_down_count = 0; | |
| 14 | |
| 15 function resetTestState() { | |
| 16 } | |
| 17 | |
| 18 function run() { | |
| 19 var test_pointerEvent = setup_pointerevent_test("no pointercaptu re while pointerlock", ['mouse']); | |
| 20 var div1 = document.getElementById("div1"); | |
| 21 var div2 = document.getElementById("div2"); | |
| 22 | |
| 23 on_event(div1, 'pointerdown', function(event) { | |
| 24 mouse_down_count++; | |
| 25 if (mouse_down_count == 1) { | |
| 26 div1.requestPointerLock(); | |
| 27 } else { | |
| 28 try { | |
| 29 div2.setPointerCapture(event.pointerId); | |
| 30 test_pointerEvent.step(function () { | |
| 31 assert_true(false, "DOMException: InvalidStateEr ror should have been thrown."); | |
|
Navid Zolghadr
2017/05/17 16:30:10
There is another function called assert_unreached
lanwei
2017/05/19 15:05:00
Acknowledged.
| |
| 32 }); | |
| 33 } catch (e) { | |
| 34 test_pointerEvent.step(function () { | |
| 35 assert_equals(e.name, "InvalidStateError", "DOME xception should be InvalidStateError"); | |
| 36 assert_equals(capture_count, 0, "no capture"); | |
| 37 }); | |
| 38 } | |
| 39 test_pointerEvent.done(); | |
| 40 } | |
| 41 }); | |
| 42 on_event(div2, 'gotpointercapture', function(event) { | |
| 43 capture_count++; | |
| 44 }); | |
| 45 on_event(div2, 'lostpointercapture', function(event) { | |
| 46 capture_count++; | |
| 47 }); | |
| 48 on_event(document, 'pointerlockchange', function(event) { | |
| 49 test_pointerEvent.step(function() { | |
| 50 assert_equals(document.pointerLockElement, div1, "docume nt.pointerLockElement should be div1."); | |
| 51 }); | |
| 52 }); | |
| 53 } | |
| 54 </script> | |
| 55 </head> | |
| 56 <body onload="run()"> | |
| 57 <h1>Pointer Events pointer lock test</h1> | |
| 58 <h2 id="pointerTypeDescription"></h2> | |
| 59 <h4> | |
| 60 Test Description: This test checks that we do not set the pointer ca pture when any element in the page gets a pointer lock. | |
| 61 <ol> | |
| 62 <li>Press left button down on the blue rectangle and hold it.</ li> | |
|
Navid Zolghadr
2017/05/17 16:30:10
ditto
| |
| 63 <li>Press middle button down on the blue rectangle and hold it. </li> | |
| 64 </ol> | |
| 65 | |
| 66 Test passes if the pointer capture is not set when the blue rectangl e gets the pointer lock. | |
| 67 </h4> | |
| 68 <div id="testContainer"> | |
| 69 <div id="div1" style="width:800px;height:250px;background:green"></d iv> | |
| 70 <div id="div2" style="width:800px;height:250px;background:yellow"></ div> | |
| 71 </div> | |
| 72 <div class="spacer"></div> | |
| 73 </body> | |
| 74 </html> | |
| OLD | NEW |