| Index: third_party/WebKit/LayoutTests/webaudio/Oscillator/oscillator-basic.html
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/Oscillator/oscillator-basic.html b/third_party/WebKit/LayoutTests/webaudio/Oscillator/oscillator-basic.html
|
| index 9981d838bc71b1a5a538cb0861e15f099140f1f0..fee0cb7068467a8d06de893d8cba87fa0460d50d 100644
|
| --- a/third_party/WebKit/LayoutTests/webaudio/Oscillator/oscillator-basic.html
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/Oscillator/oscillator-basic.html
|
| @@ -1,71 +1,69 @@
|
| -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
| -
|
| +<!DOCTYPE html>
|
| <!--
|
| Create an oscillator of each type and verify that the type is set correctly.
|
| -->
|
| <html>
|
| -<head>
|
| -<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>
|
| -</head>
|
| -
|
| -<body>
|
| -<script>
|
| -var sampleRate = 44100;
|
| -var renderLengthSeconds = 0.25;
|
| -
|
| -var oscTypes = ["sine", "square", "sawtooth", "triangle", "custom"];
|
| + <head>
|
| + <title>
|
| + oscillator-basic.html
|
| + </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>
|
| + </head>
|
| + <body>
|
| + <script id="layout-test-code">
|
| + let sampleRate = 44100;
|
| + let renderLengthSeconds = 0.25;
|
|
|
| -let audit = Audit.createTaskRunner();
|
| -
|
| -audit.define("basic osc tests", (task, should) => {
|
| - // Create offline audio context.
|
| - var context = new OfflineAudioContext(2, sampleRate *
|
| - renderLengthSeconds, sampleRate);
|
| - var osc = context.createOscillator();
|
| + let oscTypes = ['sine', 'square', 'sawtooth', 'triangle', 'custom'];
|
|
|
| - // Set each possible oscillator type (except CUSTOM) and verify that the
|
| - // type is correct. Here we're setting the type using WebIDL enum values
|
| - // which are strings.
|
| - for (var k = 0; k < oscTypes.length - 1; ++k) {
|
| - osc.type = oscTypes[k];
|
| - should(osc.type, "osc.type = '" + oscTypes[k] + "'")
|
| - .beEqualTo(oscTypes[k]);
|
| - }
|
| + let audit = Audit.createTaskRunner();
|
|
|
| - // Verify that setting a custom type directly does not set the custom
|
| - // type. This test has to be done before using setPeriodicWave.
|
| + audit.define('basic osc tests', (task, should) => {
|
| + // Create offline audio context.
|
| + let context = new OfflineAudioContext(
|
| + 2, sampleRate * renderLengthSeconds, sampleRate);
|
| + let osc = context.createOscillator();
|
|
|
| - should(function () {
|
| - osc.type = "custom";
|
| - }, "osc.type = 'custom'")
|
| - .throw('InvalidStateError');
|
| + // Set each possible oscillator type (except CUSTOM) and verify that the
|
| + // type is correct. Here we're setting the type using WebIDL enum
|
| + // values which are strings.
|
| + for (let k = 0; k < oscTypes.length - 1; ++k) {
|
| + osc.type = oscTypes[k];
|
| + should(osc.type, 'osc.type = \'' + oscTypes[k] + '\'')
|
| + .beEqualTo(oscTypes[k]);
|
| + }
|
|
|
| - // Now set a custom oscillator
|
| - var coeffA = new Float32Array([0, 1, 0.5]);
|
| - var coeffB = new Float32Array([0, 0, 0]);
|
| - var wave = context.createPeriodicWave(coeffA, coeffB);
|
| + // Verify that setting a custom type directly does not set the custom
|
| + // type. This test has to be done before using setPeriodicWave.
|
|
|
| - should(function () {
|
| - osc.setPeriodicWave(wave);
|
| - }, "osc.setPeriodicWave(wave)").notThrow();
|
| - should(osc.type, "After setting periodicWave, osc.type")
|
| - .beEqualTo("custom");
|
| + should(function() {
|
| + osc.type = 'custom';
|
| + }, 'osc.type = \'custom\'').throw('InvalidStateError');
|
|
|
| - // Check that numerical values are no longer supported
|
| - var oldType = osc.type;
|
| - osc.type = 0;
|
| - should(osc.type, "osc.type = 0").notBeEqualTo(0);
|
| - should(osc.type, "osc.type").beEqualTo(oldType);
|
| + // Now set a custom oscillator
|
| + let coeffA = new Float32Array([0, 1, 0.5]);
|
| + let coeffB = new Float32Array([0, 0, 0]);
|
| + let wave = context.createPeriodicWave(coeffA, coeffB);
|
|
|
| - task.done();
|
| -});
|
| + should(function() {
|
| + osc.setPeriodicWave(wave);
|
| + }, 'osc.setPeriodicWave(wave)').notThrow();
|
| + should(osc.type, 'After setting periodicWave, osc.type')
|
| + .beEqualTo('custom');
|
|
|
| -audit.run();
|
| -</script>
|
| + // Check that numerical values are no longer supported
|
| + let oldType = osc.type;
|
| + osc.type = 0;
|
| + should(osc.type, 'osc.type = 0').notBeEqualTo(0);
|
| + should(osc.type, 'osc.type').beEqualTo(oldType);
|
|
|
| + task.done();
|
| + });
|
|
|
| -</body>
|
| + audit.run();
|
| + </script>
|
| + </body>
|
| </html>
|
|
|