| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webaudio/AudioWorkletGlobalScope.h" | 5 #include "modules/webaudio/AudioWorkletGlobalScope.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptSourceCode.h" | 7 #include "bindings/core/v8/ScriptSourceCode.h" |
| 8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
| 9 #include "bindings/core/v8/SourceLocation.h" | 9 #include "bindings/core/v8/SourceLocation.h" |
| 10 #include "bindings/core/v8/ToV8ForCore.h" | 10 #include "bindings/core/v8/ToV8ForCore.h" |
| 11 #include "bindings/core/v8/V8BindingForCore.h" | 11 #include "bindings/core/v8/V8BindingForCore.h" |
| 12 #include "bindings/core/v8/V8BindingForTesting.h" | 12 #include "bindings/core/v8/V8BindingForTesting.h" |
| 13 #include "bindings/core/v8/V8CacheOptions.h" | 13 #include "bindings/core/v8/V8CacheOptions.h" |
| 14 #include "bindings/core/v8/V8GCController.h" | 14 #include "bindings/core/v8/V8GCController.h" |
| 15 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 15 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 16 #include "core/dom/TaskRunnerHelper.h" | 16 #include "core/dom/TaskRunnerHelper.h" |
| 17 #include "core/workers/GlobalScopeCreationParams.h" | 17 #include "core/workers/GlobalScopeCreationParams.h" |
| 18 #include "core/workers/WorkerBackingThread.h" | 18 #include "core/workers/WorkerBackingThread.h" |
| 19 #include "core/workers/WorkerReportingProxy.h" | 19 #include "core/workers/WorkerReportingProxy.h" |
| 20 #include "modules/webaudio/AudioBuffer.h" | 20 #include "modules/webaudio/AudioBuffer.h" |
| 21 #include "modules/webaudio/AudioWorkletProcessor.h" | 21 #include "modules/webaudio/AudioWorkletProcessor.h" |
| 22 #include "modules/webaudio/AudioWorkletProcessorDefinition.h" | 22 #include "modules/webaudio/AudioWorkletProcessorDefinition.h" |
| 23 #include "modules/webaudio/AudioWorkletThread.h" | 23 #include "modules/webaudio/AudioWorkletThread.h" |
| 24 #include "platform/audio/AudioArray.h" |
| 24 #include "platform/bindings/ScriptState.h" | 25 #include "platform/bindings/ScriptState.h" |
| 25 #include "platform/bindings/V8BindingMacros.h" | 26 #include "platform/bindings/V8BindingMacros.h" |
| 26 #include "platform/bindings/V8ObjectConstructor.h" | 27 #include "platform/bindings/V8ObjectConstructor.h" |
| 27 #include "platform/weborigin/SecurityOrigin.h" | 28 #include "platform/weborigin/SecurityOrigin.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 29 | 30 |
| 30 namespace blink { | 31 namespace blink { |
| 31 | 32 |
| 32 namespace { | 33 namespace { |
| 33 | 34 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 output_buffer->getChannelData(0).View(); | 245 output_buffer->getChannelData(0).View(); |
| 245 float* output_array_data = output_channel_data->Data(); | 246 float* output_array_data = output_channel_data->Data(); |
| 246 EXPECT_TRUE(output_array_data); | 247 EXPECT_TRUE(output_array_data); |
| 247 | 248 |
| 248 // Fill |inputBuffer| with 1 and zero out |outputBuffer|. | 249 // Fill |inputBuffer| with 1 and zero out |outputBuffer|. |
| 249 std::fill(input_array_data, input_array_data + input_buffer->length(), 1); | 250 std::fill(input_array_data, input_array_data + input_buffer->length(), 1); |
| 250 output_buffer->Zero(); | 251 output_buffer->Zero(); |
| 251 | 252 |
| 252 // Then invoke the process() method to perform JS buffer manipulation. The | 253 // Then invoke the process() method to perform JS buffer manipulation. The |
| 253 // output buffer should contain a constant value of 2. | 254 // output buffer should contain a constant value of 2. |
| 254 processor->Process(input_buffer, output_buffer); | 255 HashMap<String, AudioFloatArray*> audio_param_data_map; |
| 256 processor->Process(input_buffer, output_buffer, audio_param_data_map); |
| 255 for (unsigned i = 0; i < output_buffer->length(); ++i) { | 257 for (unsigned i = 0; i < output_buffer->length(); ++i) { |
| 256 EXPECT_EQ(output_array_data[i], 2); | 258 EXPECT_EQ(output_array_data[i], 2); |
| 257 } | 259 } |
| 258 | 260 |
| 259 wait_event->Signal(); | 261 wait_event->Signal(); |
| 260 } | 262 } |
| 261 | 263 |
| 262 void RunParsingParameterDescriptorTestOnWorkletThread( | 264 void RunParsingParameterDescriptorTestOnWorkletThread( |
| 263 WorkerThread* thread, | 265 WorkerThread* thread, |
| 264 WaitableEvent* wait_event) { | 266 WaitableEvent* wait_event) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 } | 334 } |
| 333 | 335 |
| 334 TEST_F(AudioWorkletGlobalScopeTest, ParsingParameterDescriptor) { | 336 TEST_F(AudioWorkletGlobalScopeTest, ParsingParameterDescriptor) { |
| 335 std::unique_ptr<AudioWorkletThread> thread = CreateAudioWorkletThread(); | 337 std::unique_ptr<AudioWorkletThread> thread = CreateAudioWorkletThread(); |
| 336 RunParsingParameterDescriptorTest(thread.get()); | 338 RunParsingParameterDescriptorTest(thread.get()); |
| 337 thread->Terminate(); | 339 thread->Terminate(); |
| 338 thread->WaitForShutdownForTesting(); | 340 thread->WaitForShutdownForTesting(); |
| 339 } | 341 } |
| 340 | 342 |
| 341 } // namespace blink | 343 } // namespace blink |
| OLD | NEW |