OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/threading/platform_thread.h" | 6 #include "base/threading/platform_thread.h" |
7 #include "media/audio/audio_output_dispatcher.h" | 7 #include "media/audio/audio_output_dispatcher.h" |
8 #include "media/audio/audio_output_proxy.h" | 8 #include "media/audio/audio_output_proxy.h" |
9 #include "media/audio/audio_manager.h" | 9 #include "media/audio/audio_manager.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 using ::testing::_; | 13 using ::testing::_; |
14 using ::testing::Mock; | 14 using ::testing::Mock; |
15 using ::testing::Return; | 15 using ::testing::Return; |
16 | 16 |
17 namespace { | 17 static const int kTestCloseDelayMs = 100; |
18 const int kTestCloseDelayMs = 100; | |
19 | 18 |
20 // Used in the test where we don't want a stream to be closed unexpectedly. | 19 // Used in the test where we don't want a stream to be closed unexpectedly. |
21 const int kTestBigCloseDelayMs = 1000 * 1000; | 20 static const int kTestBigCloseDelayMs = 1000 * 1000; |
22 } // namespace | |
23 | 21 |
24 class MockAudioOutputStream : public AudioOutputStream { | 22 class MockAudioOutputStream : public AudioOutputStream { |
25 public: | 23 public: |
26 MockAudioOutputStream() {} | 24 MockAudioOutputStream() {} |
27 | 25 |
28 MOCK_METHOD0(Open, bool()); | 26 MOCK_METHOD0(Open, bool()); |
29 MOCK_METHOD1(Start, void(AudioSourceCallback* callback)); | 27 MOCK_METHOD1(Start, void(AudioSourceCallback* callback)); |
30 MOCK_METHOD0(Stop, void()); | 28 MOCK_METHOD0(Stop, void()); |
31 MOCK_METHOD1(SetVolume, void(double volume)); | 29 MOCK_METHOD1(SetVolume, void(double volume)); |
32 MOCK_METHOD1(GetVolume, void(double* volume)); | 30 MOCK_METHOD1(GetVolume, void(double* volume)); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 345 |
348 EXPECT_CALL(callback_, OnError(_, _)) | 346 EXPECT_CALL(callback_, OnError(_, _)) |
349 .Times(1); | 347 .Times(1); |
350 | 348 |
351 proxy->Start(&callback_); | 349 proxy->Start(&callback_); |
352 | 350 |
353 Mock::VerifyAndClear(&callback_); | 351 Mock::VerifyAndClear(&callback_); |
354 | 352 |
355 proxy->Close(); | 353 proxy->Close(); |
356 } | 354 } |
OLD | NEW |