Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / webaudio / page-canstartmedia.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5 <script src="../resources/js-test.js"></script>
6 </head>
7
8 <body>
9
10 <div id="description"></div>
11 <div id="console"></div>
12
13 <script>
14 description("Tests that AudioContext resume method resolve promises when notified by Page that it can start media playback.");
15
16 function runTest() {
17     if (window.internals)
18         internals.settings.setCanStartMedia(false);
19
20     window.jsTestIsAsync = true;
21
22     context = new webkitAudioContext();
23
24     context.resume().then(resumePromiseResolved).catch(resumePromiseRejected);
25
26     setTimeout(allowStartMedia, 100);
27 }
28
29 function allowStartMedia() {
30     if (window.internals)
31         internals.settings.setCanStartMedia(true);
32 }
33
34 function resumePromiseResolved() {
35     testPassed('context resolve callback called')
36     finishJSTest();
37 }
38
39 function resumePromiseRejected() {
40     testFailed('context reject callback called');
41     finishJSTest();
42 }
43
44 runTest();
45
46 </script>
47 </body>
48 </html>