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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-eventhandler.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/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 8200d223d7734049f4211335fcc04061b964a6a2..8ec5e84bbe0681c996fd3fde0f030d71e0592a28 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,93 +1,96 @@
-<!doctype html>
+<!DOCTYPE html>
<html>
<head>
+ <title>
+ offlineaudiocontext-suspend-resume-eventhandler.html
+ </title>
<script src="../../resources/testharness.js"></script>
- <script src="../../resources/testharnessreport.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();
+ <script id="layout-test-code">
+ let audit = Audit.createTaskRunner();
- var context;
- var renderQuantum = 128;
+ let context;
+ let renderQuantum = 128;
// The sample rate is multiple of the rendering quantum, so suspension
// times in the test will fall on the render quantum boundary. Although
// this is not necessary, it is easier to understand the test.
- var sampleRate = renderQuantum * 100;
+ let sampleRate = renderQuantum * 100;
- var renderDuration = 2;
- var scheduledSuspendTime = 0;
+ let renderDuration = 2;
+ let scheduledSuspendTime = 0;
// With the sample rate setting above, this ensures suspension time fall
// in to the render quantum boundary.
- var suspendInterval = 0.25;
+ let suspendInterval = 0.25;
- audit.define({
- label: 'test',
- description: 'Test event handler from resume() and suspend()'
- }, (task, should) => {
- context =
- new OfflineAudioContext(1, sampleRate * renderDuration, sampleRate);
+ audit.define(
+ {
+ label: 'test',
+ description: 'Test event handler from resume() and suspend()'
+ },
+ (task, should) => {
+ context = new OfflineAudioContext(
+ 1, sampleRate * renderDuration, sampleRate);
- context.onstatechange = function() {
- if (context.state === 'suspended' &&
- context.currentTime === scheduledSuspendTime) {
- should(
- context.state === 'suspended' &&
- context.currentTime === scheduledSuspendTime,
- 'onstatechange event handler: context is suspended at ' +
- scheduledSuspendTime + ' second(s)')
- .beTrue();
- scheduledSuspendTime = context.currentTime + suspendInterval;
+ context.onstatechange = function() {
+ if (context.state === 'suspended' &&
+ context.currentTime === scheduledSuspendTime) {
+ should(
+ context.state === 'suspended' &&
+ context.currentTime === scheduledSuspendTime,
+ '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) {
- should(
- () => context.suspend(scheduledSuspendTime),
- 'Scheduling a new suspend at ' + scheduledSuspendTime +
- ' second(s)')
- .notThrow();
- ;
- }
+ // Scheduling a suspend before the render duration should pass.
+ if (scheduledSuspendTime < renderDuration) {
+ 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(
- context.suspend(scheduledSuspendTime),
- 'Scheduling at ' + renderDuration + ' seconds')
- .beRejected();
- }
+ // Scheduling a suspend exactly at the render duration should be
+ // rejected.
+ if (scheduledSuspendTime === renderDuration) {
+ should(
+ context.suspend(scheduledSuspendTime),
+ 'Scheduling at ' + renderDuration + ' seconds')
+ .beRejected();
+ }
- context.resume();
- }
- };
+ context.resume();
+ }
+ };
- // This test is for verifying all the event handlers on OAC and that is
- // why 'oncomplete' is used here.
- context.oncomplete = function() {
- should(context.state, 'oncomplete event handler: context.state')
- .beEqualTo('closed');
- task.done();
- };
+ // This test is for verifying all the event handlers on OAC and that
+ // is why 'oncomplete' is used here.
+ context.oncomplete = function() {
+ should(context.state, 'oncomplete event handler: context.state')
+ .beEqualTo('closed');
+ task.done();
+ };
- // Schedule the first suspension.
- should(
- () => context.suspend(scheduledSuspendTime),
- 'A new suspend has been scheduled at ' + scheduledSuspendTime +
- ' second(s)')
- .notThrow();
- ;
+ // Schedule the first suspension.
+ should(
+ () => context.suspend(scheduledSuspendTime),
+ 'A new suspend has been scheduled at ' + scheduledSuspendTime +
+ ' second(s)')
+ .notThrow();
+ ;
- context.startRendering();
- });
+ context.startRendering();
+ });
audit.run();
</script>
-
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698