-
Notifications
You must be signed in to change notification settings - Fork 54
/
FileSystemBaseHandle-postMessage-MessagePort-workers.js
40 lines (36 loc) · 1.5 KB
/
FileSystemBaseHandle-postMessage-MessagePort-workers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'use strict';
// This script depends on the following scripts:
// /native-file-system/resources/messaging-helpers.js
// /native-file-system/resources/messaging-blob-helpers.js
// /native-file-system/resources/messaging-serialize-helpers.js
// /native-file-system/resources/test-helpers.js
// /service-workers/service-worker/resources/test-helpers.sub.js
directory_test(
async (t, root_dir) => {
const dedicated_worker =
create_dedicated_worker(t, kDedicatedWorkerMessageTarget);
await do_message_port_test(t, root_dir, /*target=*/ dedicated_worker);
},
'Send and receive messages using a message port in a dedicated ' +
'worker.');
directory_test(
async (t, root_dir) => {
const scope = `${kServiceWorkerMessageTarget}` +
'?post-message-to-message-port-with-file-handle';
const registration =
await create_service_worker(t, kServiceWorkerMessageTarget, scope);
await do_message_port_test(
t, root_dir, /*target=*/ registration.installing);
},
'Send and receive messages using a message port in a service ' +
'worker.');
if (self.SharedWorker !== undefined) {
directory_test(
async (t, root_dir) => {
const shared_worker = new SharedWorker(kSharedWorkerMessageTarget);
shared_worker.port.start();
await do_message_port_test(t, root_dir, /*target=*/ shared_worker.port);
},
'Send and receive messages using a message port in a shared ' +
' worker.');
}