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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontext-close-basic.html

Issue 2616623006: Convert audiocontext-close-basic and max-contexts to testharness (Closed)
Patch Set: Clean up 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/AudioContext/audiocontext-close-basic-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/AudioContext/audiocontext-close-basic.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontext-close-basic.html b/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontext-close-basic.html
index 8f34deb9a3b2578400898e0f343ab3063c68446b..6d47b8a872c6e82f514320d39af39dc4cd9308c8 100644
--- a/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontext-close-basic.html
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontext-close-basic.html
@@ -2,55 +2,63 @@
<html>
<head>
<title>Test AudioContext.close() closes many contexts</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 that closing a context releases the audio HW context");
-
- var context = null;
+ let audit = Audit.createTaskRunner();
+
+ let context = null;
// The number of contexts we want to create and close.
- var MAX_ITERATION = 100;
- var counter = 0;
+ let MAX_ITERATION = 100;
+ let counter = 0;
- function createContextAndClose() {
+ function createContextAndClose(task, should) {
// Bypass the first iteration.
if (context) {
- if (context.state != "closed") {
- testFailed("Context " + counter + " was closed but state is not closed: " + context.state);
- }
+ should(context.state, "context.state for closed context " + counter)
+ .beEqualTo("closed");
context = null;
}
// Create new context and close.
context = new AudioContext();
if (counter++ < MAX_ITERATION) {
// Recursive promise resolution.
- context.close().then(createContextAndClose, onFailure);
+ context.close().then(function () {
+ createContextAndClose(task, should);
+ }, function () {
+ onFailure(should);
+ task.done();
+ });
} else {
context.close()
- .then(function () {
- testPassed("Successfully created and closed " + MAX_ITERATION + " contexts");
- finishJSTest();
- });
+ .then(function () {
+ // |counter| is one more than MAX_ITERATION if we
+ // succeeded.
+ should(counter - 1,
+ "Number of contexts successfully created and closed")
+ .beEqualTo(MAX_ITERATION);
+ task.done();
+ });
}
}
- function onFailure(message) {
- testFailed("Context " + counter + " failed to close");
- finishJSTest();
+ function onFailure(should) {
+ should(context.state, "Context " + counter + "failed to close")
+ .beEqualTo("closed");
}
- // Initiate iteration.
- function runTest() {
- window.jsTestIsAsync = true;
- createContextAndClose();
- }
+ audit.define("test", function (task, should) {
+ task.describe("Test that closing a context releases the audio HW context");
+ createContextAndClose(task, should);
+ });
- runTest();
+ audit.run();
</script>
</body>
</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontext-close-basic-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698