Index: third_party/WebKit/LayoutTests/webaudio/Panner/panner-automation-basic.html |
diff --git a/third_party/WebKit/LayoutTests/webaudio/Panner/panner-automation-basic.html b/third_party/WebKit/LayoutTests/webaudio/Panner/panner-automation-basic.html |
index 0f363a049deb17ea27d5f4d58dd276d63398ac2e..1e9a2c1ed5e936d752b6779eda749544bae1c883 100644 |
--- a/third_party/WebKit/LayoutTests/webaudio/Panner/panner-automation-basic.html |
+++ b/third_party/WebKit/LayoutTests/webaudio/Panner/panner-automation-basic.html |
@@ -1,29 +1,30 @@ |
-<!doctype html> |
+<!DOCTYPE html> |
<html> |
<head> |
+ <title> |
+ Test Basic PannerNode with Automation Position Properties |
+ </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> |
<script src="../resources/panner-formulas.js"></script> |
- <title>Test Basic PannerNode with Automation Position Properties</title> |
</head> |
- |
<body> |
- <script> |
- var sampleRate = 48000; |
+ <script id="layout-test-code"> |
+ let sampleRate = 48000; |
// These tests are quite slow, so don't run for many frames. 256 frames |
// should be enough to demonstrate that automations are working. |
- var renderFrames = 256; |
- var renderDuration = renderFrames / sampleRate; |
+ let renderFrames = 256; |
+ let renderDuration = renderFrames / sampleRate; |
- var audit = Audit.createTaskRunner(); |
+ let audit = Audit.createTaskRunner(); |
// Array of tests for setting the panner positions. These tests basically |
// verify that the position setters for the panner and listener are |
// working correctly. |
- var testConfig = [ |
+ let testConfig = [ |
{ |
setter: 'positionX', |
}, |
@@ -37,15 +38,15 @@ |
// Create tests for the panner position setters. Both mono and steroe |
// sources are tested. |
- for (var k = 0; k < testConfig.length; ++k) { |
- var config = testConfig[k]; |
+ for (let k = 0; k < testConfig.length; ++k) { |
+ let config = testConfig[k]; |
// Function to create the test to define the test. |
- var tester = function(config, channelCount) { |
+ let tester = function(config, channelCount) { |
return (task, should) => { |
- var nodes = createGraph(channelCount); |
- var {context, source, panner} = nodes; |
+ let nodes = createGraph(channelCount); |
+ let {context, source, panner} = nodes; |
- var message = channelCount == 1 ? 'Mono' : 'Stereo'; |
+ let message = channelCount == 1 ? 'Mono' : 'Stereo'; |
message += ' panner.' + config.setter; |
testPositionSetter(should, { |
@@ -62,15 +63,15 @@ |
// Create tests for the listener position setters. Both mono and steroe |
// sources are tested. |
- for (var k = 0; k < testConfig.length; ++k) { |
- var config = testConfig[k]; |
+ for (let k = 0; k < testConfig.length; ++k) { |
+ let config = testConfig[k]; |
// Function to create the test to define the test. |
- var tester = function(config, channelCount) { |
+ let tester = function(config, channelCount) { |
return (task, should) => { |
- var nodes = createGraph(channelCount); |
- var {context, source, panner} = nodes; |
+ let nodes = createGraph(channelCount); |
+ let {context, source, panner} = nodes; |
- var message = channelCount == 1 ? 'Mono' : 'Stereo'; |
+ let message = channelCount == 1 ? 'Mono' : 'Stereo'; |
message += ' listener.' + config.setter; |
// Some relatively arbitrary (non-default) position for the source |
@@ -91,14 +92,14 @@ |
// Test setPosition method. |
audit.define('setPosition', (task, should) => { |
- var {context, panner, source} = createGraph(2); |
+ let {context, panner, source} = createGraph(2); |
// Initialize source position (values don't really matter). |
panner.setPosition(1, 1, 1); |
// After some (unimportant) time, move the panner to a (any) new |
// location. |
- var suspendFrame = 128; |
+ let suspendFrame = 128; |
context.suspend(suspendFrame / sampleRate) |
.then(function() { |
panner.setPosition(-100, 2000, 8000); |
@@ -115,7 +116,7 @@ |
}); |
audit.define('orientation setter', (task, should) => { |
- var {context, panner, source} = createGraph(2); |
+ let {context, panner, source} = createGraph(2); |
// For orientation to matter, we need to make the source directional, |
// and also move away from the listener (because the default location is |
@@ -128,7 +129,7 @@ |
// After some (unimportant) time, change the panner orientation to a new |
// orientation. The only constraint is that the orientation changes |
// from before. |
- var suspendFrame = 128; |
+ let suspendFrame = 128; |
context.suspend(suspendFrame / sampleRate) |
.then(function() { |
panner.orientationX.value = -100; |
@@ -148,7 +149,7 @@ |
}); |
audit.define('forward setter', (task, should) => { |
- var {context, panner, source} = createGraph(2); |
+ let {context, panner, source} = createGraph(2); |
// For orientation to matter, we need to make the source directional, |
// and also move away from the listener (because the default location is |
@@ -161,7 +162,7 @@ |
// After some (unimportant) time, change the panner orientation to a new |
// orientation. The only constraint is that the orientation changes |
// from before. |
- var suspendFrame = 128; |
+ let suspendFrame = 128; |
context.suspend(suspendFrame / sampleRate) |
.then(function() { |
context.listener.forwardX.value = -100; |
@@ -181,7 +182,7 @@ |
}); |
audit.define('up setter', (task, should) => { |
- var {context, panner, source} = createGraph(2); |
+ let {context, panner, source} = createGraph(2); |
// For orientation to matter, we need to make the source directional, |
// and also move away from the listener (because the default location is |
@@ -195,7 +196,7 @@ |
// After some (unimportant) time, change the panner orientation to a new |
// orientation. The only constraint is that the orientation changes |
// from before. |
- var suspendFrame = 128; |
+ let suspendFrame = 128; |
context.suspend(suspendFrame / sampleRate) |
.then(function() { |
context.listener.upX.value = 100; |
@@ -217,9 +218,9 @@ |
audit.run(); |
function createGraph(channelCount) { |
- var context = new OfflineAudioContext(2, renderFrames, sampleRate); |
- var panner = context.createPanner(); |
- var source = context.createBufferSource(); |
+ let context = new OfflineAudioContext(2, renderFrames, sampleRate); |
+ let panner = context.createPanner(); |
+ let source = context.createBufferSource(); |
source.buffer = |
createConstantBuffer(context, 1, channelCount == 1 ? 1 : [1, 2]); |
source.loop = true; |
@@ -232,16 +233,16 @@ |
} |
function testPositionSetter(should, options) { |
- var {nodes, pannerSetter, message} = options; |
+ let {nodes, pannerSetter, message} = options; |
- var {context, source, panner} = nodes; |
+ let {context, source, panner} = nodes; |
// Set panner x position. (Value doesn't matter); |
pannerSetter.value = 1; |
// Wait a bit and set a new position. (Actual time and position doesn't |
// matter). |
- var suspendFrame = 128; |
+ let suspendFrame = 128; |
context.suspend(suspendFrame / sampleRate) |
.then(function() { |
pannerSetter.value = 10000; |
@@ -256,13 +257,13 @@ |
} |
function verifyPannerOutputChanged(should, resultBuffer, options) { |
- var {message, suspendFrame} = options; |
+ let {message, suspendFrame} = options; |
// Verify that the first part of output is constant. (Doesn't matter |
// what.) |
- var data0 = resultBuffer.getChannelData(0); |
- var data1 = resultBuffer.getChannelData(1); |
+ let data0 = resultBuffer.getChannelData(0); |
+ let data1 = resultBuffer.getChannelData(1); |
- var middle = '[0, ' + suspendFrame + ') '; |
+ let middle = '[0, ' + suspendFrame + ') '; |
should( |
data0.slice(0, suspendFrame), |
message + '.value frame ' + middle + 'channel 0') |
@@ -292,7 +293,6 @@ |
message + ': Output at frame ' + suspendFrame + ' channel 1') |
.notBeEqualTo(data1[0]); |
} |
- |
</script> |
</body> |
</html> |