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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/event-constructor.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> 2 <html>
3 <head> 3 <head>
4 <title>Test Event Constructors</title> 4 <title>
5 Test Event Constructors
6 </title>
5 <script src="../resources/testharness.js"></script> 7 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script> 8 <script src="../resources/testharnessreport.js"></script>
7 <script src="resources/audit-util.js"></script> 9 <script src="resources/audit-util.js"></script>
8 <script src="resources/audit.js"></script> 10 <script src="resources/audit.js"></script>
9 </head> 11 </head>
10
11 <body> 12 <body>
12 <script> 13 <script id="layout-test-code">
13 var audit = Audit.createTaskRunner(); 14 let audit = Audit.createTaskRunner();
14 15
15 audit.define('offline-constructor', (task, should) => { 16 audit.define('offline-constructor', (task, should) => {
16 should(function() { 17 should(function() {
17 new OfflineAudioCompletionEvent(); 18 new OfflineAudioCompletionEvent();
18 }, 'new OfflineAudioCompletionEvent()').throw('TypeError'); 19 }, 'new OfflineAudioCompletionEvent()').throw('TypeError');
19 20
20 should(function() { 21 should(function() {
21 new OfflineAudioCompletionEvent('complete'); 22 new OfflineAudioCompletionEvent('complete');
22 }, 'new OfflineAudioCompletionEvent("complete")').throw('TypeError'); 23 }, 'new OfflineAudioCompletionEvent("complete")').throw('TypeError');
23 24
24 should( 25 should(
25 function() { 26 function() {
26 new OfflineAudioCompletionEvent('complete', {}); 27 new OfflineAudioCompletionEvent('complete', {});
27 }, 28 },
28 'new OfflineAudioCompletionEvent("complete", {})') 29 'new OfflineAudioCompletionEvent("complete", {})')
29 .throw('TypeError'); 30 .throw('TypeError');
30 31
31 should( 32 should(
32 function() { 33 function() {
33 new OfflineAudioCompletionEvent('complete', {foo: 42}); 34 new OfflineAudioCompletionEvent('complete', {foo: 42});
34 }, 35 },
35 'new OfflineAudioCompletionEvent("complete", {foo: 42})') 36 'new OfflineAudioCompletionEvent("complete", {foo: 42})')
36 .throw('TypeError'); 37 .throw('TypeError');
37 38
38 var context = new OfflineAudioContext(1, 100, 48000); 39 let context = new OfflineAudioContext(1, 100, 48000);
39 var buffer = new AudioBuffer(context, {length: 42}); 40 let buffer = new AudioBuffer(context, {length: 42});
40 41
41 should( 42 should(
42 function() { 43 function() {
43 new OfflineAudioCompletionEvent( 44 new OfflineAudioCompletionEvent(
44 'complete', {renderedBuffer: buffer}); 45 'complete', {renderedBuffer: buffer});
45 }, 46 },
46 'new OfflineAudioCompletionEvent("complete", {renderedBuffer: buffer })') 47 'new OfflineAudioCompletionEvent("complete", {renderedBuffer: buffer })')
47 .notThrow(); 48 .notThrow();
48 49
49 task.done(); 50 task.done();
50 }); 51 });
51 52
52 audit.define('offline-event', (task, should) => { 53 audit.define('offline-event', (task, should) => {
53 // Only need the context for constructing the AudioBuffers for the 54 // Only need the context for constructing the AudioBuffers for the
54 // tests. 55 // tests.
55 var context = new OfflineAudioContext(1, 100, 48000); 56 let context = new OfflineAudioContext(1, 100, 48000);
56 57
57 // Just an arbitrary AudioBuffer. 58 // Just an arbitrary AudioBuffer.
58 var buffer = new AudioBuffer(context, {length: 10}); 59 let buffer = new AudioBuffer(context, {length: 10});
59 60
60 var event; 61 let event;
61 should(function() { 62 should(function() {
62 event = 63 event =
63 new OfflineAudioCompletionEvent('foo', {renderedBuffer: buffer}); 64 new OfflineAudioCompletionEvent('foo', {renderedBuffer: buffer});
64 }, 'new OfflineAudioCompletionEvent()').notThrow(); 65 }, 'new OfflineAudioCompletionEvent()').notThrow();
65 66
66 should(event.renderedBuffer == buffer, 'event.renderedBuffer == buffer') 67 should(event.renderedBuffer == buffer, 'event.renderedBuffer == buffer')
67 .beEqualTo(true); 68 .beEqualTo(true);
68 69
69 task.done(); 70 task.done();
70 }); 71 });
71 72
72 audit.define('audio-processing', (task, should) => { 73 audit.define('audio-processing', (task, should) => {
73 // Only need the context for constructing the AudioBuffers for the 74 // Only need the context for constructing the AudioBuffers for the
74 // tests. 75 // tests.
75 var context = new OfflineAudioContext(1, 100, 48000); 76 let context = new OfflineAudioContext(1, 100, 48000);
76 77
77 // Fairly arbitrary buffers and time 78 // Fairly arbitrary buffers and time
78 var input = new AudioBuffer(context, {length: 10}); 79 let input = new AudioBuffer(context, {length: 10});
79 var output = new AudioBuffer(context, {length: 20}); 80 let output = new AudioBuffer(context, {length: 20});
80 var time = Math.PI; 81 let time = Math.PI;
81 82
82 // Verify required arguments. 83 // Verify required arguments.
83 should(function() { 84 should(function() {
84 new AudioProcessingEvent(); 85 new AudioProcessingEvent();
85 }, 'new AudioProcessingEvent()').throw('TypeError'); 86 }, 'new AudioProcessingEvent()').throw('TypeError');
86 87
87 should(function() { 88 should(function() {
88 new AudioProcessingEvent('proc'); 89 new AudioProcessingEvent('proc');
89 }, 'new AudioProcessingEvent("proc")').throw('TypeError'); 90 }, 'new AudioProcessingEvent("proc")').throw('TypeError');
90 91
(...skipping 23 matching lines...) Expand all
114 function() { 115 function() {
115 new AudioProcessingEvent( 116 new AudioProcessingEvent(
116 'proc', {outputBuffer: output, playbackTime: time}); 117 'proc', {outputBuffer: output, playbackTime: time});
117 }, 118 },
118 'new AudioProcessingEvent("proc", ' + 119 'new AudioProcessingEvent("proc", ' +
119 '{outputBuffer: output, playbackTime: time})') 120 '{outputBuffer: output, playbackTime: time})')
120 .throw('TypeError'); 121 .throw('TypeError');
121 122
122 123
123 // Finally test valid call 124 // Finally test valid call
124 var event; 125 let event;
125 should( 126 should(
126 function() { 127 function() {
127 event = new AudioProcessingEvent('proc', { 128 event = new AudioProcessingEvent('proc', {
128 inputBuffer: input, 129 inputBuffer: input,
129 outputBuffer: output, 130 outputBuffer: output,
130 playbackTime: time 131 playbackTime: time
131 }); 132 });
132 }, 133 },
133 'new AudioProcessingEvent("proc", ' + 134 'new AudioProcessingEvent("proc", ' +
134 '{inputBuffer: input, outputBuffer: output, playbackTime: time}) ') 135 '{inputBuffer: input, outputBuffer: output, playbackTime: time}) ')
135 .notThrow(); 136 .notThrow();
136 137
137 should(event.playbackTime, 'event.playbackTime').beEqualTo(time); 138 should(event.playbackTime, 'event.playbackTime').beEqualTo(time);
138 139
139 should(event.inputBuffer == input, 'event.inputBuffer == input') 140 should(event.inputBuffer == input, 'event.inputBuffer == input')
140 .beEqualTo(true); 141 .beEqualTo(true);
141 142
142 should(event.outputBuffer == output, 'event.outputBuffer == output') 143 should(event.outputBuffer == output, 'event.outputBuffer == output')
143 .beEqualTo(true); 144 .beEqualTo(true);
144 145
145 task.done(); 146 task.done();
146 }); 147 });
147 148
148 audit.run(); 149 audit.run();
149 </script> 150 </script>
150 </body> 151 </body>
151 </html> 152 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698