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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-one-sample-loop.html

Issue 2591383002: Convert audiobuffersource-one-sample-loop to testharness (Closed)
Patch Set: Simplify test 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-one-sample-loop-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-one-sample-loop.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-one-sample-loop.html b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-one-sample-loop.html
index 0e824a3cc0026395ba2ed4e8cd7016d2f1ebe417..af2366d47cf0b86fc5f2c0a3197bf34642452c5f 100644
--- a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-one-sample-loop.html
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-one-sample-loop.html
@@ -2,63 +2,44 @@
<html>
<head>
<title>Test AudioBufferSourceNode With Looping a Single-Sample Buffer</title>
- <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>
</head>
<body>
<script>
- description("Test AudioBufferSourceNode With Looping a Single-Sample Buffer");
-
- var context;
- var source;
- var buffer;
- var renderedData;
-
- var sampleRate = 44100;
- var testDurationSamples = 1000;
-
- function checkResult (event) {
- var success = true;
-
- renderedData = event.renderedBuffer.getChannelData(0);
- // Check that the rendered data is all ones, like the buffer source.
- for (k = 0; k < renderedData.length; ++k) {
- if (renderedData[k] != 1) {
- success = false;
- testFailed("Expected all ones, but sample " + k + " is " + renderedData[k]);
- break;
- }
- }
- if (success)
- testPassed("All samples equal to 1");
- finishJSTest();
- }
-
- function runTest() {
- window.jsTestIsAsync = true;
-
- // Create the offline context for the test.
- context = new OfflineAudioContext(1, testDurationSamples, sampleRate);
- context.oncomplete = checkResult;
-
- // Create the single sample buffer
- buffer = createConstantBuffer(context, 1, 1);
-
- // Create the source and connect it to the destination
- source = context.createBufferSource();
- source.buffer = buffer;
- source.loop = true;
- source.connect(context.destination);
- source.start();
-
- // Render it!
- context.startRendering();
- }
-
- runTest();
- succesfullyParsed = true;
+ let audit = Audit.createTaskRunner();
+
+ let sampleRate = 44100;
+ let testDurationSamples = 1000;
+
+ audit.define("one-sample-loop", function (task, should) {
+ // Create the offline context for the test.
+ let context = new OfflineAudioContext(1, testDurationSamples,
+ sampleRate);
+
+ // Create the single sample buffer
+ let buffer = createConstantBuffer(context, 1, 1);
+
+ // Create the source and connect it to the destination
+ let source = context.createBufferSource();
+ source.buffer = buffer;
+ source.loop = true;
+ source.connect(context.destination);
+ source.start();
+
+ // Render it!
+ context.startRendering()
+ .then(function(audioBuffer) {
+ should(audioBuffer.getChannelData(0), "Rendered data")
+ .beConstantValueOf(1);
+ })
+ .then(task.done.bind(task));;
+ });
+
+ audit.run();
</script>
</body>
</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-one-sample-loop-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698