| 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/base/seekable_buffer.h" | 16 #include "media/base/seekable_buffer.h" |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 }; | 75 }; |
| 77 | 76 |
| 78 // This class mocks the platform specific audio manager and overrides | 77 // This class mocks the platform specific audio manager and overrides |
| 79 // the GetMessageLoop() method to ensure that we can run our tests on | 78 // the GetMessageLoop() method to ensure that we can run our tests on |
| 80 // the main thread instead of the audio thread. | 79 // the main thread instead of the audio thread. |
| 81 class MockAudioManager : public AudioManagerAnyPlatform { | 80 class MockAudioManager : public AudioManagerAnyPlatform { |
| 82 public: | 81 public: |
| 83 MockAudioManager() {} | 82 MockAudioManager() {} |
| 84 virtual ~MockAudioManager() {} | 83 virtual ~MockAudioManager() {} |
| 85 | 84 |
| 86 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE { | 85 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() OVERRIDE { |
| 87 return base::MessageLoop::current()->message_loop_proxy(); | 86 return base::MessageLoop::current()->message_loop_proxy(); |
| 88 } | 87 } |
| 89 | 88 |
| 90 private: | 89 private: |
| 91 DISALLOW_COPY_AND_ASSIGN(MockAudioManager); | 90 DISALLOW_COPY_AND_ASSIGN(MockAudioManager); |
| 92 }; | 91 }; |
| 93 | 92 |
| 94 // Test fixture class. | 93 // Test fixture class. |
| 95 class AudioLowLatencyInputOutputTest : public testing::Test { | 94 class AudioLowLatencyInputOutputTest : public testing::Test { |
| 96 protected: | 95 protected: |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 440 |
| 442 // All Close() operations that run on the mocked audio thread, | 441 // All Close() operations that run on the mocked audio thread, |
| 443 // should be synchronous and not post additional close tasks to | 442 // should be synchronous and not post additional close tasks to |
| 444 // mocked the audio thread. Hence, there is no need to call | 443 // mocked the audio thread. Hence, there is no need to call |
| 445 // message_loop()->RunUntilIdle() after the Close() methods. | 444 // message_loop()->RunUntilIdle() after the Close() methods. |
| 446 aos->Close(); | 445 aos->Close(); |
| 447 ais->Close(); | 446 ais->Close(); |
| 448 } | 447 } |
| 449 | 448 |
| 450 } // namespace media | 449 } // namespace media |
| OLD | NEW |