https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 093b0b3d5d041c16ef342790acaf3e9c1b5e01e6 authored by Hayato Ito on 28 March 2018, 12:08:08 UTC
Keep track of all pending slot assignments, and recalc all before UpdateStyle phase
Tip revision: 093b0b3
idlharness-manual.html
<!doctype html>
<title>Manual Gamepad IDL tests</title>
<link rel="help" href="https://w3c.github.io/gamepad/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<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";

setup({explicit_timeout: true});

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());

  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");
</script>
back to top