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

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

Issue 2593083003: Convert audiobuffersource-channels to testharness (Closed)
Patch Set: Remove unneeded expected results 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(
15 description("Tests that AudioBufferSourceNode validates AudioBuffer in .buffer a ttribute setter."); 18 "AudioBufferSourceNode validates AudioBuffer in .buffer attribute setter",
hongchan 2017/01/04 21:50:11 I don't think this is the intended usage. Can we u
Raymond Toy 2017/01/04 22:24:37 Done.
16 19 function (task, should) {
17 var context;
18 var source;
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(); 20 context = new AudioContext();
29 source = context.createBufferSource(); 21 source = context.createBufferSource();
30 22
31 // Make sure we can't set to something which isn't an AudioBuffer. 23 // 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\'."'); 24 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\'."'); 25 source.buffer = 57;
26 }, "source.buffer = 57")
27 .throw("TypeError");
28
29 should(function () {
30 source.buffer = null;
31 }, "source.buffer = null")
32 .throw("TypeError");
34 33
35 // Check that mono buffer can be set. 34 // Check that mono buffer can be set.
36 try { 35 should(function () {
37 var monoBuffer = context.createBuffer(1, 1024, context.sampleRate); 36 let monoBuffer = context.createBuffer(1, 1024, context.sampleRate);
38 var testSource = context.createBufferSource(); 37 let testSource = context.createBufferSource();
39 testSource.buffer = monoBuffer; 38 testSource.buffer = monoBuffer;
40 testPassed("Mono buffer can be set."); 39 }, "Setting source with mono buffer")
41 } catch(e) { 40 .notThrow();
42 testFailed("Mono buffer can not be set.");
43 }
44 41
45 // Check that stereo buffer can be set. 42 // Check that stereo buffer can be set.
46 try { 43 should(function () {
47 var stereoBuffer = context.createBuffer(2, 1024, context.sampleRate); 44 let stereoBuffer = context.createBuffer(2, 1024, context.sampleRate);
48 var testSource = context.createBufferSource(); 45 let testSource = context.createBufferSource();
49 testSource.buffer = stereoBuffer; 46 testSource.buffer = stereoBuffer;
50 testPassed("Stereo buffer can be set."); 47 }, "Setting source with stereo buffer")
51 } catch(e) { 48 .notThrow();
52 testFailed("Stereo buffer can not be set."); 49
50 // Check buffers with more than two channels.
51 for (let i = 3; i < 10; ++i) {
52 should(function () {
53 let buffer = context.createBuffer(i, 1024, context.sampleRate);
54 let testSource = context.createBufferSource();
55 testSource.buffer = buffer;
56 }, "Setting source with " + i + " channels buffer")
57 .notThrow();
53 } 58 }
54 59 task.done();
55 // Check buffers with more than two channels. 60 });
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 61
72 runTest(); 62 audit.run();
73 63
74 </script> 64 </script>
75 65
76 </body> 66 </body>
77 </html> 67 </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