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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/test-basic.html

Issue 2698843003: Convert more miscellaneous 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 | « third_party/WebKit/LayoutTests/webaudio/audiosummingjunction-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/webaudio/test-basic.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/test-basic.html b/third_party/WebKit/LayoutTests/webaudio/test-basic.html
index 6bc29bef503a4cfd7979af11f48aa77d2d39d24f..878bcd422f94dc82011af07fb0f8610917810282 100644
--- a/third_party/WebKit/LayoutTests/webaudio/test-basic.html
+++ b/third_party/WebKit/LayoutTests/webaudio/test-basic.html
@@ -8,50 +8,58 @@ The left channel will be a 880Hz tone, while the right will be 440Hz.
<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>
</head>
<body>
-
-<div id="description"></div>
-<div id="console"></div>
-
<script>
-description("Tests basic audio test infrastructure: specifically testRunner.setAudioData()");
+let audit = Audit.createTaskRunner();
-var sampleRate = 44100.0;
-var lengthInSeconds = 2;
+let sampleRate = 44100.0;
+let lengthInSeconds = 2;
function generateSinWave(audioBuffer) {
- var n = audioBuffer.length;
- var channelL = audioBuffer.getChannelData(0);
- var channelR = audioBuffer.getChannelData(1);
- var sampleRate = audioBuffer.sampleRate;
-
- for (var i = 0; i < n; ++i) {
- channelL[i] = Math.sin(880.0 * 2.0*Math.PI * i / sampleRate);
- channelR[i] = Math.sin(440.0 * 2.0*Math.PI * i / sampleRate);
- }
+ let n = audioBuffer.length;
+ let channelL = audioBuffer.getChannelData(0);
+ let channelR = audioBuffer.getChannelData(1);
+ let sampleRate = audioBuffer.sampleRate;
+
+ for (let i = 0; i < n; ++i) {
+ channelL[i] = Math.sin(880.0 * 2.0 * Math.PI * i / sampleRate);
+ channelR[i] = Math.sin(440.0 * 2.0 * Math.PI * i / sampleRate);
+ }
}
-function runTest() {
- if (!window.testRunner)
+audit.define(
+ {
+ label: 'test',
+ description:
+ 'Basic audio test infrastructure: testRunner.setAudioData()'
+ },
+ (task, should) => {
+ if (!window.testRunner) {
+ should(!window.testRunner, 'window.testRunner is defined').beTrue();
+ task.done();
return;
-
- var context = new AudioContext();
- var audioBuffer = context.createBuffer(2, lengthInSeconds * sampleRate, sampleRate);
-
- generateSinWave(audioBuffer);
+ }
- var audioData = createAudioData(audioBuffer);
- testRunner.setAudioData(audioData);
+ let context = new AudioContext();
+ let audioBuffer =
+ context.createBuffer(2, lengthInSeconds * sampleRate, sampleRate);
- testRunner.notifyDone();
-}
+ generateSinWave(audioBuffer);
+
+ let audioData = createAudioData(audioBuffer);
+ testRunner.setAudioData(audioData);
+
+ testRunner.notifyDone();
+ task.done();
+ });
-runTest();
+audit.run();
</script>
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/audiosummingjunction-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698