Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/vr/requestAnimationFrame_invalidhandle.html |
| diff --git a/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_invalidhandle.html b/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_invalidhandle.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..171e107fcb31b35478da6dabe04941af4d1b5d80 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_invalidhandle.html |
| @@ -0,0 +1,47 @@ |
| +<!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]; |
| + let canFinish = false; |
| + let counter = 0; |
| + |
| + function onAnimationFrame() { |
| + display.requestAnimationFrame(onAnimationFrame); |
| + if (counter > 10) { |
| + t.done(); |
|
sof
2017/01/13 08:41:24
this looks like it is pumping onAnimationFrame() c
bsheedy
2017/01/13 18:02:01
See earlier reply to your message.
|
| + } |
| + if (counter > 0) { |
| + counter++; |
| + } |
| + if (canFinish) { |
| + canFinish = false; |
| + counter++; |
| + } |
| + } |
| + |
| + let handle = display.requestAnimationFrame(onAnimationFrame); |
| + display.cancelAnimationFrame(0); |
| + display.cancelAnimationFrame(-1); |
| + display.cancelAnimationFrame(handle + 1); |
| + display.cancelAnimationFrame(handle - 1); |
| + display.cancelAnimationFrame(0.5); |
| + display.cancelAnimationFrame(null); |
| + canFinish = true; |
| + }, (err) => { |
| + t.step( () => { |
| + assert_unreached("getVRDisplays rejected"); |
| + }); |
| + t.done(); |
| + }); |
| +}, [fakeDisplays["Pixel"]], |
| +"cancelAnimationFrame does not have unexpected behavior when given invalid handles"); |
| + |
| +</script> |