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/StereoPannerNode.h" | |
6 #include "core/testing/DummyPageHolder.h" | 5 #include "core/testing/DummyPageHolder.h" |
7 #include "modules/webaudio/OfflineAudioContext.h" | 6 #include "modules/webaudio/OfflineAudioContext.h" |
| 7 #include "modules/webaudio/StereoPannerNode.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include <memory> |
9 | 10 |
10 namespace blink { | 11 namespace blink { |
11 | 12 |
12 TEST(StereoPannerNodeTest, StereoPannerLifetime) | 13 TEST(StereoPannerNodeTest, StereoPannerLifetime) |
13 { | 14 { |
14 OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); | 15 std::unique_ptr<DummyPageHolder> page = DummyPageHolder::create(); |
15 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); |
16 StereoPannerNode* node = context->createStereoPanner(ASSERT_NO_EXCEPTION); | 17 StereoPannerNode* node = context->createStereoPanner(ASSERT_NO_EXCEPTION); |
17 StereoPannerHandler& handler = static_cast<StereoPannerHandler&>(node->handl
er()); | 18 StereoPannerHandler& handler = static_cast<StereoPannerHandler&>(node->handl
er()); |
18 EXPECT_TRUE(handler.m_stereoPanner); | 19 EXPECT_TRUE(handler.m_stereoPanner); |
19 AbstractAudioContext::AutoLocker locker(context); | 20 AbstractAudioContext::AutoLocker locker(context); |
20 handler.dispose(); | 21 handler.dispose(); |
21 // m_stereoPanner should live after dispose() because an audio thread is | 22 // m_stereoPanner should live after dispose() because an audio thread is |
22 // using it. | 23 // using it. |
23 EXPECT_TRUE(handler.m_stereoPanner); | 24 EXPECT_TRUE(handler.m_stereoPanner); |
24 } | 25 } |
25 | 26 |
26 } // namespace blink | 27 } // namespace blink |
27 | 28 |
OLD | NEW |