| <!doctype html> |
| <!-- |
| Tests that window.requestAnimationFrame stops firing while in WebVR presentation |
| on Android. |
| --> |
| <html> |
| <head> |
| <link rel="stylesheet" type="text/css" href="../resources/webxr_e2e.css"> |
| </head> |
| <body> |
| <canvas id="webgl-canvas"></canvas> |
| <script src="../../../../../../third_party/blink/web_tests/resources/testharness.js"></script> |
| <script src="../resources/webxr_e2e.js"></script> |
| <script src="../resources/webvr_boilerplate.js"></script> |
| <script> |
| var t = async_test("window.rAF stops while presenting"); |
| var numWindowRafs = 0; |
| |
| function stepVerifyBeforePresent() { |
| window.requestAnimationFrame( () => { |
| finishJavaScriptStep(); |
| }); |
| } |
| |
| function stepVerifyDuringPresent() { |
| let handle = window.requestAnimationFrame( () => { |
| numWindowRafs++; |
| t.step( () => { |
| // Even though we wait for setVSyncPaused to be called Java-side, |
| // 1-2 frames might still get window rAFs due to the call to the |
| // renderer being asynchronous. |
| assert_less_than(numWindowRafs, 3); |
| }); |
| }); |
| window.setTimeout( () => { |
| window.cancelAnimationFrame(handle); |
| finishJavaScriptStep(); |
| }, 500); |
| } |
| |
| function stepVerifyAfterPresent() { |
| window.requestAnimationFrame( () => { |
| t.done(); |
| }); |
| } |
| </script> |
| </body> |
| </html> |