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.
Convert some tests to use
idl_test
(web-platform-tests#18677)
- Loading branch information
1 parent
f283c90
commit a593c50
Showing
10 changed files
with
151 additions
and
195 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
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
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
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
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
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
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
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,41 +1,27 @@ | ||
// META: script=/resources/WebIDLParser.js | ||
// META: script=/resources/idlharness.js | ||
|
||
"use strict"; | ||
|
||
if (self.importScripts) { | ||
importScripts("/resources/testharness.js"); | ||
importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js"); | ||
} | ||
|
||
// https://w3c.github.io/permissions/#idl-index | ||
|
||
promise_test(async () => { | ||
const idl = await fetch("/interfaces/permissions.idl").then(r => r.text()); | ||
const dom = await fetch("/interfaces/dom.idl").then(r => r.text()); | ||
const html = await fetch("/interfaces/html.idl").then(r => r.text()); | ||
|
||
const idl_array = new IdlArray(); | ||
idl_array.add_idls(idl); | ||
idl_array.add_dependency_idls(dom); | ||
idl_array.add_dependency_idls(html); | ||
|
||
try { | ||
self.permissionStatus = await navigator.permissions.query({ name: "geolocation" }); | ||
self.permissionStatus = await navigator.permissions.query({ name: "background-fetch" }); | ||
} catch (e) { | ||
// Will be surfaced in idlharness.js's test_object below. | ||
} | ||
"use strict"; | ||
|
||
if (self.GLOBAL.isWorker()) { | ||
idl_array.add_objects({ WorkerNavigator: ['navigator'] }); | ||
} else { | ||
idl_array.add_objects({ Navigator: ['navigator'] }); | ||
idl_test( | ||
['permissions'], | ||
['html', 'dom'], | ||
async idl_array => { | ||
try { | ||
self.permissionStatus = await navigator.permissions.query({ name: "geolocation" }); | ||
} catch (e) {} | ||
|
||
if (self.GLOBAL.isWorker()) { | ||
idl_array.add_objects({ WorkerNavigator: ['navigator'] }); | ||
} else { | ||
idl_array.add_objects({ Navigator: ['navigator'] }); | ||
} | ||
|
||
idl_array.add_objects({ | ||
Permissions: ['navigator.permissions'], | ||
PermissionStatus: ['permissionStatus'] | ||
}); | ||
} | ||
|
||
idl_array.add_objects({ | ||
Permissions: ['navigator.permissions'], | ||
PermissionStatus: ['permissionStatus'] | ||
}); | ||
idl_array.test(); | ||
}, "Test IDL implementation of Permissions API"); | ||
); |
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,30 +1,24 @@ | ||
// META: script=/resources/WebIDLParser.js | ||
// META: script=/resources/idlharness.js | ||
|
||
async_test(function() { | ||
const srcs = ['requestidlecallback', 'html', 'dom']; | ||
Promise.all(srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))) | ||
.then(([idl, html, dom]) => { | ||
var idl_array = new IdlArray(); | ||
idl_array.add_idls(idl); | ||
idl_array.add_dependency_idls(html); | ||
idl_array.add_dependency_idls(dom); | ||
idl_array.add_objects({Window: ['window']}); | ||
// https://w3c.github.io/requestidlecallback/ | ||
|
||
let deadline; | ||
const execIDLTest = this.step_func_done(function() { | ||
idl_array.add_objects({IdleDeadline: [deadline]}); | ||
idl_array.test(); | ||
}); | ||
'use strict'; | ||
|
||
if (!window.requestIdleCallback) { | ||
execIDLTest(); | ||
} else { | ||
const callback = this.step_func(d => { | ||
deadline = d; | ||
execIDLTest(); | ||
}); | ||
requestIdleCallback(callback, { timeout: 100 }); | ||
} | ||
idl_test( | ||
['requestidlecallback'], | ||
['html', 'dom'], | ||
async idl_array => { | ||
idl_array.add_objects({ | ||
IdleDeadline: ['deadline'], | ||
Window: ['window'], | ||
}); | ||
}, 'IdleDeadline object setup'); | ||
|
||
await new Promise(resolve => { | ||
requestIdleCallback(d => { | ||
self.deadline = d; | ||
resolve(); | ||
}, { timeout: 100 }); | ||
}); | ||
} | ||
); |
Oops, something went wrong.