Changeset 260424 in webkit


Ignore:
Timestamp:
Apr 21, 2020 3:33:58 AM (4 years ago)
Author:
svillar@igalia.com
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.

Location:
trunk/LayoutTests/imported/w3c
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r260385 r260424  
     12020-04-21  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Import latest changes from web-platform-test/webxr/resources to enable testing in WebKit
     4        https://bugs.webkit.org/show_bug.cgi?id=210788
     5
     6        Reviewed by Žan Doberšek.
     7
     8        We landed in wpt new code in webxr_utils.js to map internal.xrTest to
     9        navigator.xr.test to be able to run WebXR WPT in WebKit. Import those changes
     10        from upstream in order to be able to run the tests.
     11
     12        Apart from that we take the chance to import the latest fixes to the
     13        files in resources/ directory.
     14
     15        * web-platform-tests/webxr/resources/webxr_test_constants.js: Updated.
     16        * web-platform-tests/webxr/resources/webxr_test_constants_fake_world.js:
     17        (createFakeWorld): Ditto.
     18        * web-platform-tests/webxr/resources/webxr_util.js: Map internals.xrTest
     19        to navigator.xr.test for WebKit browsers.
     20        (xr_debug): Updated.
     21        (async xr_session_promise_test): Ditto.
     22        (xr_promise_test): Deleted.
     23
    1242020-04-15  Sergio Villar Senin  <svillar@igalia.com>
    225
  • trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/resources/webxr_test_constants.js

    r258499 r260424  
    129129  'hit-test',
    130130  'dom-overlay',
     131  'light-estimation',
    131132];
    132133
  • trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/resources/webxr_test_constants_fake_world.js

    r258499 r260424  
    3030  const FRONT_WALL_AND_FLOOR_FACES = [
    3131    // Front wall:
    32     [BOTTOM_LEFT_FRONT, BOTTOM_RIGHT_FRONT, TOP_RIGHT_FRONT],
    33     [BOTTOM_LEFT_FRONT, TOP_RIGHT_FRONT, TOP_LEFT_FRONT],
     32    { vertices: [BOTTOM_LEFT_FRONT, BOTTOM_RIGHT_FRONT, TOP_RIGHT_FRONT] },
     33    { vertices: [BOTTOM_LEFT_FRONT, TOP_RIGHT_FRONT, TOP_LEFT_FRONT] },
    3434    // Floor:
    35     [BOTTOM_LEFT_FRONT, BOTTOM_RIGHT_FRONT, BOTTOM_RIGHT_BACK],
    36     [BOTTOM_LEFT_FRONT, BOTTOM_LEFT_BACK, BOTTOM_RIGHT_BACK],
     35    { vertices: [BOTTOM_LEFT_FRONT, BOTTOM_RIGHT_FRONT, BOTTOM_RIGHT_BACK] },
     36    { vertices: [BOTTOM_LEFT_FRONT, BOTTOM_LEFT_BACK, BOTTOM_RIGHT_BACK] },
    3737  ];
    3838
    3939  const CEILING_FACES = [
    4040    // Ceiling:
    41     [TOP_LEFT_FRONT, TOP_RIGHT_FRONT, TOP_RIGHT_BACK],
    42     [TOP_LEFT_FRONT, TOP_LEFT_BACK, TOP_RIGHT_BACK],
     41    { vertices: [TOP_LEFT_FRONT, TOP_RIGHT_FRONT, TOP_RIGHT_BACK] },
     42    { vertices: [TOP_LEFT_FRONT, TOP_LEFT_BACK, TOP_RIGHT_BACK] },
    4343  ];
    4444
    4545  const SIDE_WALLS_FACES = [
    4646    // Left:
    47     [BOTTOM_LEFT_FRONT, TOP_LEFT_FRONT, TOP_LEFT_BACK],
    48     [BOTTOM_LEFT_FRONT, BOTTOM_LEFT_BACK, TOP_LEFT_BACK],
     47    { vertices: [BOTTOM_LEFT_FRONT, TOP_LEFT_FRONT, TOP_LEFT_BACK] },
     48    { vertices: [BOTTOM_LEFT_FRONT, BOTTOM_LEFT_BACK, TOP_LEFT_BACK] },
    4949    // Right:
    50     [BOTTOM_RIGHT_FRONT, TOP_RIGHT_FRONT, TOP_RIGHT_BACK],
    51     [BOTTOM_RIGHT_FRONT, BOTTOM_RIGHT_BACK, TOP_RIGHT_BACK],
     50    { vertices: [BOTTOM_RIGHT_FRONT, TOP_RIGHT_FRONT, TOP_RIGHT_BACK] },
     51    { vertices: [BOTTOM_RIGHT_FRONT, BOTTOM_RIGHT_BACK, TOP_RIGHT_BACK] },
    5252  ];
    5353
  • trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/resources/webxr_util.js

    r258499 r260424  
    88//   --enable-blink-features=MojoJS,MojoJSTest
    99
     10// Debugging message helper, by default does nothing. Implementations can
     11// override this.
     12var xr_debug = function(name, msg) {}
     13
    1014function xr_promise_test(name, func, properties) {
    1115  promise_test(async (t) => {
    1216    // Perform any required test setup:
     17    xr_debug(name, 'setup');
    1318
    1419    if (window.XRTest === undefined) {
    1520      // Chrome setup
    1621      await loadChromiumResources;
     22      xr_debug = navigator.xr.test.Debug;
     23    }
     24
     25    if (self.internals && internals.xrTest && navigator.xr) {
     26      // WebKit setup
     27      await setupWebKitWebXRTestAPI;
    1728    }
    1829
     
    2334    t.add_cleanup(async () => {
    2435      // Ensure system state is cleaned up.
     36      xr_debug(name, 'cleanup');
    2537      await navigator.xr.test.disconnectAllDevices();
    2638    });
    2739
     40    xr_debug(name, 'main');
    2841    return func(t);
    2942  }, name, properties);
     
    7588              .then(() => new Promise((resolve, reject) => {
    7689                      // Perform the session request in a user gesture.
     90                      xr_debug(name, 'simulateUserActivation');
    7791                      navigator.xr.test.simulateUserActivation(() => {
     92                        xr_debug(name, 'document.hasFocus()=' + document.hasFocus());
    7893                        navigator.xr.requestSession(sessionMode, sessionInit || {})
    7994                            .then((session) => {
     95                              xr_debug(name, 'session start');
    8096                              testSession = session;
    8197                              session.mode = sessionMode;
     
    88104                              });
    89105                              sessionObjects.glLayer = glLayer;
     106                              xr_debug(name, 'session.visibilityState=' + session.visibilityState);
    90107                              resolve(func(session, testDeviceController, t, sessionObjects));
    91108                            })
    92109                            .catch((err) => {
     110                              xr_debug(name, 'error: ' + err);
    93111                              reject(
    94112                                  'Session with params ' +
     
    187205  return chain;
    188206});
     207
     208let setupWebKitWebXRTestAPI = Promise.resolve().then(() => {
     209  if (!self.internals) {
     210    // Do nothing on non-WebKit-based browsers.
     211    return;
     212  }
     213
     214  // WebKit setup. The internals object is used by the WebKit test runner
     215  // to provide JS access to internal APIs. In this case it's used to
     216  // ensure that XRTest is only exposed to wpt tests.
     217  navigator.xr.test = internals.xrTest;
     218  return Promise.resolve();
     219});
Note: See TracChangeset for help on using the changeset viewer.