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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource.html

Issue 2714853005: Convert remaining AudioBufferSource tests to testharness (Closed)
Patch Set: Address review comments. 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-loop-points.html » ('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.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource.html b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource.html
index 27ca96f5ef5a54e1edf94df492f732adf325e7d2..15da8d8eed2bccde9f6c3b2e682c4c6482326a43 100644
--- a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource.html
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource.html
@@ -6,50 +6,51 @@ See if we can load an AudioBuffer, create an AudioBufferSourceNode, attach the b
<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 type="text/javascript" src="../resources/buffer-loader.js"></script>
+<script src="../resources/audit.js"></script>
+<script src="../resources/buffer-loader.js"></script>
<script>
+let audit = Audit.createTaskRunner();
+
+let sampleRate = 44100.0;
+let lengthInSeconds = 2;
+
+let context = 0;
+let bufferLoader = 0;
+
+// Note: The text output from this test is ignored. The test will generate
+// output WAV file that is compared to the expected file and these two should
+// match exactly.
+audit.define('test', (task, should) => {
+ // This test requires testRunner to exist
+ should(window.testRunner, 'window.testRunner').notBeEqualTo(undefined);
+
+ // Create offline audio context.
+ context =
+ new OfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRate);
+
+ Audit.loadFileFromUrl('../resources/hyper-reality/br-jam-loop.wav')
+ .then(buffer => {
+ let bufferSource = context.createBufferSource();
+ bufferSource.buffer = bufferList[0];
hongchan 2017/02/27 19:12:54 Does this work? I think this should be: bufferSou
Raymond Toy 2017/02/27 19:28:48 Uhoh. This conversion isn't working, even if I cha
+
+ bufferSource.connect(context.destination);
+ bufferSource.start(0);
+
+ context.oncomplete = (event) => {
+ finishAudioTest(event);
+ task.done();
+ };
+ context.startRendering();
+ })
hongchan 2017/02/27 19:12:54 A missing semicolon.
+ testRunner.waitUntilDone();
+});
+
+audit.run();
-window.onload = init;
-
-var sampleRate = 44100.0;
-var lengthInSeconds = 2;
-
-var context = 0;
-var bufferLoader = 0;
-
-function init() {
- if (!window.testRunner)
- return;
-
- // Create offline audio context.
- context = new OfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRate);
-
- bufferLoader = new BufferLoader(
- context,
- [
- "../resources/hyper-reality/br-jam-loop.wav",
- ],
- finishedLoading
- );
-
- bufferLoader.load();
- testRunner.waitUntilDone();
-}
-
-function finishedLoading(bufferList) {
- var bufferSource = context.createBufferSource();
- bufferSource.buffer = bufferList[0];
-
- bufferSource.connect(context.destination);
- bufferSource.start(0);
-
- context.oncomplete = finishAudioTest;
- context.startRendering();
-}
hongchan 2017/02/27 19:12:54 Remove l.53~l.54.
</script>
</head>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-loop-points.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698