Skip to content

Commit

Permalink
serial: Migrate Web Serial MojoJS based tests to internal folder
Browse files Browse the repository at this point in the history
This CL migrate Web Serial MojsJS based tests to internal folder
temporary. We will move it back once Web Serial Testing specification
for test-only interface is defined.

Bug: 1524403
Change-Id: I75323dfe2a649348e23c333e1a635cf8cc9ba806
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5259047
Reviewed-by: Matt Reynolds <[email protected]>
Commit-Queue: Alvin Ji <[email protected]>
Reviewed-by: Alvin Ji <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1257126}
  • Loading branch information
Alvin Ji authored and chromium-wpt-export-bot committed Feb 7, 2024
1 parent a68f313 commit 39e3ec2
Show file tree
Hide file tree
Showing 28 changed files with 2 additions and 1,523 deletions.
14 changes: 2 additions & 12 deletions serial/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
# Web Serial Testing

Automated testing for the [Web Serial API] relies on a test-only interface which
must be provided by browsers under test. This is similar to [WebUSB] however
there is no separate specification of the API other than the tests themselves
and the Chromium implementation.

Tests in this suite include `resources/automation.js` to detect and load the
test API as needed.

The Chromium implementation is provided by
`../resources/chromium/fake-serial.js` using [MojoJS].
Currently Web Serial only provide permission policy and maualy tests. The goal in future is to define test API specification similar to [WebUSB] and provide test-only interface to support more comprehensive tests.

Tests with the "-manual" suffix do not use the test-only interface and expect a
real hardware device to be connected. The specific characteristics of the device
are described in each test.

[MojoJS]: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/testing/web_platform_tests.md#mojojs
[WebUSB]: ../webusb
[WebUSB]: webusb
[Web Serial API]: https://wicg.github.io/serial
66 changes: 0 additions & 66 deletions serial/resources/automation.js

This file was deleted.

24 changes: 0 additions & 24 deletions serial/serial-disabled-by-permissions-policy.https.sub.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/test-only-api.js"></script>
<script src="/serial/resources/automation.js"></script>
<script src="/permissions-policy/resources/permissions-policy.js"></script>
<script>
'use strict';
Expand All @@ -15,14 +14,6 @@
const cross_origin_worker_frame_src = sub + same_origin_worker_frame_src;
const header = 'Permissions-Policy header serial=()';

async function sleep(timeout) {
return new Promise(resolve => {
step_timeout(() => {
resolve();
}, timeout);
});
}

promise_test(() => {
return navigator.serial.getPorts().then(() => {
assert_unreached('expected promise to reject with SecurityError');
Expand Down Expand Up @@ -55,20 +46,5 @@
fetch_tests_from_worker(new Worker(
'resources/serial-disabled-by-permissions-policy-worker.js'));

serial_test(async (t, fake) => {
let eventWatcher = new EventWatcher(t, navigator.serial, 'connect');

// This isn't necessary as the expected scenario shouldn't send any mojo
// request. However, in order to capture a bug that doesn't reject adding
// event listener, time delay here is to allow mojo request to be intercepted
// after adding connect event listener.
await sleep(100);

// If device connect event fires, EventWatcher will assert for an unexpected
// event.
fake.addPort();
// Time delay here is to allow event to be fired if any.
await sleep(100);
}, 'Connect event is not fired when serial is disallowed.');
</script>
</body>
29 changes: 0 additions & 29 deletions serial/serialPort-disconnect-during-abort.https.any.js

This file was deleted.

26 changes: 0 additions & 26 deletions serial/serialPort_close.https.any.js

This file was deleted.

197 changes: 0 additions & 197 deletions serial/serialPort_events.https.any.js

This file was deleted.

Loading

0 comments on commit 39e3ec2

Please sign in to comment.