Chromium Code Reviews| 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 | |
| 14 function onAnimationFrameBad() { | |
| 15 t.step( () => { | |
| 16 assert_unreached(); | |
| 17 }, "Unregistered callback was called"); | |
| 18 t.done(); | |
| 19 } | |
| 20 | |
| 21 let counter = 0; | |
| 22 function onAnimationFrameGood() { | |
| 23 counter++; | |
| 24 if (counter >= 4) { | |
| 25 t.done(); | |
|
sof
2017/01/13 08:41:24
is it intentional not to "return" here after signa
bsheedy
2017/01/13 18:02:01
Yes, see earlier reply to your message.
| |
| 26 } | |
| 27 display.requestAnimationFrame(onAnimationFrameGood); | |
| 28 } | |
| 29 | |
| 30 let handle = display.requestAnimationFrame(onAnimationFrameBad); | |
| 31 display.cancelAnimationFrame(handle); | |
| 32 display.requestAnimationFrame(onAnimationFrameGood); | |
| 33 }, (err) => { | |
| 34 t.step( () => { | |
| 35 assert_unreached("getVRDisplays rejected"); | |
| 36 }); | |
| 37 t.done(); | |
| 38 }); | |
| 39 }, [fakeDisplays["Pixel"]], | |
| 40 "requestAnimationFrame callbacks can be unregistered with cancelAnimationFrame") ; | |
| 41 | |
| 42 </script> | |
| OLD | NEW |