| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/environment.h" | 6 #include "base/environment.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | |
| 10 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 11 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| 12 #include "base/test/test_timeouts.h" | 11 #include "base/test/test_timeouts.h" |
| 13 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 14 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 15 #include "media/audio/audio_io.h" | 14 #include "media/audio/audio_io.h" |
| 16 #include "media/audio/audio_manager_base.h" | 15 #include "media/audio/audio_manager_base.h" |
| 17 #include "media/audio/fake_audio_log_factory.h" | 16 #include "media/audio/fake_audio_log_factory.h" |
| 18 #include "media/base/seekable_buffer.h" | 17 #include "media/base/seekable_buffer.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 }; | 80 }; |
| 82 | 81 |
| 83 // This class mocks the platform specific audio manager and overrides | 82 // This class mocks the platform specific audio manager and overrides |
| 84 // the GetMessageLoop() method to ensure that we can run our tests on | 83 // the GetMessageLoop() method to ensure that we can run our tests on |
| 85 // the main thread instead of the audio thread. | 84 // the main thread instead of the audio thread. |
| 86 class MockAudioManager : public AudioManagerAnyPlatform { | 85 class MockAudioManager : public AudioManagerAnyPlatform { |
| 87 public: | 86 public: |
| 88 MockAudioManager() : AudioManagerAnyPlatform(&fake_audio_log_factory_) {} | 87 MockAudioManager() : AudioManagerAnyPlatform(&fake_audio_log_factory_) {} |
| 89 virtual ~MockAudioManager() {} | 88 virtual ~MockAudioManager() {} |
| 90 | 89 |
| 91 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE { | 90 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() OVERRIDE { |
| 92 return base::MessageLoop::current()->message_loop_proxy(); | 91 return base::MessageLoop::current()->message_loop_proxy(); |
| 93 } | 92 } |
| 94 | 93 |
| 95 private: | 94 private: |
| 96 FakeAudioLogFactory fake_audio_log_factory_; | 95 FakeAudioLogFactory fake_audio_log_factory_; |
| 97 DISALLOW_COPY_AND_ASSIGN(MockAudioManager); | 96 DISALLOW_COPY_AND_ASSIGN(MockAudioManager); |
| 98 }; | 97 }; |
| 99 | 98 |
| 100 // Test fixture class. | 99 // Test fixture class. |
| 101 class AudioLowLatencyInputOutputTest : public testing::Test { | 100 class AudioLowLatencyInputOutputTest : public testing::Test { |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 445 |
| 447 // All Close() operations that run on the mocked audio thread, | 446 // All Close() operations that run on the mocked audio thread, |
| 448 // should be synchronous and not post additional close tasks to | 447 // should be synchronous and not post additional close tasks to |
| 449 // mocked the audio thread. Hence, there is no need to call | 448 // mocked the audio thread. Hence, there is no need to call |
| 450 // message_loop()->RunUntilIdle() after the Close() methods. | 449 // message_loop()->RunUntilIdle() after the Close() methods. |
| 451 aos->Close(); | 450 aos->Close(); |
| 452 ais->Close(); | 451 ais->Close(); |
| 453 } | 452 } |
| 454 | 453 |
| 455 } // namespace media | 454 } // namespace media |
| OLD | NEW |