| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> |
| 4 <script src="../resources/mojo-helpers.js"></script> |
| 5 <script src="resources/fake-vr-displays.js"></script> |
| 6 <script src="resources/mock-vr-service.js"></script> |
| 7 <script> |
| 8 let fakeDisplays = fakeVRDisplays(); |
| 9 |
| 10 vr_test( (t) => { |
| 11 return navigator.getVRDisplays().then( (displays) => { |
| 12 let display = displays[0]; |
| 13 let canFinish = false; |
| 14 let counter = 0; |
| 15 |
| 16 function onAnimationFrame() { |
| 17 display.requestAnimationFrame(onAnimationFrame); |
| 18 if (counter > 10) { |
| 19 t.done(); |
| 20 } |
| 21 if (counter > 0) { |
| 22 counter++; |
| 23 } |
| 24 if (canFinish) { |
| 25 canFinish = false; |
| 26 counter++; |
| 27 } |
| 28 } |
| 29 |
| 30 let handle = display.requestAnimationFrame(onAnimationFrame); |
| 31 display.cancelAnimationFrame(0); |
| 32 display.cancelAnimationFrame(-1); |
| 33 display.cancelAnimationFrame(handle + 1); |
| 34 display.cancelAnimationFrame(handle - 1); |
| 35 display.cancelAnimationFrame(0.5); |
| 36 display.cancelAnimationFrame(null); |
| 37 canFinish = true; |
| 38 }, (err) => { |
| 39 t.step( () => { |
| 40 assert_unreached("getVRDisplays rejected"); |
| 41 }); |
| 42 t.done(); |
| 43 }); |
| 44 }, [fakeDisplays["Pixel"]], |
| 45 "cancelAnimationFrame does not have unexpected behavior when given invalid handl
es"); |
| 46 |
| 47 </script> |
| OLD | NEW |