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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-promise.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>
5 offlineaudiocontext-suspend-resume-promise.html
6 </title>
4 <script src="../../resources/testharness.js"></script> 7 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script> 8 <script src="../../resources/testharnessreport.js"></script>
6 <script src="../resources/audit-util.js"></script> 9 <script src="../resources/audit-util.js"></script>
7 <script src="../resources/audit.js"></script> 10 <script src="../resources/audit.js"></script>
8 </head> 11 </head>
9
10 <body> 12 <body>
11 <script> 13 <script id="layout-test-code">
12 var audit = Audit.createTaskRunner(); 14 let audit = Audit.createTaskRunner();
13 var context; 15 let context;
14 16
15 // The sample rate is multiple of the rendering quantum, so suspension 17 // The sample rate is multiple of the rendering quantum, so suspension
16 // times fall in to the render quantum boundary. 18 // times fall in to the render quantum boundary.
17 var renderQuantum = 128; 19 let renderQuantum = 128;
18 20
19 var sampleRate = renderQuantum * 100; 21 let sampleRate = renderQuantum * 100;
20 var renderDuration = 2; 22 let renderDuration = 2;
21 var scheduledSuspendTime = 0; 23 let scheduledSuspendTime = 0;
22 24
23 // With the sample rate setting above, this ensures suspension time fall 25 // With the sample rate setting above, this ensures suspension time fall
24 // in to the render quantum boundary. 26 // in to the render quantum boundary.
25 var suspendInterval = 0.25; 27 let suspendInterval = 0.25;
26 28
27 function onSuspended(should) { 29 function onSuspended(should) {
28 if (context.state === 'suspended' && 30 if (context.state === 'suspended' &&
29 context.currentTime === scheduledSuspendTime) { 31 context.currentTime === scheduledSuspendTime) {
30 should( 32 should(
31 context.state === 'suspended' && 33 context.state === 'suspended' &&
32 context.currentTime === scheduledSuspendTime, 34 context.currentTime === scheduledSuspendTime,
33 'Context suspended at ' + scheduledSuspendTime + ' second(s)') 35 'Context suspended at ' + scheduledSuspendTime + ' second(s)')
34 .beTrue(); 36 .beTrue();
35 37
(...skipping 15 matching lines...) Expand all
51 should( 53 should(
52 context.suspend(scheduledSuspendTime), 54 context.suspend(scheduledSuspendTime),
53 'Scheduling at ' + renderDuration + ' seconds') 55 'Scheduling at ' + renderDuration + ' seconds')
54 .beRejected(); 56 .beRejected();
55 } 57 }
56 58
57 context.resume(); 59 context.resume();
58 } 60 }
59 } 61 }
60 62
61 audit.define({ 63 audit.define(
62 label: 'test', 64 {
63 description: 'Promise resolution of resume() and suspend()' 65 label: 'test',
64 }, (task, should) => { 66 description: 'Promise resolution of resume() and suspend()'
65 context = new OfflineAudioContext(1, sampleRate * renderDuration, 67 },
66 sampleRate); 68 (task, should) => {
69 context = new OfflineAudioContext(
70 1, sampleRate * renderDuration, sampleRate);
67 71
68 // Schedule the first suspension. 72 // Schedule the first suspension.
69 should(() => context.suspend(scheduledSuspendTime) 73 should(
70 .then(() => 74 () => context.suspend(scheduledSuspendTime)
71 onSuspended(should)), 75 .then(() => onSuspended(should)),
72 'Scheduling a new suspend at ' + scheduledSuspendTime + 76 'Scheduling a new suspend at ' + scheduledSuspendTime +
73 ' second(s)') 77 ' second(s)')
74 .notThrow(); 78 .notThrow();
75 79
76 context.startRendering().then(function () { 80 context.startRendering()
77 should(context.state, 'Promise context.state') 81 .then(function() {
78 .beEqualTo('closed'); 82 should(context.state, 'Promise context.state')
79 }).then(() => task.done()); 83 .beEqualTo('closed');
80 }); 84 })
85 .then(() => task.done());
86 });
81 87
82 audit.run(); 88 audit.run();
83 </script> 89 </script>
84
85 </body> 90 </body>
86 </html> 91 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698