chromium/third_party/blink/web_tests/gamepad/resources/check-gamepads.html

<!DOCTYPE html>
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="gamepad-helpers.js"></script>
<script>

let checkGamepads = async () => {
  disconnectGamepads();
  let connectPromise = ongamepadconnected();
  connectGamepads(1);
  await connectPromise;

  if (self.navigator.getGamepads()[0]) {
    self.opener.postMessage('success', '*');
  }
};
checkGamepads();
</script>
</body>