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

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

Issue 2676343003: Convert OfflineAudioContext Audit tests to testharness (Closed)
Patch Set: Created 3 years, 10 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: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-basic.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-basic.html b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-basic.html
index ba06bce419ed6c1499d2ef3b59a6b91ffd02f8b5..be3c3cccf553558c989491bc322e99d9463397c6 100644
--- a/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-basic.html
+++ b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-basic.html
@@ -1,15 +1,14 @@
<!doctype html>
<html>
<head>
- <script src="../../resources/js-test.js"></script>
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
<script src="../resources/audit-util.js"></script>
<script src="../resources/audio-testing.js"></script>
</head>
<body>
<script>
- description('Basic test for OfflineAudioContext.suspend() and OfflineAudioContext.resume().');
- window.jsTestIsAsync = true;
var sampleRate = 44100;
var renderDuration = 1;
@@ -70,12 +69,12 @@
var suspendTime1 = renderQuantum / sampleRate;
var suspendTime2 = 1.5 * renderQuantum / sampleRate;
- context.suspend(suspendTime1).then(function () {
- context.resume();
- });
-
- // Printing out the pass message to be more informative here.
- testPassed('Scheduling a suspend at frame ' + suspendTime1 * sampleRate + ' was successful.');
+ Should(
+ 'Scheduling a suspend at frame ' + suspendTime1 * sampleRate,
+ () => context.suspend(suspendTime1).then(function() {
+ context.resume();
+ }))
hongchan 2017/02/07 18:26:15 Perhaps: () => { context.suspend(suspendTime1)
Raymond Toy 2017/02/14 16:27:57 Done. And reindented using clang-format.
+ .notThrow();
Should('Scheduling another suspend at the same rendering quantum',
context.suspend(suspendTime2)).beRejected();
@@ -105,10 +104,14 @@
osc.start();
// A suspend is scheduled at the 90% of the render duration.
- context.suspend(longRenderDuration * 0.9).then(done);
-
- testPassed('Scheduling a suspend at ' + longRenderDuration * 0.9 + ' seconds.');
-
+ Should(
+ 'Scheduling a suspend at ' + longRenderDuration * 0.9 + ' seconds',
+ () => {
+ // Test is finished when this suspend resolves.
+ context.suspend(longRenderDuration * 0.9).then(done);
+ })
+ .notThrow();
+
// We have to start rendering to get the time running.
context.startRendering();
@@ -127,7 +130,6 @@
});
audit.defineTask('finish', function (done) {
- finishJSTest();
done();
});
hongchan 2017/02/07 18:26:15 This task can be removed.
Raymond Toy 2017/02/14 16:27:57 Done.

Powered by Google App Engine
This is Rietveld 408576698