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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/message_loop_proxy.h" | 6 #include "base/message_loop_proxy.h" |
7 #include "base/threading/platform_thread.h" | 7 #include "base/threading/platform_thread.h" |
8 #include "media/audio/audio_output_dispatcher.h" | 8 #include "media/audio/audio_output_dispatcher.h" |
9 #include "media/audio/audio_output_proxy.h" | 9 #include "media/audio/audio_output_proxy.h" |
10 #include "media/audio/audio_manager.h" | 10 #include "media/audio/audio_manager.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 using ::testing::_; | 14 using ::testing::_; |
15 using ::testing::Mock; | 15 using ::testing::Mock; |
16 using ::testing::Return; | 16 using ::testing::Return; |
17 | 17 |
18 // XXX(vrk): This unit test runs into GTest asserts when I try to put it in | |
vrk (LEFT CHROMIUM)
2012/03/21 00:45:46
Wanted to highlight this weirdness. I have no idea
scherkus (not reviewing)
2012/03/21 08:50:27
it's possible that we're running into duplicate de
vrk (LEFT CHROMIUM)
2012/03/21 20:17:48
Yay that works, and seems like the right thing to
scherkus (not reviewing)
2012/03/22 09:43:21
Actually it looks like it wasn't MockAudioManager
| |
19 // the media namespace. I have no idea why. It complains in particular about | |
20 // the EXPECT_CALL in SetUp() and, after that's commented out, it crashes | |
21 // at EXPECT_CALL for the MakeAudioOutputStream in OpenAndClose. | |
22 | |
23 using media::AudioBuffersState; | |
24 using media::AudioInputStream; | |
25 using media::AudioOutputDispatcher; | |
26 using media::AudioOutputStream; | |
27 using media::AudioOutputProxy; | |
28 using media::AudioManager; | |
29 using media::AudioParameters; | |
30 | |
18 static const int kTestCloseDelayMs = 100; | 31 static const int kTestCloseDelayMs = 100; |
19 | 32 |
20 // Used in the test where we don't want a stream to be closed unexpectedly. | 33 // Used in the test where we don't want a stream to be closed unexpectedly. |
21 static const int kTestBigCloseDelaySeconds = 1000; | 34 static const int kTestBigCloseDelaySeconds = 1000; |
22 | 35 |
23 class MockAudioOutputStream : public AudioOutputStream { | 36 class MockAudioOutputStream : public AudioOutputStream { |
24 public: | 37 public: |
25 MockAudioOutputStream() {} | 38 MockAudioOutputStream() {} |
26 | 39 |
27 MOCK_METHOD0(Open, bool()); | 40 MOCK_METHOD0(Open, bool()); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 | 377 |
365 EXPECT_CALL(callback_, OnError(_, _)) | 378 EXPECT_CALL(callback_, OnError(_, _)) |
366 .Times(1); | 379 .Times(1); |
367 | 380 |
368 proxy->Start(&callback_); | 381 proxy->Start(&callback_); |
369 | 382 |
370 Mock::VerifyAndClear(&callback_); | 383 Mock::VerifyAndClear(&callback_); |
371 | 384 |
372 proxy->Close(); | 385 proxy->Close(); |
373 } | 386 } |
OLD | NEW |