Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp

Issue 2839063003: Implement tail processing for AudioNodes (Closed)
Patch Set: Make declaration order consistent Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <memory> 5 #include <memory>
6 #include "core/testing/DummyPageHolder.h" 6 #include "core/testing/DummyPageHolder.h"
7 #include "modules/webaudio/AudioBasicProcessorHandler.h" 7 #include "modules/webaudio/AudioBasicProcessorHandler.h"
8 #include "modules/webaudio/OfflineAudioContext.h" 8 #include "modules/webaudio/OfflineAudioContext.h"
9 #include "platform/audio/AudioProcessor.h" 9 #include "platform/audio/AudioProcessor.h"
10 #include "platform/wtf/PtrUtil.h" 10 #include "platform/wtf/PtrUtil.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class MockAudioProcessor final : public AudioProcessor { 15 class MockAudioProcessor final : public AudioProcessor {
16 public: 16 public:
17 MockAudioProcessor() : AudioProcessor(48000, 2) {} 17 MockAudioProcessor() : AudioProcessor(48000, 2) {}
18 void Initialize() override { initialized_ = true; } 18 void Initialize() override { initialized_ = true; }
19 void Uninitialize() override { initialized_ = false; } 19 void Uninitialize() override { initialized_ = false; }
20 void Process(const AudioBus*, AudioBus*, size_t) override {} 20 void Process(const AudioBus*, AudioBus*, size_t) override {}
21 void Reset() override {} 21 void Reset() override {}
22 void SetNumberOfChannels(unsigned) override {} 22 void SetNumberOfChannels(unsigned) override {}
23 unsigned NumberOfChannels() const override { return number_of_channels_; } 23 unsigned NumberOfChannels() const override { return number_of_channels_; }
24 bool RequiresTailProcessing() const override { return true; }
24 double TailTime() const override { return 0; } 25 double TailTime() const override { return 0; }
25 double LatencyTime() const override { return 0; } 26 double LatencyTime() const override { return 0; }
26 }; 27 };
27 28
28 class MockProcessorNode final : public AudioNode { 29 class MockProcessorNode final : public AudioNode {
29 public: 30 public:
30 MockProcessorNode(BaseAudioContext& context) : AudioNode(context) { 31 MockProcessorNode(BaseAudioContext& context) : AudioNode(context) {
31 SetHandler(AudioBasicProcessorHandler::Create( 32 SetHandler(AudioBasicProcessorHandler::Create(
32 AudioHandler::kNodeTypeWaveShaper, *this, 48000, 33 AudioHandler::kNodeTypeWaveShaper, *this, 48000,
33 WTF::MakeUnique<MockAudioProcessor>())); 34 WTF::MakeUnique<MockAudioProcessor>()));
(...skipping 12 matching lines...) Expand all
46 EXPECT_TRUE(handler.Processor()->IsInitialized()); 47 EXPECT_TRUE(handler.Processor()->IsInitialized());
47 BaseAudioContext::AutoLocker locker(context); 48 BaseAudioContext::AutoLocker locker(context);
48 handler.Dispose(); 49 handler.Dispose();
49 // The AudioProcessor should live after dispose() and should not be 50 // The AudioProcessor should live after dispose() and should not be
50 // finalized because an audio thread is using it. 51 // finalized because an audio thread is using it.
51 EXPECT_TRUE(handler.Processor()); 52 EXPECT_TRUE(handler.Processor());
52 EXPECT_TRUE(handler.Processor()->IsInitialized()); 53 EXPECT_TRUE(handler.Processor()->IsInitialized());
53 } 54 }
54 55
55 } // namespace blink 56 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698