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

Unified Diff: LayoutTests/webaudio/offlineaudiocontext-suspend-resume-basic.html

Issue 1140723003: Implement suspend() and resume() for OfflineAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Initial review + layout tests 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-basic.html
diff --git a/LayoutTests/webaudio/offlineaudiocontext-suspend-resume-basic.html b/LayoutTests/webaudio/offlineaudiocontext-suspend-resume-basic.html
new file mode 100644
index 0000000000000000000000000000000000000000..67f8337c9e2059f2cdf6e9b3409a6caf304ac301
--- /dev/null
+++ b/LayoutTests/webaudio/offlineaudiocontext-suspend-resume-basic.html
@@ -0,0 +1,66 @@
+<!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('Suspending OfflineAudioContext at the same rendering block boundary.');
+ window.jsTestIsAsync = true;
+
+ var sampleRate = 44100;
+ var renderDuration = 1;
+ var renderQuantum = 128;
+
+ var audit = Audit.createTaskRunner();
+
+ // Task: Calling suspend with no argument should reject the promise.
+ audit.defineTask('suspend-no-argument', function (done) {
+ var context = new OfflineAudioContext(1, sampleRate * renderDuration, sampleRate);
+
+ Should('context.suspend()', context.suspend()).beRejected().then(done);
+ });
+
+ // Calling multiple suspends at the same rendering quantum should reject
+ // the promise.
+ audit.defineTask('identical-suspend-time', function (done) {
+ var context = new OfflineAudioContext(1, sampleRate * renderDuration, sampleRate);
+ var suspendTime1 = renderQuantum / sampleRate;
+ var suspendTime2 = (renderQuantum + renderQuantum * 0.5) / sampleRate;
+
+ context.suspend(suspendTime1);
+
+ Should('Calling multiple suspends at the same rendering quantum',
+ context.suspend(suspendTime2)).beRejected().then(done);
+ });
+
+ // Calling resume on non-suspended context should reject the promise.
+ audit.defineTask('resume-before-suspend', function (done) {
+ var context = new OfflineAudioContext(1, sampleRate * renderDuration, sampleRate);
+
+ context.suspend(1.0);
Raymond Toy 2015/05/28 16:37:34 Doesn't this produce an error because the suspend
hongchan 2015/06/09 20:49:58 Oops. This is a mistake. This should be removed.
Raymond Toy 2015/06/09 22:34:58 Oh, yeah, 1.0 isn't the start of a rendering quant
+
+ Should('Calling resume on non-suspended context', context.resume())
+ .beRejected().then(done);
Raymond Toy 2015/05/28 16:37:34 Should there also be a test for calling resume wit
hongchan 2015/06/09 20:49:58 Removing the suspend above.
+ });
+
+ audit.defineTask('finish', function (done) {
+ finishJSTest();
+ done();
+ });
+
+ audit.runTasks(
+ 'suspend-no-argument',
+ 'identical-suspend-time',
+ 'resume-before-suspend',
+ 'finish'
+ );
+
+ successfullyParsed = true;
+ </script>
+
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698