Chromium Code Reviews| Index: chrome/test/data/android/webvr_instrumentation/html/test_pose_data_unfocused_tab.html |
| diff --git a/chrome/test/data/android/webvr_instrumentation/html/test_pose_data_unfocused_tab.html b/chrome/test/data/android/webvr_instrumentation/html/test_pose_data_unfocused_tab.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2abd76570cc0c5a0acc4be695238f26028bfe65d |
| --- /dev/null |
| +++ b/chrome/test/data/android/webvr_instrumentation/html/test_pose_data_unfocused_tab.html |
| @@ -0,0 +1,63 @@ |
| +<!doctype html> |
| +<!-- |
| +Tests that WebVR doesn't update frame data when the tab is not focused |
| +--> |
| +<html> |
| + <head> |
| + <style> |
| + html, body { |
| + margin: 0; |
| + padding: 0; |
| + width: 100%; |
| + height: 100%; |
| + } |
| + #webgl-canvas { |
| + box-sizing: border-box; |
| + height: 100%; |
| + left: 0; |
| + margin: 0; |
| + position: absolute; |
| + top: 0; |
| + width: 100%; |
| + } |
| + #log { |
| + display: none; |
| + } |
| + </style> |
| + </head> |
| + <body> |
| + <canvas id="webgl-canvas"></canvas> |
| + <script src="../../../../../../third_party/WebKit/LayoutTests/resources/testharness.js"></script> |
| + <script src="../resources/webvr_e2e.js"></script> |
| + <script src="../resources/webvr_boilerplate.js"></script> |
| + <script> |
| + var t = async_test("Test pose data in unfocused tab"); |
| + var fd = null; |
| + |
| + function stepCheckFrameDataWhileFocusedTab() { |
| + function onAnimationFrame1() { |
|
Lei Lei
2017/02/16 22:04:49
Nit: no need to add 1 at end of function name.
bsheedy
2017/02/16 23:30:13
Done.
|
| + fd = new VRFrameData(); |
| + t.step( () => { |
| + assert_true(vrDisplay.getFrameData(fd), |
| + "getFrameData says it updated the object"); |
| + assert_true(fd != null, |
| + "frame data is no longer null"); |
| + assert_true(fd.pose != null, |
| + "frame data's pose is non-null"); |
| + }); |
| + finishJavascriptStep(); |
| + } |
| + // Make sure at least one rAF call has happened so we get valid data |
| + window.requestAnimationFrame(onAnimationFrame1); |
| + } |
| + |
| + function stepCheckFrameDataWhileNonFocusedTab() { |
| + t.step( () => { |
|
Lei Lei
2017/02/16 22:04:50
Nit: you can call t.step_func_done which does t.st
bsheedy
2017/02/16 23:30:14
Done.
|
| + assert_false(vrDisplay.getFrameData(fd), |
| + "getFrameData shouldn't provide new data when tab not focused"); |
| + }); |
| + t.done(); |
| + } |
| + </script> |
| + </body> |
| +</html> |