Commit 03ef65db authored by Ovidio Henriquez's avatar Ovidio Henriquez Committed by Commit Bot

Update existing WebUSB WPT to be multi-global

This change updates the remaining WebUSB web platform tests to be
multi-global so that the API is also tested in the worker contexts.

Bug: 841510
Change-Id: I9df24f1ae4289ab742db275c34552200bb477b22
Reviewed-on: https://chromium-review.googlesource.com/1089033
Commit-Queue: Ovidio Henriquez <odejesush@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565778}
parent 955535cb
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/fake-devices.js"></script>
<script src="resources/usb-helpers.js"></script>
<script>
// META: script=/webusb/resources/fake-devices.js
// META: script=/webusb/resources/usb-helpers.js
// META: global=sharedworker
'use strict';
function assertRejectsWithNotFoundError(promise) {
......@@ -12,7 +9,7 @@ function assertRejectsWithNotFoundError(promise) {
function assertRejectsWithNotOpenError(promise) {
return assertRejectsWithError(
promise, 'InvalidStateError', 'The device must be opened first.')
promise, 'InvalidStateError', 'The device must be opened first.');
}
function assertRejectsWithNotConfiguredError(promise) {
......@@ -340,7 +337,7 @@ usb_test(() => {
assert_equals(result.status, 'ok');
assert_equals(result.bytesWritten, 8);
return device.close();
})
});
});
}, 'can issue OUT control transfer');
......@@ -651,4 +648,3 @@ usb_test(() => {
.then(() => assertRejectsWithNotFoundError(device.reset()));
});
}, 'resetDevice rejects when called on a disconnected device');
</script>
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// META: script=/webusb/resources/fake-devices.js
// META: script=/webusb/resources/usb-helpers.js
// META: global=sharedworker
'use strict';
test(t => {
......@@ -28,4 +27,3 @@ test(t => {
test(t => {
assert_throws(TypeError(), () => new USBInTransferResult());
}, 'Cannot construct USBInTransferResult without a status');
</script>
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// META: global=sharedworker
'use strict';
test(t => {
......@@ -30,4 +27,3 @@ test(t => {
test(t => {
assert_throws(TypeError(), () => new USBIsochronousInTransferPacket());
}, 'Cannot construct USBIsochronousInTransferPacket without a status');
</script>
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// META: global=sharedworker
'use strict';
test(t => {
......@@ -38,4 +35,3 @@ test(t => {
test(t => {
assert_throws(TypeError(), () => new USBIsochronousInTransferResult());
}, 'Cannot construct a USBIsochronousInTransferResult without packets');
</script>
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// META: global=sharedworker
'use strict';
test(t => {
......@@ -23,4 +20,3 @@ test(t => {
test(t => {
assert_throws(TypeError(), () => new USBIsochronousOutTransferPacket());
}, 'Cannot construct USBIsochronousOutTransferPacket without a status');
</script>
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// META: global=sharedworker
'use strict';
test(t => {
......@@ -21,4 +18,3 @@ test(t => {
test(t => {
assert_throws(TypeError(), () => new USBIsochronousOutTransferResult());
}, 'Cannot construct a USBIsochronousOutTransferResult without packets');
</script>
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// META: global=sharedworker
'use strict';
test(t => {
......@@ -21,4 +18,3 @@ test(t => {
test(t => {
assert_throws(TypeError(), () => new USBOutTransferResult());
}, 'Cannot construct USBOutTransferResult without a status');
</script>
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