Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1170)

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/audiobuffersource-channels.html

Issue 2581463002: Refactor WebAudio test directory (Closed)
Patch Set: Use correct path for wav result files Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/audit-util.js"></script>
7 <script src="resources/audio-testing.js"></script>
8 <script src="resources/compatibility.js"></script>
9 </head>
10
11 <body>
12 <div id="description"></div>
13 <div id="console"></div>
14
15 <script>
16 description("Tests that AudioBufferSourceNode validates AudioBuffer in .buffer a ttribute setter.");
17
18 var context;
19 var source;
20
21 function runTest() {
22 if (window.testRunner) {
23 testRunner.dumpAsText();
24 testRunner.waitUntilDone();
25 }
26
27 window.jsTestIsAsync = true;
28
29 context = new AudioContext();
30 source = context.createBufferSource();
31
32 // Make sure we can't set to something which isn't an AudioBuffer.
33 shouldThrow("source.buffer = 57", '"TypeError: Failed to set the \'buffer\' property on \'AudioBufferSourceNode\': The provided value is not of type \'Audio Buffer\'."');
34 shouldThrow("source.buffer = null", '"TypeError: Failed to set the \'buffer\ ' property on \'AudioBufferSourceNode\': The provided value is not of type \'Aud ioBuffer\'."');
35
36 // Check that mono buffer can be set.
37 try {
38 var monoBuffer = context.createBuffer(1, 1024, context.sampleRate);
39 var testSource = context.createBufferSource();
40 testSource.buffer = monoBuffer;
41 testPassed("Mono buffer can be set.");
42 } catch(e) {
43 testFailed("Mono buffer can not be set.");
44 }
45
46 // Check that stereo buffer can be set.
47 try {
48 var stereoBuffer = context.createBuffer(2, 1024, context.sampleRate);
49 var testSource = context.createBufferSource();
50 testSource.buffer = stereoBuffer;
51 testPassed("Stereo buffer can be set.");
52 } catch(e) {
53 testFailed("Stereo buffer can not be set.");
54 }
55
56 // Check buffers with more than two channels.
57 for (var i = 3; i < 10; ++i) {
58 try {
59 var buffer = context.createBuffer(i, 1024, context.sampleRate);
60 var testSource = context.createBufferSource();
61 testSource.buffer = buffer;
62 var message = i + " channels buffer can be set.";
63 testPassed(message);
64 } catch(e) {
65 var message = i + " channels buffer can not be set.";
66 testFailed(message);
67 }
68 }
69
70 finishJSTest();
71 }
72
73 runTest();
74
75 </script>
76
77 </body>
78 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698