Title: [260424] trunk/LayoutTests/imported/w3c
Revision
260424
Author
[email protected]
Date
2020-04-21 03:33:58 -0700 (Tue, 21 Apr 2020)

Log Message

Import latest changes from web-platform-test/webxr/resources to enable testing in WebKit
https://bugs.webkit.org/show_bug.cgi?id=210788

Reviewed by Žan Doberšek.

We landed in wpt new code in webxr_utils.js to map internal.xrTest to
navigator.xr.test to be able to run WebXR WPT in WebKit. Import those changes
from upstream in order to be able to run the tests.

Apart from that we take the chance to import the latest fixes to the
files in resources/ directory.

* web-platform-tests/webxr/resources/webxr_test_constants.js: Updated.
* web-platform-tests/webxr/resources/webxr_test_constants_fake_world.js:
(createFakeWorld): Ditto.
* web-platform-tests/webxr/resources/webxr_util.js: Map internals.xrTest
to navigator.xr.test for WebKit browsers.
(xr_debug): Updated.
(async xr_session_promise_test): Ditto.
(xr_promise_test): Deleted.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (260423 => 260424)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-04-21 10:31:08 UTC (rev 260423)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-04-21 10:33:58 UTC (rev 260424)
@@ -1,3 +1,26 @@
+2020-04-21  Sergio Villar Senin  <[email protected]>
+
+        Import latest changes from web-platform-test/webxr/resources to enable testing in WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=210788
+
+        Reviewed by Žan Doberšek.
+
+        We landed in wpt new code in webxr_utils.js to map internal.xrTest to
+        navigator.xr.test to be able to run WebXR WPT in WebKit. Import those changes
+        from upstream in order to be able to run the tests.
+
+        Apart from that we take the chance to import the latest fixes to the
+        files in resources/ directory.
+
+        * web-platform-tests/webxr/resources/webxr_test_constants.js: Updated.
+        * web-platform-tests/webxr/resources/webxr_test_constants_fake_world.js:
+        (createFakeWorld): Ditto.
+        * web-platform-tests/webxr/resources/webxr_util.js: Map internals.xrTest 
+        to navigator.xr.test for WebKit browsers.
+        (xr_debug): Updated.
+        (async xr_session_promise_test): Ditto.
+        (xr_promise_test): Deleted.
+
 2020-04-15  Sergio Villar Senin  <[email protected]>
 
         [WebXR] Update WebXRSession and WebXRSystem interfaces

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/resources/webxr_test_constants.js (260423 => 260424)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/resources/webxr_test_constants.js	2020-04-21 10:31:08 UTC (rev 260423)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/resources/webxr_test_constants.js	2020-04-21 10:33:58 UTC (rev 260424)
@@ -128,6 +128,7 @@
   'unbounded',
   'hit-test',
   'dom-overlay',
