Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: third_party/WebKit/LayoutTests/vr/requestPresent_resolve_repeatwithoutgesture.html

Issue 2613103002: Added 8 new vr layout tests for various requestPresent conditions (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698