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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-eventhandler.html

Issue 2708953003: Move task.describe descriptions to audit.define (Closed)
Patch Set: Address review comments. Created 3 years, 9 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 <script src="../../resources/testharness.js"></script> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script> 5 <script src="../../resources/testharnessreport.js"></script>
6 <script src="../resources/audit-util.js"></script> 6 <script src="../resources/audit-util.js"></script>
7 <script src="../resources/audit.js"></script> 7 <script src="../resources/audit.js"></script>
8 </head> 8 </head>
9 9
10 <body> 10 <body>
11 <script> 11 <script>
12 var audit = Audit.createTaskRunner(); 12 var audit = Audit.createTaskRunner();
13 13
14 var context; 14 var context;
15 var renderQuantum = 128; 15 var renderQuantum = 128;
16 16
17 // The sample rate is multiple of the rendering quantum, so suspension 17 // The sample rate is multiple of the rendering quantum, so suspension
18 // times in the test will fall on the render quantum boundary. Although 18 // times in the test will fall on the render quantum boundary. Although
19 // this is not necessary, it is easier to understand the test. 19 // this is not necessary, it is easier to understand the test.
20 var sampleRate = renderQuantum * 100; 20 var sampleRate = renderQuantum * 100;
21 21
22 var renderDuration = 2; 22 var renderDuration = 2;
23 var scheduledSuspendTime = 0; 23 var scheduledSuspendTime = 0;
24 24
25 // With the sample rate setting above, this ensures suspension time fall 25 // With the sample rate setting above, this ensures suspension time fall
26 // in to the render quantum boundary. 26 // in to the render quantum boundary.
27 var suspendInterval = 0.25; 27 var suspendInterval = 0.25;
28 28
29 audit.define('test', (task, should) => { 29 audit.define({
30 task.describe('Test event handler from resume() and suspend()'); 30 label: 'test',
31 description: 'Test event handler from resume() and suspend()'
32 }, (task, should) => {
31 context = 33 context =
32 new OfflineAudioContext(1, sampleRate * renderDuration, sampleRate); 34 new OfflineAudioContext(1, sampleRate * renderDuration, sampleRate);
33 35
34 context.onstatechange = function() { 36 context.onstatechange = function() {
35 if (context.state === 'suspended' && 37 if (context.state === 'suspended' &&
36 context.currentTime === scheduledSuspendTime) { 38 context.currentTime === scheduledSuspendTime) {
37 should( 39 should(
38 context.state === 'suspended' && 40 context.state === 'suspended' &&
39 context.currentTime === scheduledSuspendTime, 41 context.currentTime === scheduledSuspendTime,
40 'onstatechange event handler: context is suspended at ' + 42 'onstatechange event handler: context is suspended at ' +
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 ; 84 ;
83 85
84 context.startRendering(); 86 context.startRendering();
85 }); 87 });
86 88
87 audit.run(); 89 audit.run();
88 </script> 90 </script>
89 91
90 </body> 92 </body>
91 </html> 93 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698