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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-sequence.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-sequence.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-sequence.html b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-sequence.html
index 7748cbd9163519f214de1cc7aac95e4e69e24984..85c3ba030e389088c7536cddd52f8aa54b0598d1 100644
--- a/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-sequence.html
+++ b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-suspend-resume-sequence.html
@@ -1,23 +1,25 @@
-<!doctype html>
+<!DOCTYPE html>
<html>
<head>
+ <title>
+ offlineaudiocontext-suspend-resume-sequence.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();
- var context;
+ <script id="layout-test-code">
+ let audit = Audit.createTaskRunner();
+ let context;
// The sample rate is multiple of the rendering quantum, so suspension
// times fall in to the render quantum boundary.
- var renderQuantum = 128;
+ let renderQuantum = 128;
- var sampleRate = renderQuantum * 100;
- var renderDuration = 2;
+ let sampleRate = renderQuantum * 100;
+ let renderDuration = 2;
// These numbers are in an arbitrary order, but not randomly generated in
// runtime to avoid moving pieces. However, it is safe to arrange them
@@ -26,61 +28,63 @@
// Also these numbers are multiple of 0.25, so they are supposed to fall
// in the render quantum boundary for easier and more intuitive
// verification.
- var suspendTimes = [0.25, 0.75, 1.0, 0.5, 1.25, 0.0, 1.75];
+ let suspendTimes = [0.25, 0.75, 1.0, 0.5, 1.25, 0.0, 1.75];
// Sorted ascending suspend time is our expected result.
- var expectedSuspendTimes = suspendTimes.slice(0).sort(function (a, b) {
+ let expectedSuspendTimes = suspendTimes.slice(0).sort(function(a, b) {
return a - b;
});
- var actualSuspendTimes = [];
+ let actualSuspendTimes = [];
- audit.define({
- label: 'test',
- description: 'resume() and suspend() with timed sequence'
- }, (task, should) => {
- context = new OfflineAudioContext(1, sampleRate * renderDuration,
- sampleRate);
+ audit.define(
+ {
+ label: 'test',
+ description: 'resume() and suspend() with timed sequence'
+ },
+ (task, should) => {
+ context = new OfflineAudioContext(
+ 1, sampleRate * renderDuration, sampleRate);
- for (var i = 0; i < suspendTimes.length; i++) {
- // Schedule suspends in a random time order, but the actual suspend
- // must happen in ascending time order.
- scheduleSuspend(i, suspendTimes[i], should);
- }
+ for (let i = 0; i < suspendTimes.length; i++) {
+ // Schedule suspends in a random time order, but the actual
+ // suspend must happen in ascending time order.
+ scheduleSuspend(i, suspendTimes[i], should);
+ }
- context.startRendering()
- .then(buffer => verifyResult(should))
- .then(() => task.done());
+ context.startRendering()
+ .then(buffer => verifyResult(should))
+ .then(() => task.done());
- });
+ });
audit.run();
function scheduleSuspend(index, suspendTime, should) {
- should(() => context.suspend(suspendTime)
- .then(() => {
+ should(
+ () => context.suspend(suspendTime).then(() => {
actualSuspendTimes.push(suspendTime);
context.resume();
}),
'Scheduling suspend #' + index + ' at ' + suspendTime +
- ' second(s)')
- .notThrow();
+ ' second(s)')
+ .notThrow();
}
function verifyResult(should) {
- for (var i = 0; i < actualSuspendTimes.length; i++) {
- var scheduledOrder = suspendTimes.indexOf(actualSuspendTimes[i]);
- var expectedOrder = expectedSuspendTimes.indexOf(actualSuspendTimes[
- i]);
-
- should(i, 'The resolution order of suspend #' + scheduledOrder +
- ' is ' + i + ' at ' + suspendTimes[scheduledOrder].toFixed(2) +
- ' second(s)')
- .beEqualTo(expectedOrder);
+ for (let i = 0; i < actualSuspendTimes.length; i++) {
+ let scheduledOrder = suspendTimes.indexOf(actualSuspendTimes[i]);
+ let expectedOrder =
+ expectedSuspendTimes.indexOf(actualSuspendTimes[i]);
+
+ should(
+ i,
+ 'The resolution order of suspend #' + scheduledOrder + ' is ' +
+ i + ' at ' + suspendTimes[scheduledOrder].toFixed(2) +
+ ' second(s)')
+ .beEqualTo(expectedOrder);
}
}
-
</script>
-
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698