mirror of
https://github.com/servo/servo.git
synced 2025-08-17 11:25:35 +01:00
Update web-platform-tests to revision 3f9178031eec5374c9a7d5709a7e11ba4a1955ed
This commit is contained in:
parent
4997ec26c2
commit
a5af9a106a
192 changed files with 3943 additions and 1927 deletions
|
@ -7,26 +7,32 @@
|
|||
<script src="/resources/idlharness.js"></script>
|
||||
<p id="instructions">This test requires a gamepad. Connect one and press any button to start the test.</p>
|
||||
<script>
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
setup({explicit_timeout: true});
|
||||
idl_test(
|
||||
['gamepad'],
|
||||
['dom', 'html'],
|
||||
(idl_array, t) => {
|
||||
idl_array.add_objects({
|
||||
Gamepad: ['gamepad'],
|
||||
GamepadButton: ['gamepadButton'],
|
||||
GamepadEvent: ['event'],
|
||||
Navigator: ['navigator']
|
||||
});
|
||||
|
||||
promise_test(async t => {
|
||||
const eventWatcher = new EventWatcher(t, window, "gamepadconnected");
|
||||
let e = await eventWatcher.wait_for("gamepadconnected");
|
||||
const idl_array = new IdlArray();
|
||||
const gamepad_idl = await fetch("/interfaces/gamepad.idl").then(r => r.text());
|
||||
const eventWatcher = new EventWatcher(t, window, "gamepadconnected");
|
||||
const gamepadConnected = eventWatcher.wait_for("gamepadconnected")
|
||||
.then(e => {
|
||||
self.event = e;
|
||||
self.gamepad = e.gamepad;
|
||||
self.gamepadButton = e.gamepad.buttons[0];
|
||||
});
|
||||
|
||||
idl_array.add_untested_idls('interface Event {};');
|
||||
idl_array.add_untested_idls('interface Navigator {};');
|
||||
idl_array.add_idls(gamepad_idl);
|
||||
|
||||
idl_array.add_objects({
|
||||
GamepadEvent: [e],
|
||||
Gamepad: [e.gamepad],
|
||||
GamepadButton: [e.gamepad.buttons[0]],
|
||||
Navigator: ["navigator"]
|
||||
});
|
||||
idl_array.test();
|
||||
}, "Test IDL implementation of Gamepad API");
|
||||
const timeout = new Promise((_, reject) => {
|
||||
t.step_timeout(() => { reject('Timed out waiting for gamepad'); }, 5000);
|
||||
});
|
||||
return Promise.race([gamepadConnected, timeout]);
|
||||
},
|
||||
'Test IDL implementation of Gamepad API'
|
||||
);
|
||||
</script>
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<!doctype html>
|
||||
<title>Gamepad IDL tests</title>
|
||||
<link rel="help" href="https://w3c.github.io/gamepad/#gamepad-interface">
|
||||
<link rel="help" href="https://w3c.github.io/gamepad/#gamepadbutton-interface">
|
||||
<link rel="help" href="https://w3c.github.io/gamepad/#gamepadevent-interface">
|
||||
<link rel="help" href="https://w3c.github.io/gamepad/#navigator-interface-extension">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
promise_test(async () => {
|
||||
const srcs = ['gamepad', 'dom', 'html'];
|
||||
const [idl, dom, html] = await Promise.all(
|
||||
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
|
||||
|
||||
const idl_array = new IdlArray();
|
||||
idl_array.add_idls(idl);
|
||||
idl_array.add_dependency_idls(dom);
|
||||
idl_array.add_dependency_idls(html);
|
||||
|
||||
idl_array.add_objects({
|
||||
GamepadEvent: [new GamepadEvent("something")],
|
||||
Navigator: ["navigator"]
|
||||
});
|
||||
idl_array.test();
|
||||
}, "Test IDL implementation of Gamepad API");
|
||||
</script>
|
18
tests/wpt/web-platform-tests/gamepad/idlharness.window.js
Normal file
18
tests/wpt/web-platform-tests/gamepad/idlharness.window.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
// META: script=/resources/WebIDLParser.js
|
||||
// META: script=/resources/idlharness.js
|
||||
|
||||
// https://w3c.github.io/gamepad/
|
||||
|
||||
'use strict';
|
||||
|
||||
idl_test(
|
||||
['gamepad'],
|
||||
['dom', 'html'],
|
||||
idl_array => {
|
||||
idl_array.add_objects({
|
||||
GamepadEvent: ['new GamepadEvent("gamepad")'],
|
||||
Navigator: ['navigator']
|
||||
});
|
||||
},
|
||||
'Test IDL implementation of Gamepad API'
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue