summaryrefslogtreecommitdiffstats
path: root/dom/vr/test/mochitest/test_vrDisplay_exitPresent.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/vr/test/mochitest/test_vrDisplay_exitPresent.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/vr/test/mochitest/test_vrDisplay_exitPresent.html')
-rw-r--r--dom/vr/test/mochitest/test_vrDisplay_exitPresent.html51
1 files changed, 51 insertions, 0 deletions
diff --git a/dom/vr/test/mochitest/test_vrDisplay_exitPresent.html b/dom/vr/test/mochitest/test_vrDisplay_exitPresent.html
new file mode 100644
index 0000000000..dc2c700723
--- /dev/null
+++ b/dom/vr/test/mochitest/test_vrDisplay_exitPresent.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>VRDisplay ExitPresent</title>
+ <meta name="timeout" content="long"/>
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="VRSimulationDriver.js"></script>
+ <script src="runVRTest.js"></script>
+ </head>
+ <body>
+ <script>
+ function testExitPresentOnOtherIframe(content) {
+ return content.navigator.getVRDisplays().then((displays) => {
+ content.vrDisplay = displays[0];
+ return content.vrDisplay.exitPresent();
+ });
+ }
+ var initVRPresentation = function(content) {
+ return VRSimulationDriver.AttachWebVRDisplay().then(() => {
+ return content.navigator.getVRDisplays().then((displays) => {
+ content.vrDisplay = displays[0];
+ content.canvas = content.document.createElement("canvas");
+ content.canvas.id = "vrCanvas";
+ return content.vrDisplay.requestPresent([{source:content.canvas}]);
+ });
+ });
+ }
+ function startTest() {
+ var ifr1 = document.getElementById("iframe1");
+ var ifr2 = document.getElementById("iframe2");
+ var frame1 = ifr1.contentWindow;
+ var frame2 = ifr2.contentWindow;
+ promise_test((test) => {
+ return VRSimulationDriver.AttachWebVRDisplay().then(() => {
+ return initVRPresentation(frame1).then(() => {
+ promise_test((test) => {
+ return promise_rejects(test, null, testExitPresentOnOtherIframe(frame2));
+ }, "We cannot exit VR presentation established by another content, this promise is expected to be rejected.")
+ });
+ });
+ }, "Finish running WebVR exitPresent test.");
+ }
+ runVRTest(startTest);
+ </script>
+
+ <iframe id="iframe1"></iframe>
+ <iframe id="iframe2"></iframe>
+ </body>
+</html>