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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/webaudio/offlineaudiocontext-suspend-resume-promise.html
diff --git a/LayoutTests/webaudio/offlineaudiocontext-suspend-resume-promise.html b/LayoutTests/webaudio/offlineaudiocontext-suspend-resume-promise.html
new file mode 100644
index 0000000000000000000000000000000000000000..ebc0a7c74b8d828108f02bfb29c6e744e92f1d4a
--- /dev/null
+++ b/LayoutTests/webaudio/offlineaudiocontext-suspend-resume-promise.html
@@ -0,0 +1,64 @@
+<!doctype html>
+<html>
+ <head>
+ <script src="../resources/js-test.js"></script>
+ <script src="resources/compatibility.js"></script>
+ <script src="resources/audio-testing.js"></script>
+ </head>
+
+ <body>
+ <script>
+ description('Test promise resolution of OfflineAudioContext resume/suspend.');
+ window.jsTestIsAsync = true;
+
+ var context;
+ var sampleRate = 44100;
+ var renderDuration = 2;
+ var renderQuantumDur = 128 / sampleRate;
+
+ var suspendCount = 0;
+ var expectedSuspendTime = [
+ 0.09868480725623582,
+ 0.19736961451247165,
+ 0.2960544217687075,
+ 0.3947392290249433,
+ 0.49342403628117915,
+ 0.592108843537415,
+ 0.6907936507936508,
+ 0.7894784580498866,
+ 0.8881632653061224,
+ 0.9868480725623583,
+ 1.0855328798185941,
+ 1.18421768707483,
+ 1.2829024943310658,
+ 1.3815873015873017,
+ 1.4802721088435373,
+ 1.5789569160997732,
+ 1.677641723356009,
+ 1.7763265306122449,
+ 1.8750113378684807,
+ 1.9736961451247166
+ ];
+
+
+ context = new OfflineAudioContext(1, sampleRate * renderDuration, sampleRate);
+
+ function onSuspended() {
+ Should('context.currentTime', context.currentTime)
+ .beEqualTo(expectedSuspendTime[suspendCount++]);
+ context.suspend(context.currentTime + 0.1).then(onSuspended);
+ context.resume();
+ }
+
+ context.suspend(0.1).then(onSuspended);
+
+ context.startRendering().then(function () {
+ Should('context.state', context.state).beEqualTo('closed');
+ finishJSTest();
+ });
+
+ successfullyParsed = true;
+ </script>
+
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698