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

Side by Side Diff: LayoutTests/webaudio/offlineaudiocontext-suspend-resume-sequence.html

Issue 1140723003: Implement suspend() and resume() for OfflineAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Ready for Review Created 5 years, 6 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
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <script src="resources/compatibility.js"></script>
6 <script src="resources/audio-testing.js"></script>
7 </head>
8
9 <body>
10 <script>
11 description('Test OfflineAudioContext.resume() and OfflineAudioContext.sus pend() with the timed sequence.');
12 window.jsTestIsAsync = true;
13
14 var context;
15 var renderQuantum = 128;
16 var sampleRate = renderQuantum * 100;
17 var renderDuration = 2;
18
19 // Hard-coded arbitrary suspend times.
Raymond Toy 2015/06/12 21:11:36 Add more comment. Presumably, they should be in a
hongchan 2015/06/15 18:40:46 I am a bit confused. Isn't this what we agreed on?
20 var suspendTimes = [0.25, 0.75, 1.0, 0.5, 1.25, 0.0, 1.75];
21 var actualSuspendTimes = [];
22
23 // Sort utility.
24 function ascendingOrder(a, b) {
25 return a - b;
26 }
27
28 context = new OfflineAudioContext(1, sampleRate * renderDuration, sampleRa te);
29
30 for (var i = 0; i < suspendTimes.length; i++) {
31
32 // Schedule suspends in a random order, but the actual suspend time
33 // which is pushed into |actualSuspendTimes| should be in the ascending
34 // order.
35 context.suspend(suspendTimes[i]).then(function () {
36 actualSuspendTimes.push(context.currentTime);
37 context.resume();
38 });
39
40 }
41
42 context.startRendering().then(function () {
43
44 // Get sorted suspend time sequence.
45 var sortedSuspendTime = suspendTimes.sort(ascendingOrder);
46
47 // The actual suspend time and the sorted one should match.
48 Should('Sorted suspend times array', sortedSuspendTime)
49 .beEqualToArray(actualSuspendTimes);
50
51 finishJSTest();
52 });
53
54 successfullyParsed = true;
55 </script>
56
57 </body>
58 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698