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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/Analyser/automatic-pull-node.html

Issue 2591923002: Convert to use testharness.js (Closed)
Patch Set: Fix typo. Created 4 years 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 | 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/Analyser/automatic-pull-node.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/Analyser/automatic-pull-node.html b/third_party/WebKit/LayoutTests/webaudio/Analyser/automatic-pull-node.html
index a46a49c3f69e6618d18bdee76324e8884b6c7685..afd3deebbcc38005e92ebedb6e3e7f3da5cad760 100644
--- a/third_party/WebKit/LayoutTests/webaudio/Analyser/automatic-pull-node.html
+++ b/third_party/WebKit/LayoutTests/webaudio/Analyser/automatic-pull-node.html
@@ -2,19 +2,18 @@
<html>
<head>
-<script src="../../resources/js-test.js"></script>
-<script src="../resources/compatibility.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("This test verifies that the AudioBasicInspectorNode based nodes work correctly.");
+//description("This test verifies that the AudioBasicInspectorNode based nodes work correctly.");
hongchan 2016/12/22 17:41:07 A plain comment would be better since we're not us
Raymond Toy 2016/12/22 17:57:57 Oops. I meant to remove this. But a comment is bet
+
+var audit = Audit.createTaskRunner();
var sampleRate = 44100.0;
// We carefully arrange the renderLengthInFrames to be a multiple of the AudioNode rendering quantum (AudioNode::ProcessingSizeInFrames)
@@ -44,70 +43,63 @@ function constructCommonGraph() {
bufferSource.connect(analyser);
}
-function test1Finished() {
+function test1Finished(should) {
var timeDomainData = new Uint8Array(fftSize);
analyser.getByteTimeDomainData(timeDomainData);
- if (timeDomainData[0] >= audioDataOne)
- testPassed("RealtimeAnalyserNode got pulled when connected from upstream node but not to downstream node.");
- else
- testFailed("RealtimeAnalyserNode failed to get pulled when connected from upstream node but not to downstream node.");
-
- test2();
+ should(timeDomainData[0] >= audioDataOne,
+ "RealtimeAnalyserNode got pulled when connected from upstream node but not to downstream node")
+ .beTrue();
}
// To verify the realtimeAnalyser can pull data when there is an upstream node connected to it
// but it's not connected to a downstream node.
-function test1() {
+audit.define("test1", function (task, should) {
constructCommonGraph();
bufferSource.start(0);
- context.oncomplete = test1Finished;
- context.startRendering();
-}
+ context.startRendering()
+ .then(test1Finished(should))
+ .then(task.done.bind(task));
+});
-function test2Finished() {
+function test2Finished(should) {
var timeDomainData = new Uint8Array(fftSize);
analyser.getByteTimeDomainData(timeDomainData);
- if (timeDomainData[0] >= audioDataOne)
- testPassed("RealtimeAnalyserNode got pulled when connected from upstream node and to destination node.");
- else
- testFailed("RealtimeAnalyserNode failed to be pulled when connected by upstream node and to destination node.");
-
- test3();
+ should(timeDomainData[0] >= audioDataOne,
+ "RealtimeAnalyserNode got pulled when connected from upstream node and to destination node")
+ .beTrue();
}
// To verify the realtimeAnalyser can process normally when there is an upstream node connected to it
// and it's also connected to a downstream node which ultimately connect to audio destination.
-function test2() {
+audit.define("test2", function (task, should) {
constructCommonGraph();
analyser.connect(context.destination);
bufferSource.start(0);
- context.oncomplete = test2Finished;
- context.startRendering();
-}
+ context.startRendering()
+ .then(test2Finished(should))
+ .then(task.done.bind(task));
+});
-function test3Finished() {
+function test3Finished(should) {
var timeDomainData = new Uint8Array(fftSize);
analyser.getByteTimeDomainData(timeDomainData);
// If realtimeAnalyser hasn't pulled any data, the data in buffer will be 0.
- if (timeDomainData[0] == audioDataZero)
- testPassed("RealtimeAnalyserNode didn't get pulled when it should not.");
- else
- testFailed("RealtimeAnalyserNode been pulled when it should not.");
-
- finishJSTest();
+ should(timeDomainData[0] == audioDataZero,
+ "RealtimeAnalyserNode didn't get pulled when it should not")
+ .beTrue();;
}
// To verify the realtimeAnalyser will stop pulling if it is connected to a downstream node
// which is not ultimatly connected to any audio destination.
-function test3() {
+audit.define("test3", function (task, should) {
constructCommonGraph();
var gain = context.createGain();
@@ -115,22 +107,12 @@ function test3() {
bufferSource.start(0);
- context.oncomplete = test3Finished;
- context.startRendering();
-}
-
-function runTest() {
- if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
- }
-
- window.jsTestIsAsync = true;
-
- test1();
-}
+ context.startRendering()
+ .then(test3Finished(should))
+ .then(task.done.bind(task));
+});
-runTest();
+audit.run();
</script>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698