forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interfaces/periodic-background-sync.idl and update test (web-plat…
- Loading branch information
1 parent
f9709ad
commit 7c823f6
Showing
2 changed files
with
48 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// GENERATED CONTENT - DO NOT EDIT | ||
// Content was automatically extracted by Reffy into reffy-reports | ||
// (https://github.com/tidoust/reffy-reports) | ||
// Source: Web Periodic Background Synchronization (https://wicg.github.io/periodic-background-sync/) | ||
|
||
partial interface ServiceWorkerGlobalScope { | ||
attribute EventHandler onperiodicsync; | ||
}; | ||
|
||
[Exposed=(Window,Worker)] | ||
partial interface ServiceWorkerRegistration { | ||
readonly attribute PeriodicSyncManager periodicSync; | ||
}; | ||
|
||
[Exposed=(Window,Worker)] | ||
interface PeriodicSyncManager { | ||
Promise<void> register(DOMString tag, optional BackgroundSyncOptions options); | ||
Promise<sequence<DOMString>> getTags(); | ||
Promise<void> unregister(DOMString tag); | ||
}; | ||
|
||
dictionary BackgroundSyncOptions { | ||
[EnforceRange] unsigned long long minInterval = 0; | ||
}; | ||
|
||
dictionary PeriodicSyncEventInit : ExtendableEventInit { | ||
required DOMString tag; | ||
}; | ||
|
||
[ | ||
Constructor(DOMString type, PeriodicSyncEventInit init), | ||
Exposed=ServiceWorker | ||
] interface PeriodicSyncEvent : ExtendableEvent { | ||
readonly attribute DOMString tag; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,20 @@ | ||
// META: script=/resources/WebIDLParser.js | ||
// META: script=/resources/idlharness.js | ||
// META: timeout=long | ||
|
||
'use strict'; | ||
|
||
// https://wicg.github.io/periodic-background-sync/ | ||
|
||
const idl = ` | ||
partial interface ServiceWorkerGlobalScope { | ||
attribute EventHandler onperiodicsync; | ||
}; | ||
[ | ||
Exposed=(Window,Worker) | ||
] partial interface ServiceWorkerRegistration { | ||
readonly attribute PeriodicSyncManager periodicSync; | ||
readonly attribute SyncManager sync; | ||
}; | ||
dictionary PeriodicSyncEventInit : ExtendableEventInit { | ||
required DOMString tag; | ||
}; | ||
[ | ||
Constructor(DOMString type, PeriodicSyncEventInit init), | ||
Exposed=ServiceWorker | ||
] interface PeriodicSyncEvent : ExtendableEvent { | ||
readonly attribute DOMString tag; | ||
}; | ||
`; | ||
|
||
test(t => { | ||
const idlArray = new IdlArray(); | ||
idlArray.add_idls(idl); | ||
idlArray.add_objects({ | ||
ServiceWorkerGlobalScope: ['self', 'onperiodicsync'], | ||
ServiceWorkerRegistration: ['registration'], | ||
PeriodicSyncManager: ['registration.periodicSync'], | ||
PeriodicSyncEvent: ['new PeriodicSyncEvent("tag")'], | ||
}); | ||
}, 'IDL test for Periodic Background Sync'); | ||
idl_test( | ||
['periodic-background-sync'], | ||
['service-workers', 'html', 'dom'], | ||
async idl_array => { | ||
idl_array.add_objects({ | ||
ServiceWorkerGlobalScope: ['self', 'onperiodicsync'], | ||
ServiceWorkerRegistration: ['registration'], | ||
PeriodicSyncManager: ['registration.periodicSync'], | ||
PeriodicSyncEvent: ['new PeriodicSyncEvent("tag")'], | ||
}); | ||
} | ||
); |