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

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

Issue 2593083003: Convert audiobuffersource-channels to testharness (Closed)
Patch Set: Address review comments. Created 3 years, 11 months 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-channels-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 2
3 <html> 3 <html>
4 <head> 4 <head>
5 <script src="../../resources/js-test.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
6 <script src="../resources/audit-util.js"></script> 7 <script src="../resources/audit-util.js"></script>
7 <script src="../resources/audio-testing.js"></script> 8 <script src="../resources/audit.js"></script>
8 </head> 9 </head>
9 10
10 <body> 11 <body>
11 <div id="description"></div> 12 <script>
12 <div id="console"></div> 13 let audit = Audit.createTaskRunner();
14 let context;
15 let source;
13 16
14 <script> 17 audit.define("validate .buffer",
15 description("Tests that AudioBufferSourceNode validates AudioBuffer in .buffer a ttribute setter."); 18 function(task, should) {
16 19 task.describe(
17 var context; 20 "AudioBufferSourceNode validates AudioBuffer in .buffer attribute setter"
18 var source; 21 );
19
20 function runTest() {
21 if (window.testRunner) {
22 testRunner.dumpAsText();
23 testRunner.waitUntilDone();
24 }
25
26 window.jsTestIsAsync = true;
27
28 context = new AudioContext(); 22 context = new AudioContext();
29 source = context.createBufferSource(); 23 source = context.createBufferSource();
30 24
31 // Make sure we can't set to something which isn't an AudioBuffer. 25 // Make sure we can't set to something which isn't an AudioBuffer.
32 shouldThrow("source.buffer = 57", '"TypeError: Failed to set the \'buffer\' property on \'AudioBufferSourceNode\': The provided value is not of type \'Audio Buffer\'."'); 26 should(function() {
33 shouldThrow("source.buffer = null", '"TypeError: Failed to set the \'buffer\ ' property on \'AudioBufferSourceNode\': The provided value is not of type \'Aud ioBuffer\'."'); 27 source.buffer = 57;
28 }, "source.buffer = 57")
29 .throw("TypeError");
30
31 should(function() {
32 source.buffer = null;
33 }, "source.buffer = null")
34 .throw("TypeError");
34 35
35 // Check that mono buffer can be set. 36 // Check that mono buffer can be set.
36 try { 37 should(function() {
37 var monoBuffer = context.createBuffer(1, 1024, context.sampleRate); 38 let monoBuffer = context.createBuffer(1, 1024, context.sampleRate);
38 var testSource = context.createBufferSource(); 39 let testSource = context.createBufferSource();
39 testSource.buffer = monoBuffer; 40 testSource.buffer = monoBuffer;
40 testPassed("Mono buffer can be set."); 41 }, "Setting source with mono buffer")
41 } catch(e) { 42 .notThrow();
42 testFailed("Mono buffer can not be set.");
43 }
44 43
45 // Check that stereo buffer can be set. 44 // Check that stereo buffer can be set.
46 try { 45 should(function() {
47 var stereoBuffer = context.createBuffer(2, 1024, context.sampleRate); 46 let stereoBuffer = context.createBuffer(2, 1024, context.sampleRate);
48 var testSource = context.createBufferSource(); 47 let testSource = context.createBufferSource();
49 testSource.buffer = stereoBuffer; 48 testSource.buffer = stereoBuffer;
50 testPassed("Stereo buffer can be set."); 49 }, "Setting source with stereo buffer")
51 } catch(e) { 50 .notThrow();
52 testFailed("Stereo buffer can not be set."); 51
52 // Check buffers with more than two channels.
53 for (let i = 3; i < 10; ++i) {
54 should(function() {
55 let buffer = context.createBuffer(i, 1024, context.sampleRate);
56 let testSource = context.createBufferSource();
57 testSource.buffer = buffer;
58 }, "Setting source with " + i + " channels buffer")
59 .notThrow();
53 } 60 }
54 61 task.done();
55 // Check buffers with more than two channels. 62 });
56 for (var i = 3; i < 10; ++i) {
57 try {
58 var buffer = context.createBuffer(i, 1024, context.sampleRate);
59 var testSource = context.createBufferSource();
60 testSource.buffer = buffer;
61 var message = i + " channels buffer can be set.";
62 testPassed(message);
63 } catch(e) {
64 var message = i + " channels buffer can not be set.";
65 testFailed(message);
66 }
67 }
68
69 finishJSTest();
70 }
71 63
72 runTest(); 64 audit.run();
73 65
74 </script> 66 </script>
75 67
76 </body> 68 </body>
77 </html> 69 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-channels-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698