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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/DynamicsCompressor/dynamicscompressor-simple.html

Issue 2673743002: Convert DynamicsCompressor 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
Index: third_party/WebKit/LayoutTests/webaudio/DynamicsCompressor/dynamicscompressor-simple.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/DynamicsCompressor/dynamicscompressor-simple.html b/third_party/WebKit/LayoutTests/webaudio/DynamicsCompressor/dynamicscompressor-simple.html
index 999f45ba25e18ca7c019a9a14b1b6bc68205e982..3d09f4fbd889f7c2b7f31ea685779916b53aee48 100644
--- a/third_party/WebKit/LayoutTests/webaudio/DynamicsCompressor/dynamicscompressor-simple.html
+++ b/third_party/WebKit/LayoutTests/webaudio/DynamicsCompressor/dynamicscompressor-simple.html
@@ -1,17 +1,15 @@
<!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>
+ <script src="../resources/audit.js"></script>
</head>
<body>
- <div id="description"></div>
- <div id="console"></div>
-
<script>
- description("Test pre-emphasis in DynamicsCompressor is removed");
+ var audit = Audit.createTaskRunner();
var context;
var compressor;
var sampleRate = 44100;
@@ -22,8 +20,7 @@
// filters, the peak value is about 0.21. Without it, the peak is about 0.84.
var peakThreshold = 0.83;
- function checkResult(event) {
- var renderedBuffer = event.renderedBuffer;
+ function checkResult(renderedBuffer, should) {
renderedData = renderedBuffer.getChannelData(0);
// Search for a peak in the last part of the data.
var startSample = sampleRate * (lengthInSeconds - .1);
@@ -37,23 +34,17 @@
peak = sample;
}
- if (peak >= peakThreshold) {
- testPassed("Pre-emphasis effect not applied as expected..");
- } else {
- testFailed("Pre-emphasis caused output to be decreased to " + peak
- + " (expected >= " + peakThreshold + ")");
- }
+ should(peak >= peakThreshold, "Pre-emphasis effect not applied")
+ .beTrue();
- if (compressor.reduction)
- testPassed("Reduction value changed as expected.")
- else
- testFailed("Reduction value is still the default value of 0.");
- finishJSTest();
+ should(compressor.reduction !== 0,
+ "Reduction value changed")
+ .beTrue();
}
- function runTest() {
- window.jsTestIsAsync = true;
-
+ audit.define("test", function (task, should) {
+ task.describe("Test pre-emphasis in DynamicsCompressor is removed");
+
context = new OfflineAudioContext(1, sampleRate * lengthInSeconds, sampleRate);
// Connect an oscillator to a gain node to the compressor. The
// oscillator frequency is set to a high value for the (original)
@@ -69,13 +60,13 @@
gain.connect(compressor);
compressor.connect(context.destination);
osc.start();
- context.oncomplete = checkResult;
- context.startRendering();
- }
-
- runTest();
- successfullyParsed = true;
+ context.startRendering()
+ .then(buffer => checkResult(buffer, should))
+ .then(() => task.done());;
+ });
+
+ audit.run();
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698