Commit 0b56613e authored by Arnaud Mandy's avatar Arnaud Mandy Committed by Commit Bot

WPT: Refactor capture image tests to use test-only-api.js

Switch to loading *.mojom.js from /gen/ instead of
resources/chromium in preparation for launching official MojoJS support
in WPT. This would not change the test results on Chromium waterfall
(everything should continue to pass) or upstream WPT (tests currently
fail because MojoJS isn't enabled).

Remove unused .mojom.js files from WPT.

Bug: 1119858
Change-Id: I8c7226f4eca9f35ac88b3d02540aed31cf413ff1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2385298
Commit-Queue: Arnaud Mandy <arnaud.mandy@intel.com>
Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803394}
parent d523627f
...@@ -719,6 +719,7 @@ MISSING DEPENDENCY: contacts/resources/helpers.js ...@@ -719,6 +719,7 @@ MISSING DEPENDENCY: contacts/resources/helpers.js
MISSING DEPENDENCY: credential-management/support/otpcredential-helper.js MISSING DEPENDENCY: credential-management/support/otpcredential-helper.js
MISSING DEPENDENCY: generic-sensor/resources/generic-sensor-helpers.js MISSING DEPENDENCY: generic-sensor/resources/generic-sensor-helpers.js
MISSING DEPENDENCY: idle-detection/interceptor.https.html MISSING DEPENDENCY: idle-detection/interceptor.https.html
MISSING DEPENDENCY: mediacapture-image/resources/imagecapture-helpers.js
MISSING DEPENDENCY: orientation-event/resources/orientation-event-helpers.js MISSING DEPENDENCY: orientation-event/resources/orientation-event-helpers.js
MISSING DEPENDENCY: resources/test-only-api.js MISSING DEPENDENCY: resources/test-only-api.js
MISSING DEPENDENCY: screen_enumeration/resources/screenenumeration-helpers.js MISSING DEPENDENCY: screen_enumeration/resources/screenenumeration-helpers.js
...@@ -727,9 +728,6 @@ MISSING DEPENDENCY: web-nfc/resources/nfc-helpers.js ...@@ -727,9 +728,6 @@ MISSING DEPENDENCY: web-nfc/resources/nfc-helpers.js
MISSING DEPENDENCY: webusb/resources/usb-helpers.js MISSING DEPENDENCY: webusb/resources/usb-helpers.js
MISSING DEPENDENCY: webxr/resources/webxr_util.js MISSING DEPENDENCY: webxr/resources/webxr_util.js
# TODO(Hexcles): delete these files once we include them in mojojs.zip.
MOJOM-JS: resources/chromium/image_capture.mojom.js
# Tests that are false positives for using Ahem as a system font # Tests that are false positives for using Ahem as a system font
AHEM SYSTEM FONT: acid/acid3/test.html AHEM SYSTEM FONT: acid/acid3/test.html
AHEM SYSTEM FONT: resource-timing/resources/all_resource_types.htm AHEM SYSTEM FONT: resource-timing/resources/all_resource_types.htm
......
...@@ -9,41 +9,31 @@ ...@@ -9,41 +9,31 @@
// //
// --enable-blink-features=MojoJS,MojoJSTest // --enable-blink-features=MojoJS,MojoJSTest
let loadChromiumResources = Promise.resolve().then(() => { async function loadChromiumResources() {
if (!('MojoInterfaceInterceptor' in self)) { const chromiumResources = [
// Do nothing on non-Chromium-based browsers or when the Mojo bindings are '/gen/media/capture/mojom/image_capture.mojom.js'
// not present in the global namespace. ];
return; await loadMojoResources(chromiumResources);
} await loadScript('/resources/chromium/mock-imagecapture.js');
}
let chain = Promise.resolve(); async function initialize_image_capture_tests() {
[ if (typeof ImageCaptureTest === 'undefined') {
'/resources/chromium/mojo_bindings.js', const script = document.createElement('script');
'/resources/chromium/image_capture.mojom.js', script.src = '/resources/test-only-api.js';
'/resources/chromium/mock-imagecapture.js',
].forEach(path => {
// Use importScripts for workers.
if (typeof document === 'undefined') {
chain = chain.then(() => importScripts(path));
return;
}
let script = document.createElement('script');
script.src = path;
script.async = false; script.async = false;
chain = chain.then(() => new Promise(resolve => { const p = new Promise((resolve, reject) => {
script.onload = () => resolve(); script.onload = () => { resolve(); };
})); script.onerror = e => { reject(e); };
})
document.head.appendChild(script); document.head.appendChild(script);
}); await p;
return chain; if (isChromiumBased) {
}); await loadChromiumResources();
}
async function initialize_image_capture_tests() {
if (typeof ImageCaptureTest === 'undefined') {
await loadChromiumResources;
} }
assert_true(typeof ImageCaptureTest !== 'undefined'); assert_implements(ImageCaptureTest, 'ImageCaptureTest is unavailable');
let imageCaptureTest = new ImageCaptureTest(); let imageCaptureTest = new ImageCaptureTest();
await imageCaptureTest.initialize(); await imageCaptureTest.initialize();
return imageCaptureTest; return imageCaptureTest;
......
Content-Type: text/javascript; charset=utf-8
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment