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

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

Issue 1140723003: Implement suspend() and resume() for OfflineAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Promise Resolution Created 5 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
(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 promise resolution of OfflineAudioContext resume/suspend .');
12 window.jsTestIsAsync = true;
13
14 var context;
15 var sampleRate = 44100;
16 var renderDuration = 2;
17 var renderQuantumDur = 128 / sampleRate;
18
19 var suspendCount = 0;
20 var expectedSuspendTime = [
21 0.09868480725623582,
22 0.19736961451247165,
23 0.2960544217687075,
24 0.3947392290249433,
25 0.49342403628117915,
26 0.592108843537415,
27 0.6907936507936508,
28 0.7894784580498866,
29 0.8881632653061224,
30 0.9868480725623583,
31 1.0855328798185941,
32 1.18421768707483,
33 1.2829024943310658,
34 1.3815873015873017,
35 1.4802721088435373,
36 1.5789569160997732,
37 1.677641723356009,
38 1.7763265306122449,
39 1.8750113378684807,
40 1.9736961451247166
41 ];
42
43
44 context = new OfflineAudioContext(1, sampleRate * renderDuration, sampleRa te);
45
46 function onSuspended() {
47 Should('context.currentTime', context.currentTime)
48 .beEqualTo(expectedSuspendTime[suspendCount++]);
49 context.suspend(context.currentTime + 0.1).then(onSuspended);
50 context.resume();
51 }
52
53 context.suspend(0.1).then(onSuspended);
54
55 context.startRendering().then(function () {
56 Should('context.state', context.state).beEqualTo('closed');
57 finishJSTest();
58 });
59
60 successfullyParsed = true;
61 </script>
62
63 </body>
64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698