Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / webaudio / audiobuffersource-exception.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/audio-testing.js"></script>
7 <script src="resources/audiobuffersource-testing.js"></script>
8 </head>
9
10 <body>
11
12 <div id="description"></div>
13 <div id="console"></div>
14
15 <script>
16 description("Tests that AudioBufferSourceNode validates start and stop calls.");
17
18 var bufferSource;
19
20 function runTest() {
21     window.jsTestIsAsync = true;
22
23     var sampleRate = 44100.0;
24     var numberOfFrames = 32;
25     var context = new webkitOfflineAudioContext(1, numberOfFrames, sampleRate);
26     bufferSource = context.createBufferSource();
27     bufferSource.buffer = createTestBuffer(context, numberOfFrames);
28     bufferSource.connect(context.destination);
29
30     // 'stop' should be called only after 'start'.
31     shouldThrowErrorName("bufferSource.stop(0)", "InvalidStateError");
32     bufferSource.start(0);
33
34     // 'start' should be called only once.
35     shouldThrowErrorName("bufferSource.start(0)", "InvalidStateError");
36     bufferSource.stop(0);
37
38     // 'stop' should be called only once.
39     shouldThrowErrorName("bufferSource.stop(0)", "InvalidStateError");
40
41     context.oncomplete = finishJSTest;
42     context.startRendering();
43 }
44
45 runTest();
46
47 </script>
48 </body>
49 </html>