Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/vr/requestAnimationFrame_unregister.html |
| diff --git a/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_unregister.html b/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_unregister.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3b31f5f88e14807184c07a9342daba2171209a12 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_unregister.html |
| @@ -0,0 +1,42 @@ |
| +<!DOCTYPE html> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="../resources/mojo-helpers.js"></script> |
| +<script src="resources/fake-vr-displays.js"></script> |
| +<script src="resources/mock-vr-service.js"></script> |
| +<script> |
| +let fakeDisplays = fakeVRDisplays(); |
| + |
| +vr_test( (t) => { |
| + return navigator.getVRDisplays().then( (displays) => { |
| + let display = displays[0]; |
| + |
| + function onAnimationFrameBad() { |
| + t.step( () => { |
| + assert_unreached(); |
| + }, "Unregistered callback was called"); |
| + t.done(); |
| + } |
| + |
| + let counter = 0; |
| + function onAnimationFrameGood() { |
| + counter++; |
| + if (counter >= 4) { |
| + 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.
|
| + } |
| + display.requestAnimationFrame(onAnimationFrameGood); |
| + } |
| + |
| + let handle = display.requestAnimationFrame(onAnimationFrameBad); |
| + display.cancelAnimationFrame(handle); |
| + display.requestAnimationFrame(onAnimationFrameGood); |
| + }, (err) => { |
| + t.step( () => { |
| + assert_unreached("getVRDisplays rejected"); |
| + }); |
| + t.done(); |
| + }); |
| +}, [fakeDisplays["Pixel"]], |
| +"requestAnimationFrame callbacks can be unregistered with cancelAnimationFrame"); |
| + |
| +</script> |