| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "media/audio/audio_io.h" | 12 #include "media/audio/audio_io.h" |
| 13 #include "media/audio/audio_manager.h" | 13 #include "media/audio/audio_manager.h" |
| 14 #include "media/audio/simple_sources.h" | 14 #include "media/audio/simple_sources.h" |
| 15 #include "media/audio/sounds/audio_stream_handler.h" | 15 #include "media/audio/sounds/audio_stream_handler.h" |
| 16 #include "media/audio/sounds/test_data.h" | 16 #include "media/audio/sounds/test_data.h" |
| 17 #include "media/base/channel_layout.h" | 17 #include "media/base/channel_layout.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 namespace media { | 20 namespace media { |
| 21 | 21 |
| 22 class AudioStreamHandlerTest : public testing::Test { | 22 class AudioStreamHandlerTest : public testing::Test { |
| 23 public: | 23 public: |
| 24 AudioStreamHandlerTest() {} | 24 AudioStreamHandlerTest() {} |
| 25 virtual ~AudioStreamHandlerTest() {} | 25 virtual ~AudioStreamHandlerTest() {} |
| 26 | 26 |
| 27 virtual void SetUp() OVERRIDE { | 27 virtual void SetUp() override { |
| 28 audio_manager_.reset(AudioManager::CreateForTesting()); | 28 audio_manager_.reset(AudioManager::CreateForTesting()); |
| 29 | 29 |
| 30 base::StringPiece data(kTestAudioData, arraysize(kTestAudioData)); | 30 base::StringPiece data(kTestAudioData, arraysize(kTestAudioData)); |
| 31 audio_stream_handler_.reset(new AudioStreamHandler(data)); | 31 audio_stream_handler_.reset(new AudioStreamHandler(data)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual void TearDown() OVERRIDE { | 34 virtual void TearDown() override { |
| 35 audio_stream_handler_.reset(); | 35 audio_stream_handler_.reset(); |
| 36 audio_manager_.reset(); | 36 audio_manager_.reset(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 AudioStreamHandler* audio_stream_handler() { | 39 AudioStreamHandler* audio_stream_handler() { |
| 40 return audio_stream_handler_.get(); | 40 return audio_stream_handler_.get(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void SetObserverForTesting(AudioStreamHandler::TestObserver* observer) { | 43 void SetObserverForTesting(AudioStreamHandler::TestObserver* observer) { |
| 44 AudioStreamHandler::SetObserverForTesting(observer); | 44 AudioStreamHandler::SetObserverForTesting(observer); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 run_loop.Run(); | 99 run_loop.Run(); |
| 100 | 100 |
| 101 SetObserverForTesting(NULL); | 101 SetObserverForTesting(NULL); |
| 102 SetAudioSourceForTesting(NULL); | 102 SetAudioSourceForTesting(NULL); |
| 103 | 103 |
| 104 ASSERT_EQ(1, observer.num_play_requests()); | 104 ASSERT_EQ(1, observer.num_play_requests()); |
| 105 ASSERT_EQ(1, observer.num_stop_requests()); | 105 ASSERT_EQ(1, observer.num_stop_requests()); |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace media | 108 } // namespace media |
| OLD | NEW |