49 lines
941 B
HTML
49 lines
941 B
HTML
<!DOCTYPE html>
|
|
|
|
<html>
|
|
<head>
|
|
<script src="../resources/js-test.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="description"></div>
|
|
<div id="console"></div>
|
|
|
|
<script>
|
|
description("Tests that AudioContext resume method resolve promises when notified by Page that it can start media playback.");
|
|
|
|
function runTest() {
|
|
if (window.internals)
|
|
internals.settings.setCanStartMedia(false);
|
|
|
|
window.jsTestIsAsync = true;
|
|
|
|
context = new AudioContext();
|
|
|
|
context.resume().then(resumePromiseResolved).catch(resumePromiseRejected);
|
|
|
|
setTimeout(allowStartMedia, 100);
|
|
}
|
|
|
|
function allowStartMedia() {
|
|
if (window.internals)
|
|
internals.settings.setCanStartMedia(true);
|
|
}
|
|
|
|
function resumePromiseResolved() {
|
|
testPassed('context resolve callback called')
|
|
finishJSTest();
|
|
}
|
|
|
|
function resumePromiseRejected() {
|
|
testFailed('context reject callback called');
|
|
finishJSTest();
|
|
}
|
|
|
|
runTest();
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|