| OLD | NEW |
| 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 "modules/webaudio/DynamicsCompressorNode.h" | 5 #include "modules/webaudio/DynamicsCompressorNode.h" |
| 6 | |
| 7 #if ENABLE(WEB_AUDIO) | |
| 8 #include "core/testing/DummyPageHolder.h" | 6 #include "core/testing/DummyPageHolder.h" |
| 9 #include "modules/webaudio/AbstractAudioContext.h" | 7 #include "modules/webaudio/AbstractAudioContext.h" |
| 10 #include "modules/webaudio/OfflineAudioContext.h" | 8 #include "modules/webaudio/OfflineAudioContext.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 10 |
| 13 namespace blink { | 11 namespace blink { |
| 14 | 12 |
| 15 TEST(DynamicsCompressorNodeTest, ProcessorLifetime) | 13 TEST(DynamicsCompressorNodeTest, ProcessorLifetime) |
| 16 { | 14 { |
| 17 OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); | 15 OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); |
| 18 OfflineAudioContext* context = OfflineAudioContext::create(&page->document()
, 2, 1, 48000, ASSERT_NO_EXCEPTION); | 16 OfflineAudioContext* context = OfflineAudioContext::create(&page->document()
, 2, 1, 48000, ASSERT_NO_EXCEPTION); |
| 19 DynamicsCompressorNode* node = context->createDynamicsCompressor(ASSERT_NO_E
XCEPTION); | 17 DynamicsCompressorNode* node = context->createDynamicsCompressor(ASSERT_NO_E
XCEPTION); |
| 20 DynamicsCompressorHandler& handler = node->dynamicsCompressorHandler(); | 18 DynamicsCompressorHandler& handler = node->dynamicsCompressorHandler(); |
| 21 EXPECT_TRUE(handler.m_dynamicsCompressor); | 19 EXPECT_TRUE(handler.m_dynamicsCompressor); |
| 22 AbstractAudioContext::AutoLocker locker(context); | 20 AbstractAudioContext::AutoLocker locker(context); |
| 23 handler.dispose(); | 21 handler.dispose(); |
| 24 // m_dynamicsCompressor should live after dispose() because an audio thread | 22 // m_dynamicsCompressor should live after dispose() because an audio thread |
| 25 // is using it. | 23 // is using it. |
| 26 EXPECT_TRUE(handler.m_dynamicsCompressor); | 24 EXPECT_TRUE(handler.m_dynamicsCompressor); |
| 27 } | 25 } |
| 28 | 26 |
| 29 } // namespace blink | 27 } // namespace blink |
| 30 | 28 |
| 31 #endif // ENABLE(WEB_AUDIO) | |
| OLD | NEW |