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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/onstatechange.html

Issue 2895963003: Apply layout-test-tidy to LayoutTests/webaudio (Closed)
Patch Set: Created 3 years, 7 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/onstatechange.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/onstatechange.html b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/onstatechange.html
index 56781a3d2dea7dfd1c2e29d1ec76346bb017df53..85d784915b857e0c4f6b081b32118e1be0f43272 100644
--- a/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/onstatechange.html
+++ b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/onstatechange.html
@@ -1,84 +1,83 @@
-<!doctype html>
+<!DOCTYPE html>
<html>
<head>
- <title>Test statechange event</title>
+ <title>
+ Test statechange event
+ </title>
<script src="../../resources/testharness.js"></script>
- <script src="../../resources/testharnessreport.js"></script>
- <script src="../resources/audit-util.js"/></script>
- <script src="../resources/audit.js"/></script>
+ <script src="../../resources/testharnessreport.js"></script>
+ <script src="../resources/audit-util.js"></script>
+ <script src="../resources/audit.js"></script>
</head>
-
<body>
- <script>
- var audit = Audit.createTaskRunner();
- var secondsToRender = 2;
- var sampleRate = 48000;
+ <script id="layout-test-code">
+ let audit = Audit.createTaskRunner();
+ let secondsToRender = 2;
+ let sampleRate = 48000;
- var stateChangeCount = 0;
- var context;
- var contextState;
+ let stateChangeCount = 0;
+ let context;
+ let contextState;
- function checkStateChange (e, should) {
+ function checkStateChange(e, should) {
contextState = e.currentTarget.state;
switch (stateChangeCount) {
- case 0:
- should(contextState, "context.state")
- .beEqualTo("running");
- break;
- case 1:
- should(contextState, "context.state")
- .beEqualTo("closed");
- break;
- default:
- should(stateChangeCount, "Number of state changes")
- .beLessThanOrEqualTo(2)
+ case 0:
+ should(contextState, 'context.state').beEqualTo('running');
+ break;
+ case 1:
+ should(contextState, 'context.state').beEqualTo('closed');
+ break;
+ default:
+ should(stateChangeCount, 'Number of state changes')
+ .beLessThanOrEqualTo(2)
}
++stateChangeCount;
}
function finalCheck(should) {
- // Final check that we got the right number of state changes and the correct final state.
- should(stateChangeCount, "stateChangeCount")
- .beEqualTo(2);
- should(context.state, "After rendering context.state")
- .beEqualTo("closed");
+ // Final check that we got the right number of state changes and the
+ // correct final state.
+ should(stateChangeCount, 'stateChangeCount').beEqualTo(2);
+ should(context.state, 'After rendering context.state')
+ .beEqualTo('closed');
}
- audit.define({
- label: 'test',
- description: 'Signaling of statechange event'
- }, (task, should) => {
- // Create an offline context with a source passing through a convolver. The convolver is
- // just to waste some time.
- context = new OfflineAudioContext(1, secondsToRender * sampleRate, sampleRate);
- var buffer = createImpulseBuffer(context, sampleRate);
- var source = context.createBufferSource();
- var conv = context.createConvolver();
+ audit.define(
+ {label: 'test', description: 'Signaling of statechange event'},
+ (task, should) => {
+ // Create an offline context with a source passing through a
+ // convolver. The convolver is just to waste some time.
+ context = new OfflineAudioContext(
+ 1, secondsToRender * sampleRate, sampleRate);
+ let buffer = createImpulseBuffer(context, sampleRate);
+ let source = context.createBufferSource();
+ let conv = context.createConvolver();
- source.buffer = buffer;
- conv.normalize = false;
- conv.buffer = buffer;
+ source.buffer = buffer;
+ conv.normalize = false;
+ conv.buffer = buffer;
- source.connect(conv);
- conv.connect(context.destination);
+ source.connect(conv);
+ conv.connect(context.destination);
- source.start();
+ source.start();
- context.onstatechange = (event) => checkStateChange(event, should);
+ context.onstatechange = (event) => checkStateChange(event, should);
- should(context.startRendering(), "Context rendering")
- .beResolved();
+ should(context.startRendering(), 'Context rendering').beResolved();
- // Don't want to set an oncomplete for the context and don't want to use the promise because
- // the order of the state change event and resolving the promise is not specified. Thus,
- // just wait for a bit and then finish the test. We assume the offline context runs faster
- // than realtime.
- setTimeout(() => {
- finalCheck(should);
- task.done();
- }, secondsToRender * 1000);
- });
+ // Don't want to set an oncomplete for the context and don't want to
+ // use the promise because the order of the state change event and
+ // resolving the promise is not specified. Thus, just wait for a
+ // bit and then finish the test. We assume the offline context runs
+ // faster than realtime.
+ setTimeout(() => {
+ finalCheck(should);
+ task.done();
+ }, secondsToRender * 1000);
+ });
audit.run();
</script>

Powered by Google App Engine
This is Rietveld 408576698