| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // Let start run long enough for many OnMoreData callbacks to occur. | 50 // Let start run long enough for many OnMoreData callbacks to occur. |
| 51 static const int kStartRunTimeMs = kOnMoreDataCallbackDelayMs * 10; | 51 static const int kStartRunTimeMs = kOnMoreDataCallbackDelayMs * 10; |
| 52 | 52 |
| 53 class MockAudioOutputStream : public AudioOutputStream { | 53 class MockAudioOutputStream : public AudioOutputStream { |
| 54 public: | 54 public: |
| 55 MockAudioOutputStream(AudioManagerBase* manager, | 55 MockAudioOutputStream(AudioManagerBase* manager, |
| 56 const AudioParameters& params) | 56 const AudioParameters& params) |
| 57 : start_called_(false), | 57 : start_called_(false), |
| 58 stop_called_(false), | 58 stop_called_(false), |
| 59 params_(params), | 59 params_(params), |
| 60 fake_output_stream_( | 60 fake_output_stream_(FakeAudioOutputStream::MakeFakeStream( |
| 61 FakeAudioOutputStream::MakeFakeStream(manager, params_)) { | 61 manager->GetTaskRunner(), |
| 62 } | 62 manager->GetWorkerTaskRunner(), |
| 63 params_)) {} |
| 63 | 64 |
| 64 void Start(AudioSourceCallback* callback) { | 65 void Start(AudioSourceCallback* callback) { |
| 65 start_called_ = true; | 66 start_called_ = true; |
| 66 fake_output_stream_->Start(callback); | 67 fake_output_stream_->Start(callback); |
| 67 } | 68 } |
| 68 | 69 |
| 69 void Stop() { | 70 void Stop() { |
| 70 stop_called_ = true; | 71 stop_called_ = true; |
| 71 fake_output_stream_->Stop(); | 72 fake_output_stream_->Stop(); |
| 72 } | 73 } |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 .WillOnce(Return(&real_stream)); | 742 .WillOnce(Return(&real_stream)); |
| 742 | 743 |
| 743 // Stream1 should be able to successfully open and start. | 744 // Stream1 should be able to successfully open and start. |
| 744 EXPECT_CALL(real_stream, Open()).WillOnce(Return(true)); | 745 EXPECT_CALL(real_stream, Open()).WillOnce(Return(true)); |
| 745 proxy = new AudioOutputProxy(resampler_.get()); | 746 proxy = new AudioOutputProxy(resampler_.get()); |
| 746 EXPECT_TRUE(proxy->Open()); | 747 EXPECT_TRUE(proxy->Open()); |
| 747 CloseAndWaitForCloseTimer(proxy, &real_stream); | 748 CloseAndWaitForCloseTimer(proxy, &real_stream); |
| 748 } | 749 } |
| 749 | 750 |
| 750 } // namespace media | 751 } // namespace media |
| OLD | NEW |