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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/note-grain-on-timing.html

Issue 2594183003: Convert note-grain-on tests to testharness (Closed)
Patch Set: Clean up Created 3 years, 11 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/AudioBufferSource/note-grain-on-timing.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/note-grain-on-timing.html b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/note-grain-on-timing.html
index cc49d1a84729525c2321a0746c3a123061cd6b9f..a1ffe42a2fa8d44db130c9de07e7a068b5656828 100644
--- a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/note-grain-on-timing.html
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/note-grain-on-timing.html
@@ -1,49 +1,31 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!doctype>
<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>
+ <script src="../resources/audit.js"></script>
<script src="../resources/note-grain-on-testing.js"></script>
</head>
<body>
- <div id="description"></div>
- <div id="console"></div>
-
<script>
- description("Test timing of noteGrainOn.");
+ let audit = Audit.createTaskRunner();
- var squarePulseBuffer;
+ let squarePulseBuffer;
- function checkResult(event) {
- var buffer = event.renderedBuffer;
+ function checkResult(buffer, should) {
renderedData = buffer.getChannelData(0);
- var nSamples = renderedData.length;
+ let nSamples = renderedData.length;
- var success = true;
+ let success = true;
- var startEndFrames = findStartAndEndSamples(renderedData);
-
- success = success && verifyStartAndEndFrames(startEndFrames);
+ let startEndFrames = findStartAndEndSamples(renderedData);
- if (success) {
- testPassed("noteGrainOn timing tests passed.");
- } else {
- testFailed("noteGrainOn timing tests failed.");
- }
-
- finishJSTest();
+ success = success && verifyStartAndEndFrames(startEndFrames, should);
hongchan 2017/01/18 18:19:03 Hmm. Why do we need 'success'? The new Audit task
Raymond Toy 2017/01/18 19:33:30 Not needed anymore. It was previously used to pri
}
- function runTest() {
- if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
- }
-
- window.jsTestIsAsync = true;
-
+ audit.define("Test timing of noteGrainOn", function (task, should) {
// Create offline audio context.
context = new OfflineAudioContext(2, sampleRate * renderTime, sampleRate);
@@ -51,13 +33,14 @@
playAllGrains(context, squarePulseBuffer, numberOfTests);
- context.oncomplete = checkResult;
- context.startRendering();
- }
+ context.startRendering()
+ .then(function (audioBuffer) {
+ checkResult(audioBuffer, should);
+ })
+ .then(task.done.bind(task));;
+ });
- runTest();
- successfullyParsed = true;
-
+ audit.run();
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698