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