+  'light-estimation',
 ];
 
 const TRACKED_IMMERSIVE_DEVICE = {

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/resources/webxr_test_constants_fake_world.js (260423 => 260424)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/resources/webxr_test_constants_fake_world.js	2020-04-21 10:31:08 UTC (rev 260423)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/resources/webxr_test_constants_fake_world.js	2020-04-21 10:33:58 UTC (rev 260424)
@@ -29,26 +29,26 @@
   // Faces:
   const FRONT_WALL_AND_FLOOR_FACES = [
     // Front wall:
-    [BOTTOM_LEFT_FRONT, BOTTOM_RIGHT_FRONT, TOP_RIGHT_FRONT],
-    [BOTTOM_LEFT_FRONT, TOP_RIGHT_FRONT, TOP_LEFT_FRONT],
+    { vertices: [BOTTOM_LEFT_FRONT, BOTTOM_RIGHT_FRONT, TOP_RIGHT_FRONT] },
+    { vertices: [BOTTOM_LEFT_FRONT, TOP_RIGHT_FRONT, TOP_LEFT_FRONT] },
     // Floor:
-    [BOTTOM_LEFT_FRONT, BOTTOM_RIGHT_FRONT, BOTTOM_RIGHT_BACK],
-    [BOTTOM_LEFT_FRONT, BOTTOM_LEFT_BACK, BOTTOM_RIGHT_BACK],
+    { vertices: [BOTTOM_LEFT_FRONT, BOTTOM_RIGHT_FRONT, BOTTOM_RIGHT_BACK] },
+    { vertices: [BOTTOM_LEFT_FRONT, BOTTOM_LEFT_BACK, BOTTOM_RIGHT_BACK] },
   ];
 
   const CEILING_FACES = [
     // Ceiling:
-    [TOP_LEFT_FRONT, TOP_RIGHT_FRONT, TOP_RIGHT_BACK],
-    [TOP_LEFT_FRONT, TOP_LEFT_BACK, TOP_RIGHT_BACK],
+    { vertices: [TOP_LEFT_FRONT, TOP_RIGHT_FRONT, TOP_RIGHT_BACK] },
+    { vertices: [TOP_LEFT_FRONT, TOP_LEFT_BACK, TOP_RIGHT_BACK] },
   ];
 
   const SIDE_WALLS_FACES = [
     // Left:
-    [BOTTOM_LEFT_FRONT, TOP_LEFT_FRONT, TOP_LEFT_BACK],
-    [BOTTOM_LEFT_FRONT, BOTTOM_LEFT_BACK, TOP_LEFT_BACK],
+    { vertices: [BOTTOM_LEFT_FRONT, TOP_LEFT_FRONT, TOP_LEFT_BACK] },
+    { vertices: [BOTTOM_LEFT_FRONT, BOTTOM_LEFT_BACK, TOP_LEFT_BACK] },
     // Right:
-    [BOTTOM_RIGHT_FRONT, TOP_RIGHT_FRONT, TOP_RIGHT_BACK],
-    [BOTTOM_RIGHT_FRONT, BOTTOM_RIGHT_BACK, TOP_RIGHT_BACK],
+    { vertices: [BOTTOM_RIGHT_FRONT, TOP_RIGHT_FRONT, TOP_RIGHT_BACK] },
+    { vertices: [BOTTOM_RIGHT_FRONT, BOTTOM_RIGHT_BACK, TOP_RIGHT_BACK] },
   ];
 
   // Regions:

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/resources/webxr_util.js (260423 => 260424)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/resources/webxr_util.js	2020-04-21 10:31:08 UTC (rev 260423)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/resources/webxr_util.js	2020-04-21 10:33:58 UTC (rev 260424)
@@ -7,15 +7,26 @@
 //
 //   --enable-blink-features=MojoJS,MojoJSTest
 
+// Debugging message helper, by default does nothing. Implementations can
+// override this.
+var xr_debug = function(name, msg) {}
+
 function xr_promise_test(name, func, properties) {
   promise_test(async (t) => {
     // Perform any required test setup:
+    xr_debug(name, 'setup');
 
     if (window.XRTest === undefined) {
       // Chrome setup
       await loadChromiumResources;
+      xr_debug = navigator.xr.test.Debug;
     }
 
+    if (self.internals && internals.xrTest && navigator.xr) {
+      // WebKit setup
+      await setupWebKitWebXRTestAPI;
+    }
+
     // Ensure that any devices are disconnected when done. If this were done in
     // a .then() for the success case, a test that expected failure would
     // already be marked done at the time that runs and the shutdown would
@@ -22,9 +33,11 @@
     // interfere with the next test.
     t.add_cleanup(async () => {
       // Ensure system state is cleaned up.
+      xr_debug(name, 'cleanup');
       await navigator.xr.test.disconnectAllDevices();
     });
 
+    xr_debug(name, 'main');
     return func(t);
   }, name, properties);
 }
@@ -74,9 +87,12 @@
               })
               .then(() => new Promise((resolve, reject) => {
                       // Perform the session request in a user gesture.
+                      xr_debug(name, 'simulateUserActivation');
                       navigator.xr.test.simulateUserActivation(() => {
+                        xr_debug(name, 'document.hasFocus()=' + document.hasFocus());
                         navigator.xr.requestSession(sessionMode, sessionInit || {})
                             .then((session) => {
+                              xr_debug(name, 'session start');
                               testSession = session;
                               session.mode = sessionMode;
                               let glLayer = new XRWebGLLayer(session, gl, gllayerProperties);
@@ -87,9 +103,11 @@
                                   baseLayer: glLayer
                               });
                               sessionObjects.glLayer = glLayer;
+                              xr_debug(name, 'session.visibilityState=' + session.visibilityState);
                               resolve(func(session, testDeviceController, t, sessionObjects));
                             })
                             .catch((err) => {
+                              xr_debug(name, 'error: ' + err);
                               reject(
                                   'Session with params ' +
                                   JSON.stringify(sessionMode) +
@@ -186,3 +204,16 @@
 
   return chain;
 });
+
+let setupWebKitWebXRTestAPI = Promise.resolve().then(() => {
+  if (!self.internals) {
+    // Do nothing on non-WebKit-based browsers.
+    return;
+  }
+
+  // WebKit setup. The internals object is used by the WebKit test runner
+  // to provide JS access to internal APIs. In this case it's used to
+  // ensure that XRTest is only exposed to wpt tests.
+  navigator.xr.test = internals.xrTest;
+  return Promise.resolve();
+});
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to