| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/process_util.h" | 6 #include "base/process_util.h" |
| 7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
| 8 #include "chrome/browser/renderer_host/audio_renderer_host.h" | 8 #include "chrome/browser/renderer_host/audio_renderer_host.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 175 } |
| 176 | 176 |
| 177 int current_stream_id_; | 177 int current_stream_id_; |
| 178 scoped_refptr<MockAudioRendererHost> host_; | 178 scoped_refptr<MockAudioRendererHost> host_; |
| 179 scoped_ptr<MessageLoop> message_loop_; | 179 scoped_ptr<MessageLoop> message_loop_; |
| 180 | 180 |
| 181 private: | 181 private: |
| 182 DISALLOW_COPY_AND_ASSIGN(AudioRendererHostTest); | 182 DISALLOW_COPY_AND_ASSIGN(AudioRendererHostTest); |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 // Audio output stream only works stably on windows. Also there's no mock | |
| 186 // audio output streams for mac and linux. | |
| 187 // TODO(hclam): make these tests work on mac and linux. | |
| 188 #if defined(OS_WIN) | |
| 189 | |
| 190 TEST_F(AudioRendererHostTest, MockStreamDataConversation) { | 185 TEST_F(AudioRendererHostTest, MockStreamDataConversation) { |
| 191 scoped_ptr<AudioRendererHost::IPCAudioSource> source(CreateMockStream()); | 186 scoped_ptr<AudioRendererHost::IPCAudioSource> source(CreateMockStream()); |
| 192 | 187 |
| 193 // We will receive packet requests until the buffer is full. We first send | 188 // We will receive packet requests until the buffer is full. We first send |
| 194 // three packets of 16KB, then we send packets of 1KB until the buffer is | 189 // three packets of 16KB, then we send packets of 1KB until the buffer is |
| 195 // full. Then there will no more packet requests. | 190 // full. Then there will no more packet requests. |
| 196 InSequence s; | 191 InSequence s; |
| 197 EXPECT_CALL(*host_, | 192 EXPECT_CALL(*host_, |
| 198 OnRequestPacket(kRouteId, current_stream_id_, kPacketSize, _)); | 193 OnRequestPacket(kRouteId, current_stream_id_, kPacketSize, _)); |
| 199 EXPECT_CALL(*host_, | 194 EXPECT_CALL(*host_, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 219 source->NotifyPacketReady(kPacketSize); | 214 source->NotifyPacketReady(kPacketSize); |
| 220 source->NotifyPacketReady(kPacketSize); | 215 source->NotifyPacketReady(kPacketSize); |
| 221 source->NotifyPacketReady(kStep); | 216 source->NotifyPacketReady(kStep); |
| 222 source->NotifyPacketReady(kStep); | 217 source->NotifyPacketReady(kStep); |
| 223 source->NotifyPacketReady(kStep); | 218 source->NotifyPacketReady(kStep); |
| 224 source->NotifyPacketReady(kStep); | 219 source->NotifyPacketReady(kStep); |
| 225 source->Start(); | 220 source->Start(); |
| 226 source->Close(); | 221 source->Close(); |
| 227 } | 222 } |
| 228 | 223 |
| 229 #endif | |
| OLD | NEW |