Commit 3c07d6cc authored by Hongchan Choi's avatar Hongchan Choi Committed by Commit Bot

Upstream AudioWorklet tests to WPT suite

1. Tests moved:
 From - src/third_party/WebKit/LayoutTests/http/tests/webaudio/audio-worklet/
 to - src/third_party/WebKit/LayoutTests/external/wpt/webaudio/
2. All tests were renamed because of the SecureContext requirement.
3. Updated the script paths.
4. Used a variable for the processor script path.


Bug: 817869
Test: All existing tests are passing after updating paths.
Change-Id: I7bd6c91c365730e453205f2241cb45986e2c7d3b
Reviewed-on: https://chromium-review.googlesource.com/944847Reviewed-by: default avatarRaymond Toy <rtoy@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541281}
parent eff8f7fe
......@@ -318,6 +318,7 @@ external/wpt/web-animations/timing-model/animation-effects/active-time.html
external/wpt/web-animations/timing-model/animations/finishing-an-animation.html
external/wpt/web-animations/timing-model/animations/set-the-animation-start-time.html
external/wpt/web-animations/timing-model/time-transformations/transformed-progress.html
external/wpt/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html
external/wpt/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-onended.html
external/wpt/webaudio/the-audio-api/the-delaynode-interface/delaynode-scheduling.html
external/wpt/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-getFrequencyResponse.html
......@@ -822,7 +823,6 @@ http/tests/streams/chromium/get-reader-byob.html
http/tests/uri/escaped-entity.html
http/tests/uri/resolve-encoding-relative.html
http/tests/uri/utf8-path.html
http/tests/webaudio/audio-worklet/context-audio-worklet.html
http/tests/websocket/bad-handshake-crash.html
http/tests/websocket/compressed-control-frame.html
http/tests/worklet/webexposed/global-interface-listing-paint-worklet.html
......
......@@ -4,9 +4,9 @@
<title>
Test the invocation order of AudioWorklet.addModule() and BaseAudioContext
</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../../webaudio-resources/audit.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit.js"></script>
</head>
<body>
<script id="layout-test-code">
......@@ -16,6 +16,8 @@
let realtimeContext = new AudioContext();
let offlineContext = new OfflineAudioContext(1, sampleRate, sampleRate);
let filePath = 'processors/dummy-processor.js';
// Test if the browser does not crash upon addModule() call after the
// realtime context construction.
audit.define(
......@@ -47,8 +49,8 @@
});
Promise.all([
realtimeContext.audioWorklet.addModule('dummy-processor.js'),
offlineContext.audioWorklet.addModule('dummy-processor.js')
realtimeContext.audioWorklet.addModule(filePath),
offlineContext.audioWorklet.addModule(filePath)
]).then(() => {
audit.run();
});
......
......@@ -4,21 +4,24 @@
<title>
Test AudioWorkletNode's basic AudioParam features
</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../../webaudio-resources/audit.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit.js"></script>
</head>
<body>
<script id="layout-test-code">
let audit = Audit.createTaskRunner();
let context;
let sampleRate = 48000;
let renderLength = 48000 * 0.6;
let context;
let filePath = 'processors/gain-processor.js';
// Sets up AudioWorklet and OfflineAudioContext.
audit.define('Initializing AudioWorklet and Context', (task, should) => {
context = new OfflineAudioContext(1, renderLength, sampleRate);
context.audioWorklet.addModule('gain-processor.js').then(() => {
context.audioWorklet.addModule(filePath).then(() => {
task.done();
});
});
......
......@@ -4,9 +4,9 @@
<title>
Test MessagePort in AudioWorkletNode and AudioWorkletProcessor
</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../../webaudio-resources/audit.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit.js"></script>
</head>
<body>
<script id="layout-test-code">
......@@ -14,6 +14,8 @@
let context = new AudioContext();
let filePath = 'processors/port-processor.js';
// Creates an AudioWorkletNode and sets an EventHandler on MessagePort
// object. The associated PortProcessor will post a message upon its
// construction. Test if the message is received correctly.
......@@ -56,7 +58,7 @@
porterWorkletNode.port.postMessage('hello');
});
context.audioWorklet.addModule('port-processor.js').then(() => {
context.audioWorklet.addModule(filePath).then(() => {
audit.run();
});
</script>
......
......@@ -4,9 +4,9 @@
<title>
Test sampleRate in AudioWorkletGlobalScope
</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../../webaudio-resources/audit.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit.js"></script>
</head>
<body>
<script id="layout-test-code">
......@@ -16,6 +16,8 @@
let renderLength = 512;
let context = new OfflineAudioContext(1, renderLength, sampleRate);
let filePath = 'processors/one-pole-processor.js';
// Without rendering the context, attempt to access |sampleRate| in the
// global scope as soon as it is created.
audit.define(
......@@ -32,7 +34,7 @@
task.done();
});
context.audioWorklet.addModule('one-pole-processor.js').then(() => {
context.audioWorklet.addModule(filePath).then(() => {
audit.run();
});
</script>
......
......@@ -4,9 +4,9 @@
<title>
Test currentTime and currentFrame in AudioWorkletGlobalScope
</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../../webaudio-resources/audit.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit.js"></script>
</head>
<body>
<script id="layout-test-code">
......@@ -16,6 +16,8 @@
let renderLength = 512;
let context = new OfflineAudioContext(1, renderLength, sampleRate);
let filePath = 'processors/timing-info-processor.js';
audit.define(
'Check the timing information from AudioWorkletProcessor',
(task, should) => {
......@@ -47,7 +49,7 @@
});
});
context.audioWorklet.addModule('timing-info-processor.js').then(() => {
context.audioWorklet.addModule(filePath).then(() => {
audit.run();
});
</script>
......
......@@ -4,10 +4,10 @@
<title>
Test AudioWorkletNode's dynamic channel count feature
</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../../webaudio-resources/audit.js"></script>
<script src="../../../webaudio-resources/audit-util.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit.js"></script>
<script src="/webaudio/resources/audit-util.js"></script>
</head>
<body>
<script id="layout-test-code">
......@@ -18,6 +18,8 @@
let renderLength = RENDER_QUANTUM_FRAMES * 2;
let context;
let filePath = 'processors/gain-processor.js';
let testChannelValues = [1, 2, 3];
// Creates a 3-channel buffer and play with BufferSourceNode. The source
......@@ -32,7 +34,7 @@
context.channeCountMode = 'explicit';
context.channelInterpretation = 'discrete';
context.audioWorklet.addModule('gain-processor.js').then(() => {
context.audioWorklet.addModule(filePath).then(() => {
let testBuffer = createConstantBuffer(context, 1, testChannelValues);
let sourceNode = new AudioBufferSourceNode(context);
let gainWorkletNode = new AudioWorkletNode(context, 'gain');
......
......@@ -4,9 +4,9 @@
<title>
Test the construction of AudioWorkletNode with real-time context
</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../../webaudio-resources/audit.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit.js"></script>
</head>
<body>
<script id="layout-test-code">
......@@ -14,6 +14,8 @@
let realtimeContext = new AudioContext();
let filePath = 'processors/dummy-processor.js';
// Test if an exception is thrown correctly when AWN constructor is
// invoked before resolving |.addModule()| promise.
audit.define(
......@@ -32,19 +34,17 @@
audit.define(
{label: 'construction-after-module-loading'},
(task, should) => {
realtimeContext.audioWorklet.addModule('dummy-processor.js')
.then(() => {
let dummyWorkletNode =
new AudioWorkletNode(realtimeContext, 'dummy');
should(dummyWorkletNode instanceof AudioWorkletNode,
'"dummyWorkletNode" is an instance of '
+ 'AudioWorkletNode')
.beTrue();
should(() => new AudioWorkletNode(realtimeContext, 'foobar'),
'Unregistered name "foobar" must throw an exception.')
.throw();
task.done();
});
realtimeContext.audioWorklet.addModule(filePath).then(() => {
let dummyWorkletNode =
new AudioWorkletNode(realtimeContext, 'dummy');
should(dummyWorkletNode instanceof AudioWorkletNode,
'"dummyWorkletNode" is an instance of AudioWorkletNode')
.beTrue();
should(() => new AudioWorkletNode(realtimeContext, 'foobar'),
'Unregistered name "foobar" must throw an exception.')
.throw();
task.done();
});
});
audit.run();
......
......@@ -4,9 +4,9 @@
<title>
Test of AudioWorkletNodeOptions
</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../../webaudio-resources/audit.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit.js"></script>
</head>
<body>
<script id="layout-test-code">
......@@ -15,10 +15,12 @@
const audit = Audit.createTaskRunner();
let context;
let filePath = 'processors/dummy-processor.js';
// Load script file and create a OfflineAudiocontext.
audit.define('setup', (task, should) => {
context = new OfflineAudioContext(1, 1, sampleRate);
context.audioWorklet.addModule('dummy-processor.js').then(() => {
context.audioWorklet.addModule(filePath).then(() => {
task.done();
});
});
......
......@@ -4,9 +4,9 @@
<title>
Test onprocessorerror handler in AudioWorkletNode
</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../../webaudio-resources/audit.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit.js"></script>
</head>
<body>
<script id="layout-test-code">
......@@ -14,9 +14,10 @@
const sampleRate = 48000;
const renderLength = sampleRate * 0.1;
let context = new OfflineAudioContext(1, renderLength, sampleRate);
let filePath = 'processors/error-processor.js';
// Test |onprocessorerror| called upon failure of processor constructor.
audit.define('constructor-error',
(task, should) => {
......@@ -46,7 +47,7 @@
// 'error-processor.js' contains 2 class definitions represents an error
// in the constructor and an error in the process method respectively.
context.audioWorklet.addModule('error-processor.js').then(() => {
context.audioWorklet.addModule(filePath).then(() => {
audit.run();
});
</script>
......
......@@ -4,20 +4,22 @@
<title>
Test cross-thread passing of AudioWorkletNodeOptions
</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../../webaudio-resources/audit.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit.js"></script>
</head>
<body>
<script id="layout-test-code">
const audit = Audit.createTaskRunner();
const context = new AudioContext();
let filePath = 'processors/option-test-processor.js';
// Create a OptionTestProcessor and feed |processorData| to it. The
// processor should echo the received data to the node's |onmessage|
// handler.
audit.define('valid-processor-data', (task, should) => {
context.audioWorklet.addModule('option-test-processor.js').then(() => {
context.audioWorklet.addModule(filePath).then(() => {
let processorOptions = {
description: 'foo',
payload: [0, 1, 2, 3]
......@@ -49,7 +51,7 @@
// Passing empty option dictionary should work without a problem.
audit.define('empty-option', (task, should) => {
context.audioWorklet.addModule('option-test-processor.js').then(() => {
context.audioWorklet.addModule(filePath).then(() => {
let optionTestNode =
new AudioWorkletNode(context, 'option-test-processor');
......
......@@ -4,9 +4,9 @@
<title>
Checking BaseAudioContext.audioWorklet
</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../../webaudio-resources/audit.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit.js"></script>
</head>
<body>
<script id="layout-test-code">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment