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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-eventhandler.html

Issue 2680033002: Convert OfflineAudioContext tests to testharness (Closed)
Patch Set: Remove expected results and minor cleanup 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/OfflineAudioContext/offlineaudiocontext-suspend-resume-eventhandler.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-eventhandler.html b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-eventhandler.html
index 03d191b65a8a89353c6c1512910565a922cbfc6c..77e7e47e90fc1b1957bc749f0060ed5aa28eb676 100644
--- a/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-eventhandler.html
+++ b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-eventhandler.html
@@ -1,15 +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>
<script>
- description('Test event handler callback from OfflineAudioContext.resume() and OfflineAudioContext.suspend().');
- window.jsTestIsAsync = true;
+ var audit = Audit.createTaskRunner();
var context;
var renderQuantum = 128;
@@ -26,29 +26,35 @@
// in to the render quantum boundary.
var suspendInterval = 0.25;
- function runTest() {
+ audit.define('test', (task, should) => {
+ task.describe('Test event handler from resume() and suspend()');
context = new OfflineAudioContext(1, sampleRate * renderDuration, sampleRate);
context.onstatechange = function () {
if (context.state === 'suspended' && context.currentTime === scheduledSuspendTime) {
- testPassed('onstatechange event handler: context is suspended at ' +
- scheduledSuspendTime + ' second(s).');
+ should(context.state === 'suspended' && context.currentTime ===
+ scheduledSuspendTime,
hongchan 2017/02/07 18:38:43 Is this the result from clang-format? This is weir
Raymond Toy 2017/02/07 19:11:09 Bad indentation from js-beautify because I didn't
+ 'onstatechange event handler: context is suspended at ' +
+ scheduledSuspendTime + ' second(s)')
+ .beTrue();
scheduledSuspendTime = context.currentTime + suspendInterval;
// Scheduling a suspend before the render duration should pass.
if (scheduledSuspendTime < renderDuration) {
- context.suspend(scheduledSuspendTime);
- testPassed('A new suspend has been scheduled at ' +
- scheduledSuspendTime + ' second(s).');
+ should(() => context.suspend(scheduledSuspendTime),
+ 'Scheduling a new suspend at ' + scheduledSuspendTime +
+ ' second(s)')
+ .notThrow();;
}
// Scheduling a suspend exactly at the render duration should be
// rejected.
if (scheduledSuspendTime === renderDuration) {
- Should('Scheduling at ' + renderDuration + ' seconds',
- context.suspend(scheduledSuspendTime)).beRejected();
+ should(context.suspend(scheduledSuspendTime),
+ 'Scheduling at ' + renderDuration + ' seconds')
+ .beRejected();
}
context.resume();
@@ -58,19 +64,20 @@
// This test is for verifying all the event handlers on OAC and that is
// why 'oncomplete' is used here.
context.oncomplete = function () {
- Should('oncomplete event handler: context.state', context.state).beEqualTo('closed');
- finishJSTest();
+ should(context.state, 'oncomplete event handler: context.state').beEqualTo('closed');
hongchan 2017/02/07 18:38:43 Needs to be wrapped at 80.
Raymond Toy 2017/02/07 19:11:09 Done.
+ task.done();
};
// Schedule the first suspension.
- context.suspend(scheduledSuspendTime);
- testPassed('A new suspend has been scheduled at ' + scheduledSuspendTime + ' second(s).');
+ should(() => context.suspend(scheduledSuspendTime),
+ 'A new suspend has been scheduled at ' + scheduledSuspendTime +
+ ' second(s)')
+ .notThrow();;
context.startRendering();
- }
+ });
- runTest();
- successfullyParsed = true;
+ audit.run();
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698