Index: third_party/WebKit/LayoutTests/vr/requestPresent_resolve_repeatwithoutgesture.html |
diff --git a/third_party/WebKit/LayoutTests/vr/requestPresent_resolve_repeatwithoutgesture.html b/third_party/WebKit/LayoutTests/vr/requestPresent_resolve_repeatwithoutgesture.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1f2e6d5e3557a8ae9194ab845513522ef64dcf2a |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/vr/requestPresent_resolve_repeatwithoutgesture.html |
@@ -0,0 +1,51 @@ |
+<!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> |
+<canvas id="webgl-canvas"></canvas> |
+<script src="resources/presentation-setup.js"></script> |
+<script> |
+let fakeDisplays = fakeVRDisplays(); |
+ |
+vr_test((service) => { |
+ return navigator.getVRDisplays().then(displays => { |
+ assert_true(displays != null); |
+ assert_equals(1, displays.length); |
+ var asyncTest = async_test( |
+ "requestPresent resolves and actually presents"); |
+ runWithUserGesture( () => { |
+ displays[0].requestPresent([{ source : webglCanvas }]).then( () => { |
+ asyncTest.step( () => { |
+ assert_true(displays[0].isPresenting); |
+ }, "Display should be presenting"); |
+ |
+ // Call requestPresent again after a short delay, but without a user |
+ // gesture. Should resolve because it's already presenting. |
+ setTimeout(() => { |
+ displays[0].requestPresent([{ source : webglCanvas }]).then( () => { |
+ asyncTest.step( () => { |
+ assert_true(displays[0].isPresenting); |
+ }, "Display should still be presenting"); |
+ }, (err) => { |
+ asyncTest.step( () => { |
+ assert_unreached(err); |
+ }, "Should never reach here"); |
+ }).then( () => { |
+ asyncTest.done(); |
+ }); |
+ }, 100); |
+ |
+ }, (err) => { |
+ asyncTest.step( () => { |
+ assert_unreached(err); |
+ }, "Should never reach here"); |
+ asyncTest.done(); |
+ }); |
+ }); |
+ }); |
+}, [fakeDisplays['Pixel']], |
+'Test requestPresent resolves without a user gesture when already presenting'); |
+ |
+</script> |