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

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

Issue 2895963003: Apply layout-test-tidy to LayoutTests/webaudio (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>
5 audiobuffersource-channels.html
6 </title>
7 <script src="../../resources/testharness.js"></script>
8 <script src="../../resources/testharnessreport.js"></script>
9 <script src="../resources/audit-util.js"></script>
10 <script src="../resources/audit.js"></script>
11 </head>
12 <body>
13 <script id="layout-test-code">
14 let audit = Audit.createTaskRunner();
15 let context;
16 let source;
2 17
3 <html> 18 audit.define(
4 <head> 19 {
5 <script src="../../resources/testharness.js"></script> 20 label: 'validate .buffer',
6 <script src="../../resources/testharnessreport.js"></script> 21 description:
7 <script src="../resources/audit-util.js"></script> 22 'Validatation of AudioBuffer in .buffer attribute setter'
8 <script src="../resources/audit.js"></script> 23 },
9 </head> 24 function(task, should) {
25 context = new AudioContext();
26 source = context.createBufferSource();
10 27
11 <body> 28 // Make sure we can't set to something which isn't an AudioBuffer.
12 <script> 29 should(function() {
13 let audit = Audit.createTaskRunner(); 30 source.buffer = 57;
14 let context; 31 }, 'source.buffer = 57').throw('TypeError');
15 let source;
16 32
17 audit.define( 33 should(function() {
18 { 34 source.buffer = null;
19 label: 'validate .buffer', 35 }, 'source.buffer = null').throw('TypeError');
20 description: 'Validatation of AudioBuffer in .buffer attribute setter'
21 },
22 function(task, should) {
23 context = new AudioContext();
24 source = context.createBufferSource();
25 36
26 // Make sure we can't set to something which isn't an AudioBuffer. 37 // Check that mono buffer can be set.
27 should(function() { 38 should(function() {
28 source.buffer = 57; 39 let monoBuffer =
29 }, 'source.buffer = 57').throw('TypeError'); 40 context.createBuffer(1, 1024, context.sampleRate);
41 let testSource = context.createBufferSource();
42 testSource.buffer = monoBuffer;
43 }, 'Setting source with mono buffer').notThrow();
30 44
31 should(function() { 45 // Check that stereo buffer can be set.
32 source.buffer = null; 46 should(function() {
33 }, 'source.buffer = null').throw('TypeError'); 47 let stereoBuffer =
48 context.createBuffer(2, 1024, context.sampleRate);
49 let testSource = context.createBufferSource();
50 testSource.buffer = stereoBuffer;
51 }, 'Setting source with stereo buffer').notThrow();
34 52
35 // Check that mono buffer can be set. 53 // Check buffers with more than two channels.
36 should(function() { 54 for (let i = 3; i < 10; ++i) {
37 let monoBuffer = context.createBuffer(1, 1024, context.sampleRate); 55 should(function() {
38 let testSource = context.createBufferSource(); 56 let buffer = context.createBuffer(i, 1024, context.sampleRate);
39 testSource.buffer = monoBuffer; 57 let testSource = context.createBufferSource();
40 }, 'Setting source with mono buffer').notThrow(); 58 testSource.buffer = buffer;
59 }, 'Setting source with ' + i + ' channels buffer').notThrow();
60 }
61 task.done();
62 });
41 63
42 // Check that stereo buffer can be set. 64 audit.run();
43 should(function() { 65 </script>
44 let stereoBuffer = context.createBuffer(2, 1024, context.sampleRate); 66 </body>
45 let testSource = context.createBufferSource();
46 testSource.buffer = stereoBuffer;
47 }, 'Setting source with stereo buffer').notThrow();
48
49 // Check buffers with more than two channels.
50 for (let i = 3; i < 10; ++i) {
51 should(function() {
52 let buffer = context.createBuffer(i, 1024, context.sampleRate);
53 let testSource = context.createBufferSource();
54 testSource.buffer = buffer;
55 }, 'Setting source with ' + i + ' channels buffer').notThrow();
56 }
57 task.done();
58 });
59
60 audit.run();
61
62 </script>
63
64 </body>
65 </html> 67 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698