Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: media/remoting/courier_renderer_unittest.cc

Issue 2643253003: Media Remoting Clean-up: Less-redundant naming, style consistency, etc. (Closed)
Patch Set: Addressed 1st-round comments. UserExperienceController->RendererController Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "media/remoting/remote_renderer_impl.h" 5 #include "media/remoting/courier_renderer.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "media/base/pipeline_status.h" 10 #include "media/base/pipeline_status.h"
11 #include "media/base/renderer_client.h"
11 #include "media/base/test_helpers.h" 12 #include "media/base/test_helpers.h"
12 #include "media/remoting/fake_remoting_controller.h" 13 #include "media/remoting/fake_demuxer_stream_provider.h"
13 #include "media/remoting/fake_remoting_demuxer_stream_provider.h" 14 #include "media/remoting/fake_remoter.h"
14 #include "media/remoting/remoting_renderer_controller.h" 15 #include "media/remoting/renderer_controller.h"
15 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 using testing::_; 19 using testing::_;
19 using testing::Invoke; 20 using testing::Invoke;
20 using testing::Return; 21 using testing::Return;
21 22
22 namespace media { 23 namespace media {
24 namespace remoting {
23 25
24 namespace { 26 namespace {
25 27
26 PipelineMetadata DefaultMetadata() { 28 PipelineMetadata DefaultMetadata() {
27 PipelineMetadata data; 29 PipelineMetadata data;
28 data.has_audio = true; 30 data.has_audio = true;
29 data.has_video = true; 31 data.has_video = true;
30 data.video_decoder_config = TestVideoConfig::Normal(); 32 data.video_decoder_config = TestVideoConfig::Normal();
31 return data; 33 return data;
32 } 34 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 gfx::Size size_; 97 gfx::Size size_;
96 bool opaque_ = false; 98 bool opaque_ = false;
97 base::TimeDelta duration_; 99 base::TimeDelta duration_;
98 PipelineStatistics stats_; 100 PipelineStatistics stats_;
99 101
100 DISALLOW_COPY_AND_ASSIGN(RendererClientImpl); 102 DISALLOW_COPY_AND_ASSIGN(RendererClientImpl);
101 }; 103 };
102 104
103 } // namespace 105 } // namespace
104 106
105 class RemoteRendererImplTest : public testing::Test { 107 class CourierRendererTest : public testing::Test {
106 public: 108 public:
107 RemoteRendererImplTest() 109 CourierRendererTest()
108 : receiver_renderer_handle_(10), 110 : receiver_renderer_handle_(10),
109 receiver_audio_demuxer_callback_handle_(11), 111 receiver_audio_demuxer_callback_handle_(11),
110 receiver_video_demuxer_callback_handle_(12), 112 receiver_video_demuxer_callback_handle_(12),
111 sender_client_handle_(remoting::kInvalidHandle), 113 sender_client_handle_(RpcBroker::kInvalidHandle),
112 sender_renderer_callback_handle_(remoting::kInvalidHandle), 114 sender_renderer_callback_handle_(RpcBroker::kInvalidHandle),
113 sender_audio_demuxer_handle_(remoting::kInvalidHandle), 115 sender_audio_demuxer_handle_(RpcBroker::kInvalidHandle),
114 sender_video_demuxer_handle_(remoting::kInvalidHandle), 116 sender_video_demuxer_handle_(RpcBroker::kInvalidHandle),
115 received_audio_ds_init_cb_(false), 117 received_audio_ds_init_cb_(false),
116 received_video_ds_init_cb_(false), 118 received_video_ds_init_cb_(false),
117 renderer_initialized_(false) {} 119 renderer_initialized_(false) {}
118 ~RemoteRendererImplTest() override = default; 120 ~CourierRendererTest() override = default;
119 121
120 // Use this function to mimic receiver to handle RPC message for renderer 122 // Use this function to mimic receiver to handle RPC message for renderer
121 // initialization, 123 // initialization,
122 void RpcMessageResponseBot(std::unique_ptr<std::vector<uint8_t>> message) { 124 void RpcMessageResponseBot(std::unique_ptr<std::vector<uint8_t>> message) {
123 std::unique_ptr<remoting::pb::RpcMessage> rpc( 125 std::unique_ptr<pb::RpcMessage> rpc(new pb::RpcMessage());
124 new remoting::pb::RpcMessage());
125 ASSERT_TRUE(rpc->ParseFromArray(message->data(), message->size())); 126 ASSERT_TRUE(rpc->ParseFromArray(message->data(), message->size()));
126 switch (rpc->proc()) { 127 switch (rpc->proc()) {
127 case remoting::pb::RpcMessage::RPC_ACQUIRE_RENDERER: { 128 case pb::RpcMessage::RPC_ACQUIRE_RENDERER: {
128 // Issues RPC_ACQUIRE_RENDERER_DONE RPC message. 129 // Issues RPC_ACQUIRE_RENDERER_DONE RPC message.
129 std::unique_ptr<remoting::pb::RpcMessage> acquire_done( 130 std::unique_ptr<pb::RpcMessage> acquire_done(new pb::RpcMessage());
130 new remoting::pb::RpcMessage());
131 acquire_done->set_handle(rpc->integer_value()); 131 acquire_done->set_handle(rpc->integer_value());
132 acquire_done->set_proc( 132 acquire_done->set_proc(pb::RpcMessage::RPC_ACQUIRE_RENDERER_DONE);
133 remoting::pb::RpcMessage::RPC_ACQUIRE_RENDERER_DONE);
134 acquire_done->set_integer_value(receiver_renderer_handle_); 133 acquire_done->set_integer_value(receiver_renderer_handle_);
135 remoting_renderer_controller_->GetRpcBroker()->ProcessMessageFromRemote( 134 controller_->GetRpcBroker()->ProcessMessageFromRemote(
136 std::move(acquire_done)); 135 std::move(acquire_done));
137 } break; 136 } break;
138 case remoting::pb::RpcMessage::RPC_R_INITIALIZE: { 137 case pb::RpcMessage::RPC_R_INITIALIZE: {
139 EXPECT_EQ(rpc->handle(), receiver_renderer_handle_); 138 EXPECT_EQ(rpc->handle(), receiver_renderer_handle_);
140 sender_renderer_callback_handle_ = 139 sender_renderer_callback_handle_ =
141 rpc->renderer_initialize_rpc().callback_handle(); 140 rpc->renderer_initialize_rpc().callback_handle();
142 sender_client_handle_ = rpc->renderer_initialize_rpc().client_handle(); 141 sender_client_handle_ = rpc->renderer_initialize_rpc().client_handle();
143 sender_audio_demuxer_handle_ = 142 sender_audio_demuxer_handle_ =
144 rpc->renderer_initialize_rpc().audio_demuxer_handle(); 143 rpc->renderer_initialize_rpc().audio_demuxer_handle();
145 sender_video_demuxer_handle_ = 144 sender_video_demuxer_handle_ =
146 rpc->renderer_initialize_rpc().video_demuxer_handle(); 145 rpc->renderer_initialize_rpc().video_demuxer_handle();
147 146
148 // Issues audio RPC_DS_INITIALIZE RPC message. 147 // Issues audio RPC_DS_INITIALIZE RPC message.
149 if (sender_audio_demuxer_handle_ != remoting::kInvalidHandle) { 148 if (sender_audio_demuxer_handle_ != RpcBroker::kInvalidHandle) {
150 std::unique_ptr<remoting::pb::RpcMessage> ds_init( 149 std::unique_ptr<pb::RpcMessage> ds_init(new pb::RpcMessage());
151 new remoting::pb::RpcMessage());
152 ds_init->set_handle(sender_audio_demuxer_handle_); 150 ds_init->set_handle(sender_audio_demuxer_handle_);
153 ds_init->set_proc(remoting::pb::RpcMessage::RPC_DS_INITIALIZE); 151 ds_init->set_proc(pb::RpcMessage::RPC_DS_INITIALIZE);
154 ds_init->set_integer_value(receiver_audio_demuxer_callback_handle_); 152 ds_init->set_integer_value(receiver_audio_demuxer_callback_handle_);
155 remoting_renderer_controller_->GetRpcBroker() 153 controller_->GetRpcBroker()->ProcessMessageFromRemote(
156 ->ProcessMessageFromRemote(std::move(ds_init)); 154 std::move(ds_init));
157 } 155 }
158 if (sender_video_demuxer_handle_ != remoting::kInvalidHandle) { 156 if (sender_video_demuxer_handle_ != RpcBroker::kInvalidHandle) {
159 std::unique_ptr<remoting::pb::RpcMessage> ds_init( 157 std::unique_ptr<pb::RpcMessage> ds_init(new pb::RpcMessage());
160 new remoting::pb::RpcMessage());
161 ds_init->set_handle(sender_video_demuxer_handle_); 158 ds_init->set_handle(sender_video_demuxer_handle_);
162 ds_init->set_proc(remoting::pb::RpcMessage::RPC_DS_INITIALIZE); 159 ds_init->set_proc(pb::RpcMessage::RPC_DS_INITIALIZE);
163 ds_init->set_integer_value(receiver_video_demuxer_callback_handle_); 160 ds_init->set_integer_value(receiver_video_demuxer_callback_handle_);
164 remoting_renderer_controller_->GetRpcBroker() 161 controller_->GetRpcBroker()->ProcessMessageFromRemote(
165 ->ProcessMessageFromRemote(std::move(ds_init)); 162 std::move(ds_init));
166 } 163 }
167 } break; 164 } break;
168 case remoting::pb::RpcMessage::RPC_DS_INITIALIZE_CALLBACK: { 165 case pb::RpcMessage::RPC_DS_INITIALIZE_CALLBACK: {
169 if (rpc->handle() == receiver_audio_demuxer_callback_handle_) 166 if (rpc->handle() == receiver_audio_demuxer_callback_handle_)
170 received_audio_ds_init_cb_ = true; 167 received_audio_ds_init_cb_ = true;
171 if (rpc->handle() == receiver_video_demuxer_callback_handle_) 168 if (rpc->handle() == receiver_video_demuxer_callback_handle_)
172 received_video_ds_init_cb_ = true; 169 received_video_ds_init_cb_ = true;
173 170
174 // Issues RPC_R_INITIALIZE_CALLBACK RPC message when receiving 171 // Issues RPC_R_INITIALIZE_CALLBACK RPC message when receiving
175 // RPC_DS_INITIALIZE_CALLBACK on available streams. 172 // RPC_DS_INITIALIZE_CALLBACK on available streams.
176 if (received_audio_ds_init_cb_ == 173 if (received_audio_ds_init_cb_ ==
177 (sender_audio_demuxer_handle_ != remoting::kInvalidHandle) && 174 (sender_audio_demuxer_handle_ != RpcBroker::kInvalidHandle) &&
178 received_video_ds_init_cb_ == 175 received_video_ds_init_cb_ ==
179 (sender_video_demuxer_handle_ != remoting::kInvalidHandle)) { 176 (sender_video_demuxer_handle_ != RpcBroker::kInvalidHandle)) {
180 std::unique_ptr<remoting::pb::RpcMessage> init_cb( 177 std::unique_ptr<pb::RpcMessage> init_cb(new pb::RpcMessage());
181 new remoting::pb::RpcMessage());
182 init_cb->set_handle(sender_renderer_callback_handle_); 178 init_cb->set_handle(sender_renderer_callback_handle_);
183 init_cb->set_proc( 179 init_cb->set_proc(pb::RpcMessage::RPC_R_INITIALIZE_CALLBACK);
184 remoting::pb::RpcMessage::RPC_R_INITIALIZE_CALLBACK);
185 init_cb->set_boolean_value(true); 180 init_cb->set_boolean_value(true);
186 remoting_renderer_controller_->GetRpcBroker() 181 controller_->GetRpcBroker()->ProcessMessageFromRemote(
187 ->ProcessMessageFromRemote(std::move(init_cb)); 182 std::move(init_cb));
188 renderer_initialized_ = true; 183 renderer_initialized_ = true;
189 } 184 }
190 185
191 } break; 186 } break;
192 case remoting::pb::RpcMessage::RPC_R_FLUSHUNTIL: { 187 case pb::RpcMessage::RPC_R_FLUSHUNTIL: {
193 // Issues RPC_R_FLUSHUNTIL_CALLBACK RPC message. 188 // Issues RPC_R_FLUSHUNTIL_CALLBACK RPC message.
194 std::unique_ptr<remoting::pb::RpcMessage> flush_cb( 189 std::unique_ptr<pb::RpcMessage> flush_cb(new pb::RpcMessage());
195 new remoting::pb::RpcMessage());
196 flush_cb->set_handle(rpc->renderer_flushuntil_rpc().callback_handle()); 190 flush_cb->set_handle(rpc->renderer_flushuntil_rpc().callback_handle());
197 flush_cb->set_proc(remoting::pb::RpcMessage::RPC_R_FLUSHUNTIL_CALLBACK); 191 flush_cb->set_proc(pb::RpcMessage::RPC_R_FLUSHUNTIL_CALLBACK);
198 remoting_renderer_controller_->GetRpcBroker()->ProcessMessageFromRemote( 192 controller_->GetRpcBroker()->ProcessMessageFromRemote(
199 std::move(flush_cb)); 193 std::move(flush_cb));
200 194
201 } break; 195 } break;
202 196
203 default: 197 default:
204 NOTREACHED(); 198 NOTREACHED();
205 } 199 }
206 RunPendingTasks(); 200 RunPendingTasks();
207 } 201 }
208 202
209 // Callback from RpcBroker when sending message to remote sink. 203 // Callback from RpcBroker when sending message to remote sink.
210 void OnSendMessageToSink(std::unique_ptr<std::vector<uint8_t>> message) { 204 void OnSendMessageToSink(std::unique_ptr<std::vector<uint8_t>> message) {
211 std::unique_ptr<remoting::pb::RpcMessage> rpc( 205 std::unique_ptr<pb::RpcMessage> rpc(new pb::RpcMessage());
212 new remoting::pb::RpcMessage());
213 ASSERT_TRUE(rpc->ParseFromArray(message->data(), message->size())); 206 ASSERT_TRUE(rpc->ParseFromArray(message->data(), message->size()));
214 received_rpc_.push_back(std::move(rpc)); 207 received_rpc_.push_back(std::move(rpc));
215 } 208 }
216 209
217 protected: 210 protected:
218 void InitializeRenderer() { 211 void InitializeRenderer() {
219 // Register media::RendererClient implementation. 212 // Register media::RendererClient implementation.
220 render_client_.reset(new RendererClientImpl()); 213 render_client_.reset(new RendererClientImpl());
221 demuxer_stream_provider_.reset(new FakeRemotingDemuxerStreamProvider()); 214 demuxer_stream_provider_.reset(new FakeDemuxerStreamProvider());
222 EXPECT_CALL(*render_client_, OnPipelineStatus(_)).Times(1); 215 EXPECT_CALL(*render_client_, OnPipelineStatus(_)).Times(1);
223 DCHECK(remote_renderer_impl_); 216 DCHECK(remote_renderer_impl_);
224 // Redirect RPC message for simulate receiver scenario 217 // Redirect RPC message for simulate receiver scenario
225 remoting_renderer_controller_->GetRpcBroker()->SetMessageCallbackForTesting( 218 controller_->GetRpcBroker()->SetMessageCallbackForTesting(base::Bind(
226 base::Bind(&RemoteRendererImplTest::RpcMessageResponseBot, 219 &CourierRendererTest::RpcMessageResponseBot, base::Unretained(this)));
227 base::Unretained(this)));
228 RunPendingTasks(); 220 RunPendingTasks();
229 remote_renderer_impl_->Initialize( 221 remote_renderer_impl_->Initialize(
230 demuxer_stream_provider_.get(), render_client_.get(), 222 demuxer_stream_provider_.get(), render_client_.get(),
231 base::Bind(&RendererClientImpl::OnPipelineStatus, 223 base::Bind(&RendererClientImpl::OnPipelineStatus,
232 base::Unretained(render_client_.get()))); 224 base::Unretained(render_client_.get())));
233 RunPendingTasks(); 225 RunPendingTasks();
234 // Redirect RPC message back to save for later check. 226 // Redirect RPC message back to save for later check.
235 remoting_renderer_controller_->GetRpcBroker()->SetMessageCallbackForTesting( 227 controller_->GetRpcBroker()->SetMessageCallbackForTesting(base::Bind(
236 base::Bind(&RemoteRendererImplTest::OnSendMessageToSink, 228 &CourierRendererTest::OnSendMessageToSink, base::Unretained(this)));
237 base::Unretained(this)));
238 RunPendingTasks(); 229 RunPendingTasks();
239 } 230 }
240 231
241 bool IsRendererInitialized() const { 232 bool IsRendererInitialized() const {
242 return remote_renderer_impl_->state_ == RemoteRendererImpl::STATE_PLAYING; 233 return remote_renderer_impl_->state_ == CourierRenderer::STATE_PLAYING;
243 } 234 }
244 235
245 void OnReceivedRpc(std::unique_ptr<remoting::pb::RpcMessage> message) { 236 void OnReceivedRpc(std::unique_ptr<pb::RpcMessage> message) {
246 remote_renderer_impl_->OnReceivedRpc(std::move(message)); 237 remote_renderer_impl_->OnReceivedRpc(std::move(message));
247 } 238 }
248 239
249 void SetUp() override { 240 void SetUp() override {
250 // Creates RemotingRendererController. 241 controller_ = base::MakeUnique<RendererController>(
251 remoting_renderer_controller_ = 242 FakeRemoterFactory::CreateSharedSession(false));
252 base::MakeUnique<RemotingRendererController>( 243 controller_->OnMetadataChanged(DefaultMetadata());
253 CreateRemotingSourceImpl(false));
254 remoting_renderer_controller_->OnMetadataChanged(DefaultMetadata());
255 244
256 // Redirect RPC message to RemoteRendererImplTest::OnSendMessageToSink(). 245 // Redirect RPC message to CourierRendererTest::OnSendMessageToSink().
257 remoting_renderer_controller_->GetRpcBroker()->SetMessageCallbackForTesting( 246 controller_->GetRpcBroker()->SetMessageCallbackForTesting(base::Bind(
258 base::Bind(&RemoteRendererImplTest::OnSendMessageToSink, 247 &CourierRendererTest::OnSendMessageToSink, base::Unretained(this)));
259 base::Unretained(this)));
260 248
261 // Creates RemoteRendererImpl. 249 remote_renderer_impl_.reset(
262 remote_renderer_impl_.reset(new RemoteRendererImpl( 250 new CourierRenderer(base::ThreadTaskRunnerHandle::Get(),
263 base::ThreadTaskRunnerHandle::Get(), 251 controller_->GetWeakPtr(), nullptr));
264 remoting_renderer_controller_->GetWeakPtr(), nullptr));
265 RunPendingTasks(); 252 RunPendingTasks();
266 } 253 }
267 254
268 RemoteRendererImpl::State state() const { 255 CourierRenderer::State state() const { return remote_renderer_impl_->state_; }
269 return remote_renderer_impl_->state_;
270 }
271 256
272 void RunPendingTasks() { base::RunLoop().RunUntilIdle(); } 257 void RunPendingTasks() { base::RunLoop().RunUntilIdle(); }
273 258
274 // Gets first available RpcMessage with specific |proc|. 259 // Gets first available RpcMessage with specific |proc|.
275 const remoting::pb::RpcMessage* PeekRpcMessage(int proc) const { 260 const pb::RpcMessage* PeekRpcMessage(int proc) const {
276 for (auto& s : received_rpc_) { 261 for (auto& s : received_rpc_) {
277 if (proc == s->proc()) 262 if (proc == s->proc())
278 return s.get(); 263 return s.get();
279 } 264 }
280 return nullptr; 265 return nullptr;
281 } 266 }
282 int ReceivedRpcMessageCount() const { return received_rpc_.size(); } 267 int ReceivedRpcMessageCount() const { return received_rpc_.size(); }
283 void ResetReceivedRpcMessage() { received_rpc_.clear(); } 268 void ResetReceivedRpcMessage() { received_rpc_.clear(); }
284 269
285 void ValidateCurrentTime(base::TimeDelta current, 270 void ValidateCurrentTime(base::TimeDelta current,
286 base::TimeDelta current_max) const { 271 base::TimeDelta current_max) const {
287 ASSERT_EQ(remote_renderer_impl_->current_media_time_, current); 272 ASSERT_EQ(remote_renderer_impl_->current_media_time_, current);
288 ASSERT_EQ(remote_renderer_impl_->current_max_time_, current_max); 273 ASSERT_EQ(remote_renderer_impl_->current_max_time_, current_max);
289 } 274 }
290 275
291 base::MessageLoop message_loop_; 276 base::MessageLoop message_loop_;
292 std::unique_ptr<RemotingRendererController> remoting_renderer_controller_; 277 std::unique_ptr<RendererController> controller_;
293 std::unique_ptr<RendererClientImpl> render_client_; 278 std::unique_ptr<RendererClientImpl> render_client_;
294 std::unique_ptr<FakeRemotingDemuxerStreamProvider> demuxer_stream_provider_; 279 std::unique_ptr<FakeDemuxerStreamProvider> demuxer_stream_provider_;
295 std::unique_ptr<RemoteRendererImpl> remote_renderer_impl_; 280 std::unique_ptr<CourierRenderer> remote_renderer_impl_;
xjz 2017/01/23 23:08:14 naming nit: courier_renderer_ or maybe just render
miu 2017/01/24 00:19:40 Done.
296 281
297 // RPC handles. 282 // RPC handles.
298 const int receiver_renderer_handle_; 283 const int receiver_renderer_handle_;
299 const int receiver_audio_demuxer_callback_handle_; 284 const int receiver_audio_demuxer_callback_handle_;
300 const int receiver_video_demuxer_callback_handle_; 285 const int receiver_video_demuxer_callback_handle_;
301 int sender_client_handle_; 286 int sender_client_handle_;
302 int sender_renderer_callback_handle_; 287 int sender_renderer_callback_handle_;
303 int sender_audio_demuxer_handle_; 288 int sender_audio_demuxer_handle_;
304 int sender_video_demuxer_handle_; 289 int sender_video_demuxer_handle_;
305 290
306 // flag to indicate if RPC_DS_INITIALIZE_CALLBACK RPC messages are received. 291 // flag to indicate if RPC_DS_INITIALIZE_CALLBACK RPC messages are received.
307 bool received_audio_ds_init_cb_; 292 bool received_audio_ds_init_cb_;
308 bool received_video_ds_init_cb_; 293 bool received_video_ds_init_cb_;
309 294
310 // Check if |remote_renderer_impl_| is initialized successfully or not. 295 // Check if |remote_renderer_impl_| is initialized successfully or not.
311 bool renderer_initialized_; 296 bool renderer_initialized_;
312 297
313 // vector to store received RPC message with proc value 298 // vector to store received RPC message with proc value
314 std::vector<std::unique_ptr<remoting::pb::RpcMessage>> received_rpc_; 299 std::vector<std::unique_ptr<pb::RpcMessage>> received_rpc_;
315 300
316 private: 301 private:
317 DISALLOW_COPY_AND_ASSIGN(RemoteRendererImplTest); 302 DISALLOW_COPY_AND_ASSIGN(CourierRendererTest);
318 }; 303 };
319 304
320 TEST_F(RemoteRendererImplTest, Initialize) { 305 TEST_F(CourierRendererTest, Initialize) {
321 InitializeRenderer(); 306 InitializeRenderer();
322 RunPendingTasks(); 307 RunPendingTasks();
323 308
324 ASSERT_TRUE(IsRendererInitialized()); 309 ASSERT_TRUE(IsRendererInitialized());
325 ASSERT_EQ(render_client_->status(), PIPELINE_OK); 310 ASSERT_EQ(render_client_->status(), PIPELINE_OK);
326 } 311 }
327 312
328 TEST_F(RemoteRendererImplTest, Flush) { 313 TEST_F(CourierRendererTest, Flush) {
329 // Initialize Renderer. 314 // Initialize Renderer.
330 InitializeRenderer(); 315 InitializeRenderer();
331 RunPendingTasks(); 316 RunPendingTasks();
332 ASSERT_TRUE(IsRendererInitialized()); 317 ASSERT_TRUE(IsRendererInitialized());
333 ASSERT_EQ(render_client_->status(), PIPELINE_OK); 318 ASSERT_EQ(render_client_->status(), PIPELINE_OK);
334 319
335 // Flush Renderer. 320 // Flush Renderer.
336 // Redirect RPC message for simulate receiver scenario 321 // Redirect RPC message for simulate receiver scenario
337 remoting_renderer_controller_->GetRpcBroker()->SetMessageCallbackForTesting( 322 controller_->GetRpcBroker()->SetMessageCallbackForTesting(base::Bind(
338 base::Bind(&RemoteRendererImplTest::RpcMessageResponseBot, 323 &CourierRendererTest::RpcMessageResponseBot, base::Unretained(this)));
339 base::Unretained(this)));
340 RunPendingTasks(); 324 RunPendingTasks();
341 EXPECT_CALL(*render_client_, OnFlushCallback()).Times(1); 325 EXPECT_CALL(*render_client_, OnFlushCallback()).Times(1);
342 remote_renderer_impl_->Flush( 326 remote_renderer_impl_->Flush(
343 base::Bind(&RendererClientImpl::OnFlushCallback, 327 base::Bind(&RendererClientImpl::OnFlushCallback,
344 base::Unretained(render_client_.get()))); 328 base::Unretained(render_client_.get())));
345 RunPendingTasks(); 329 RunPendingTasks();
346 } 330 }
347 331
348 TEST_F(RemoteRendererImplTest, StartPlayingFrom) { 332 TEST_F(CourierRendererTest, StartPlayingFrom) {
349 // Initialize Renderer 333 // Initialize Renderer
350 InitializeRenderer(); 334 InitializeRenderer();
351 RunPendingTasks(); 335 RunPendingTasks();
352 ASSERT_TRUE(IsRendererInitialized()); 336 ASSERT_TRUE(IsRendererInitialized());
353 ASSERT_EQ(render_client_->status(), PIPELINE_OK); 337 ASSERT_EQ(render_client_->status(), PIPELINE_OK);
354 338
355 // StartPlaying from 339 // StartPlaying from
356 base::TimeDelta seek = base::TimeDelta::FromMicroseconds(100); 340 base::TimeDelta seek = base::TimeDelta::FromMicroseconds(100);
357 remote_renderer_impl_->StartPlayingFrom(seek); 341 remote_renderer_impl_->StartPlayingFrom(seek);
358 RunPendingTasks(); 342 RunPendingTasks();
359 343
360 // Checks if it sends out RPC message with correct value. 344 // Checks if it sends out RPC message with correct value.
361 ASSERT_EQ(1, ReceivedRpcMessageCount()); 345 ASSERT_EQ(1, ReceivedRpcMessageCount());
362 const remoting::pb::RpcMessage* rpc = 346 const pb::RpcMessage* rpc =
363 PeekRpcMessage(remoting::pb::RpcMessage::RPC_R_STARTPLAYINGFROM); 347 PeekRpcMessage(pb::RpcMessage::RPC_R_STARTPLAYINGFROM);
364 ASSERT_TRUE(rpc); 348 ASSERT_TRUE(rpc);
365 ASSERT_EQ(rpc->integer64_value(), 100); 349 ASSERT_EQ(rpc->integer64_value(), 100);
366 } 350 }
367 351
368 TEST_F(RemoteRendererImplTest, SetVolume) { 352 TEST_F(CourierRendererTest, SetVolume) {
369 // Initialize Renderer because, as of this writing, the pipeline guarantees it 353 // Initialize Renderer because, as of this writing, the pipeline guarantees it
370 // will not call SetVolume() until after the media::Renderer is initialized. 354 // will not call SetVolume() until after the media::Renderer is initialized.
371 InitializeRenderer(); 355 InitializeRenderer();
372 RunPendingTasks(); 356 RunPendingTasks();
373 ASSERT_EQ(0, ReceivedRpcMessageCount()); 357 ASSERT_EQ(0, ReceivedRpcMessageCount());
374 358
375 // SetVolume() will send remoting::pb::RpcMessage::RPC_R_SETVOLUME RPC. 359 // SetVolume() will send pb::RpcMessage::RPC_R_SETVOLUME RPC.
376 remote_renderer_impl_->SetVolume(3.0); 360 remote_renderer_impl_->SetVolume(3.0);
377 RunPendingTasks(); 361 RunPendingTasks();
378 362
379 // Checks if it sends out RPC message with correct value. 363 // Checks if it sends out RPC message with correct value.
380 ASSERT_EQ(1, ReceivedRpcMessageCount()); 364 ASSERT_EQ(1, ReceivedRpcMessageCount());
381 const remoting::pb::RpcMessage* rpc = 365 const pb::RpcMessage* rpc = PeekRpcMessage(pb::RpcMessage::RPC_R_SETVOLUME);
382 PeekRpcMessage(remoting::pb::RpcMessage::RPC_R_SETVOLUME);
383 ASSERT_TRUE(rpc); 366 ASSERT_TRUE(rpc);
384 ASSERT_TRUE(rpc->double_value() == 3.0); 367 ASSERT_TRUE(rpc->double_value() == 3.0);
385 } 368 }
386 369
387 TEST_F(RemoteRendererImplTest, SetPlaybackRate) { 370 TEST_F(CourierRendererTest, SetPlaybackRate) {
388 // Initialize Renderer because, as of this writing, the pipeline guarantees it 371 // Initialize Renderer because, as of this writing, the pipeline guarantees it
389 // will not call SetPlaybackRate() until after the media::Renderer is 372 // will not call SetPlaybackRate() until after the media::Renderer is
390 // initialized. 373 // initialized.
391 InitializeRenderer(); 374 InitializeRenderer();
392 RunPendingTasks(); 375 RunPendingTasks();
393 ASSERT_EQ(0, ReceivedRpcMessageCount()); 376 ASSERT_EQ(0, ReceivedRpcMessageCount());
394 377
395 remoting_renderer_controller_->GetRpcBroker()->SetMessageCallbackForTesting( 378 controller_->GetRpcBroker()->SetMessageCallbackForTesting(base::Bind(
396 base::Bind(&RemoteRendererImplTest::OnSendMessageToSink, 379 &CourierRendererTest::OnSendMessageToSink, base::Unretained(this)));
397 base::Unretained(this)));
398 remote_renderer_impl_->SetPlaybackRate(2.5); 380 remote_renderer_impl_->SetPlaybackRate(2.5);
399 RunPendingTasks(); 381 RunPendingTasks();
400 ASSERT_EQ(1, ReceivedRpcMessageCount()); 382 ASSERT_EQ(1, ReceivedRpcMessageCount());
401 // Checks if it sends out RPC message with correct value. 383 // Checks if it sends out RPC message with correct value.
402 const remoting::pb::RpcMessage* rpc = 384 const pb::RpcMessage* rpc =
403 PeekRpcMessage(remoting::pb::RpcMessage::RPC_R_SETPLAYBACKRATE); 385 PeekRpcMessage(pb::RpcMessage::RPC_R_SETPLAYBACKRATE);
404 ASSERT_TRUE(rpc); 386 ASSERT_TRUE(rpc);
405 ASSERT_TRUE(rpc->double_value() == 2.5); 387 ASSERT_TRUE(rpc->double_value() == 2.5);
406 } 388 }
407 389
408 TEST_F(RemoteRendererImplTest, OnTimeUpdate) { 390 TEST_F(CourierRendererTest, OnTimeUpdate) {
409 // Issues RPC_RC_ONTIMEUPDATE RPC message. 391 // Issues RPC_RC_ONTIMEUPDATE RPC message.
410 base::TimeDelta media_time = base::TimeDelta::FromMicroseconds(100); 392 base::TimeDelta media_time = base::TimeDelta::FromMicroseconds(100);
411 base::TimeDelta max_media_time = base::TimeDelta::FromMicroseconds(500); 393 base::TimeDelta max_media_time = base::TimeDelta::FromMicroseconds(500);
412 std::unique_ptr<remoting::pb::RpcMessage> rpc(new remoting::pb::RpcMessage()); 394 std::unique_ptr<pb::RpcMessage> rpc(new pb::RpcMessage());
413 rpc->set_handle(5); 395 rpc->set_handle(5);
414 rpc->set_proc(remoting::pb::RpcMessage::RPC_RC_ONTIMEUPDATE); 396 rpc->set_proc(pb::RpcMessage::RPC_RC_ONTIMEUPDATE);
415 auto* time_message = rpc->mutable_rendererclient_ontimeupdate_rpc(); 397 auto* time_message = rpc->mutable_rendererclient_ontimeupdate_rpc();
416 time_message->set_time_usec(media_time.InMicroseconds()); 398 time_message->set_time_usec(media_time.InMicroseconds());
417 time_message->set_max_time_usec(max_media_time.InMicroseconds()); 399 time_message->set_max_time_usec(max_media_time.InMicroseconds());
418 OnReceivedRpc(std::move(rpc)); 400 OnReceivedRpc(std::move(rpc));
419 ValidateCurrentTime(media_time, max_media_time); 401 ValidateCurrentTime(media_time, max_media_time);
420 402
421 // Issues RPC_RC_ONTIMEUPDATE RPC message with invalid time 403 // Issues RPC_RC_ONTIMEUPDATE RPC message with invalid time
422 base::TimeDelta media_time2 = base::TimeDelta::FromMicroseconds(-100); 404 base::TimeDelta media_time2 = base::TimeDelta::FromMicroseconds(-100);
423 base::TimeDelta max_media_time2 = base::TimeDelta::FromMicroseconds(500); 405 base::TimeDelta max_media_time2 = base::TimeDelta::FromMicroseconds(500);
424 std::unique_ptr<remoting::pb::RpcMessage> rpc2( 406 std::unique_ptr<pb::RpcMessage> rpc2(new pb::RpcMessage());
425 new remoting::pb::RpcMessage());
426 rpc2->set_handle(5); 407 rpc2->set_handle(5);
427 rpc2->set_proc(remoting::pb::RpcMessage::RPC_RC_ONTIMEUPDATE); 408 rpc2->set_proc(pb::RpcMessage::RPC_RC_ONTIMEUPDATE);
428 auto* time_message2 = rpc2->mutable_rendererclient_ontimeupdate_rpc(); 409 auto* time_message2 = rpc2->mutable_rendererclient_ontimeupdate_rpc();
429 time_message2->set_time_usec(media_time2.InMicroseconds()); 410 time_message2->set_time_usec(media_time2.InMicroseconds());
430 time_message2->set_max_time_usec(max_media_time2.InMicroseconds()); 411 time_message2->set_max_time_usec(max_media_time2.InMicroseconds());
431 OnReceivedRpc(std::move(rpc2)); 412 OnReceivedRpc(std::move(rpc2));
432 // Because of invalid value, the time will not be updated and remain the same. 413 // Because of invalid value, the time will not be updated and remain the same.
433 ValidateCurrentTime(media_time, max_media_time); 414 ValidateCurrentTime(media_time, max_media_time);
434 } 415 }
435 416
436 TEST_F(RemoteRendererImplTest, OnBufferingStateChange) { 417 TEST_F(CourierRendererTest, OnBufferingStateChange) {
437 InitializeRenderer(); 418 InitializeRenderer();
438 // Issues RPC_RC_ONBUFFERINGSTATECHANGE RPC message. 419 // Issues RPC_RC_ONBUFFERINGSTATECHANGE RPC message.
439 EXPECT_CALL(*render_client_, 420 EXPECT_CALL(*render_client_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING))
440 OnBufferingStateChange(media::BUFFERING_HAVE_NOTHING))
441 .Times(1); 421 .Times(1);
442 std::unique_ptr<remoting::pb::RpcMessage> rpc(new remoting::pb::RpcMessage()); 422 std::unique_ptr<pb::RpcMessage> rpc(new pb::RpcMessage());
443 rpc->set_handle(5); 423 rpc->set_handle(5);
444 rpc->set_proc(remoting::pb::RpcMessage::RPC_RC_ONBUFFERINGSTATECHANGE); 424 rpc->set_proc(pb::RpcMessage::RPC_RC_ONBUFFERINGSTATECHANGE);
445 auto* buffering_state = 425 auto* buffering_state =
446 rpc->mutable_rendererclient_onbufferingstatechange_rpc(); 426 rpc->mutable_rendererclient_onbufferingstatechange_rpc();
447 buffering_state->set_state( 427 buffering_state->set_state(
448 remoting::pb::RendererClientOnBufferingStateChange:: 428 pb::RendererClientOnBufferingStateChange::BUFFERING_HAVE_NOTHING);
449 BUFFERING_HAVE_NOTHING);
450 OnReceivedRpc(std::move(rpc)); 429 OnReceivedRpc(std::move(rpc));
451 RunPendingTasks(); 430 RunPendingTasks();
452 } 431 }
453 432
454 TEST_F(RemoteRendererImplTest, OnVideoNaturalSizeChange) { 433 TEST_F(CourierRendererTest, OnVideoNaturalSizeChange) {
455 InitializeRenderer(); 434 InitializeRenderer();
456 // Makes sure initial value of video natural size is not set to 435 // Makes sure initial value of video natural size is not set to
457 // gfx::Size(100, 200). 436 // gfx::Size(100, 200).
458 ASSERT_NE(render_client_->size().width(), 100); 437 ASSERT_NE(render_client_->size().width(), 100);
459 ASSERT_NE(render_client_->size().height(), 200); 438 ASSERT_NE(render_client_->size().height(), 200);
460 // Issues RPC_RC_ONVIDEONATURALSIZECHANGE RPC message. 439 // Issues RPC_RC_ONVIDEONATURALSIZECHANGE RPC message.
461 EXPECT_CALL(*render_client_, OnVideoNaturalSizeChange(gfx::Size(100, 200))) 440 EXPECT_CALL(*render_client_, OnVideoNaturalSizeChange(gfx::Size(100, 200)))
462 .Times(1); 441 .Times(1);
463 std::unique_ptr<remoting::pb::RpcMessage> rpc(new remoting::pb::RpcMessage()); 442 std::unique_ptr<pb::RpcMessage> rpc(new pb::RpcMessage());
464 rpc->set_handle(5); 443 rpc->set_handle(5);
465 rpc->set_proc(remoting::pb::RpcMessage::RPC_RC_ONVIDEONATURALSIZECHANGE); 444 rpc->set_proc(pb::RpcMessage::RPC_RC_ONVIDEONATURALSIZECHANGE);
466 auto* size_message = 445 auto* size_message =
467 rpc->mutable_rendererclient_onvideonatualsizechange_rpc(); 446 rpc->mutable_rendererclient_onvideonatualsizechange_rpc();
468 size_message->set_width(100); 447 size_message->set_width(100);
469 size_message->set_height(200); 448 size_message->set_height(200);
470 OnReceivedRpc(std::move(rpc)); 449 OnReceivedRpc(std::move(rpc));
471 RunPendingTasks(); 450 RunPendingTasks();
472 ASSERT_EQ(render_client_->size().width(), 100); 451 ASSERT_EQ(render_client_->size().width(), 100);
473 ASSERT_EQ(render_client_->size().height(), 200); 452 ASSERT_EQ(render_client_->size().height(), 200);
474 } 453 }
475 454
476 TEST_F(RemoteRendererImplTest, OnVideoNaturalSizeChangeWithInvalidValue) { 455 TEST_F(CourierRendererTest, OnVideoNaturalSizeChangeWithInvalidValue) {
477 InitializeRenderer(); 456 InitializeRenderer();
478 // Issues RPC_RC_ONVIDEONATURALSIZECHANGE RPC message. 457 // Issues RPC_RC_ONVIDEONATURALSIZECHANGE RPC message.
479 EXPECT_CALL(*render_client_, OnVideoNaturalSizeChange(_)).Times(0); 458 EXPECT_CALL(*render_client_, OnVideoNaturalSizeChange(_)).Times(0);
480 std::unique_ptr<remoting::pb::RpcMessage> rpc(new remoting::pb::RpcMessage()); 459 std::unique_ptr<pb::RpcMessage> rpc(new pb::RpcMessage());
481 rpc->set_handle(5); 460 rpc->set_handle(5);
482 rpc->set_proc(remoting::pb::RpcMessage::RPC_RC_ONVIDEONATURALSIZECHANGE); 461 rpc->set_proc(pb::RpcMessage::RPC_RC_ONVIDEONATURALSIZECHANGE);
483 auto* size_message = 462 auto* size_message =
484 rpc->mutable_rendererclient_onvideonatualsizechange_rpc(); 463 rpc->mutable_rendererclient_onvideonatualsizechange_rpc();
485 size_message->set_width(-100); 464 size_message->set_width(-100);
486 size_message->set_height(0); 465 size_message->set_height(0);
487 OnReceivedRpc(std::move(rpc)); 466 OnReceivedRpc(std::move(rpc));
488 RunPendingTasks(); 467 RunPendingTasks();
489 } 468 }
490 469
491 TEST_F(RemoteRendererImplTest, OnVideoOpacityChange) { 470 TEST_F(CourierRendererTest, OnVideoOpacityChange) {
492 InitializeRenderer(); 471 InitializeRenderer();
493 ASSERT_FALSE(render_client_->opaque()); 472 ASSERT_FALSE(render_client_->opaque());
494 // Issues RPC_RC_ONVIDEOOPACITYCHANGE RPC message. 473 // Issues RPC_RC_ONVIDEOOPACITYCHANGE RPC message.
495 EXPECT_CALL(*render_client_, OnVideoOpacityChange(true)).Times(1); 474 EXPECT_CALL(*render_client_, OnVideoOpacityChange(true)).Times(1);
496 std::unique_ptr<remoting::pb::RpcMessage> rpc(new remoting::pb::RpcMessage()); 475 std::unique_ptr<pb::RpcMessage> rpc(new pb::RpcMessage());
497 rpc->set_handle(5); 476 rpc->set_handle(5);
498 rpc->set_proc(remoting::pb::RpcMessage::RPC_RC_ONVIDEOOPACITYCHANGE); 477 rpc->set_proc(pb::RpcMessage::RPC_RC_ONVIDEOOPACITYCHANGE);
499 rpc->set_boolean_value(true); 478 rpc->set_boolean_value(true);
500 OnReceivedRpc(std::move(rpc)); 479 OnReceivedRpc(std::move(rpc));
501 RunPendingTasks(); 480 RunPendingTasks();
502 ASSERT_TRUE(render_client_->opaque()); 481 ASSERT_TRUE(render_client_->opaque());
503 } 482 }
504 483
505 TEST_F(RemoteRendererImplTest, OnStatisticsUpdate) { 484 TEST_F(CourierRendererTest, OnStatisticsUpdate) {
506 InitializeRenderer(); 485 InitializeRenderer();
507 ASSERT_NE(render_client_->stats().audio_bytes_decoded, 1234U); 486 ASSERT_NE(render_client_->stats().audio_bytes_decoded, 1234U);
508 ASSERT_NE(render_client_->stats().video_bytes_decoded, 2345U); 487 ASSERT_NE(render_client_->stats().video_bytes_decoded, 2345U);
509 ASSERT_NE(render_client_->stats().video_frames_decoded, 3456U); 488 ASSERT_NE(render_client_->stats().video_frames_decoded, 3456U);
510 ASSERT_NE(render_client_->stats().video_frames_dropped, 4567U); 489 ASSERT_NE(render_client_->stats().video_frames_dropped, 4567U);
511 ASSERT_NE(render_client_->stats().audio_memory_usage, 5678); 490 ASSERT_NE(render_client_->stats().audio_memory_usage, 5678);
512 ASSERT_NE(render_client_->stats().video_memory_usage, 6789); 491 ASSERT_NE(render_client_->stats().video_memory_usage, 6789);
513 // Issues RPC_RC_ONSTATISTICSUPDATE RPC message. 492 // Issues RPC_RC_ONSTATISTICSUPDATE RPC message.
514 EXPECT_CALL(*render_client_, OnStatisticsUpdate(_)).Times(1); 493 EXPECT_CALL(*render_client_, OnStatisticsUpdate(_)).Times(1);
515 std::unique_ptr<remoting::pb::RpcMessage> rpc(new remoting::pb::RpcMessage()); 494 std::unique_ptr<pb::RpcMessage> rpc(new pb::RpcMessage());
516 rpc->set_handle(5); 495 rpc->set_handle(5);
517 rpc->set_proc(remoting::pb::RpcMessage::RPC_RC_ONSTATISTICSUPDATE); 496 rpc->set_proc(pb::RpcMessage::RPC_RC_ONSTATISTICSUPDATE);
518 auto* message = rpc->mutable_rendererclient_onstatisticsupdate_rpc(); 497 auto* message = rpc->mutable_rendererclient_onstatisticsupdate_rpc();
519 message->set_audio_bytes_decoded(1234U); 498 message->set_audio_bytes_decoded(1234U);
520 message->set_video_bytes_decoded(2345U); 499 message->set_video_bytes_decoded(2345U);
521 message->set_video_frames_decoded(3456U); 500 message->set_video_frames_decoded(3456U);
522 message->set_video_frames_dropped(4567U); 501 message->set_video_frames_dropped(4567U);
523 message->set_audio_memory_usage(5678); 502 message->set_audio_memory_usage(5678);
524 message->set_video_memory_usage(6789); 503 message->set_video_memory_usage(6789);
525 OnReceivedRpc(std::move(rpc)); 504 OnReceivedRpc(std::move(rpc));
526 RunPendingTasks(); 505 RunPendingTasks();
527 ASSERT_EQ(render_client_->stats().audio_bytes_decoded, 1234U); 506 ASSERT_EQ(render_client_->stats().audio_bytes_decoded, 1234U);
528 ASSERT_EQ(render_client_->stats().video_bytes_decoded, 2345U); 507 ASSERT_EQ(render_client_->stats().video_bytes_decoded, 2345U);
529 ASSERT_EQ(render_client_->stats().video_frames_decoded, 3456U); 508 ASSERT_EQ(render_client_->stats().video_frames_decoded, 3456U);
530 ASSERT_EQ(render_client_->stats().video_frames_dropped, 4567U); 509 ASSERT_EQ(render_client_->stats().video_frames_dropped, 4567U);
531 ASSERT_EQ(render_client_->stats().audio_memory_usage, 5678); 510 ASSERT_EQ(render_client_->stats().audio_memory_usage, 5678);
532 ASSERT_EQ(render_client_->stats().video_memory_usage, 6789); 511 ASSERT_EQ(render_client_->stats().video_memory_usage, 6789);
533 } 512 }
534 513
535 TEST_F(RemoteRendererImplTest, OnDurationChange) { 514 TEST_F(CourierRendererTest, OnDurationChange) {
536 InitializeRenderer(); 515 InitializeRenderer();
537 ASSERT_NE(render_client_->duration(), 516 ASSERT_NE(render_client_->duration(),
538 base::TimeDelta::FromMicroseconds(1234)); 517 base::TimeDelta::FromMicroseconds(1234));
539 // Issues RPC_RC_ONDURATIONCHANGE RPC message. 518 // Issues RPC_RC_ONDURATIONCHANGE RPC message.
540 EXPECT_CALL(*render_client_, 519 EXPECT_CALL(*render_client_,
541 OnDurationChange(base::TimeDelta::FromMicroseconds(1234))) 520 OnDurationChange(base::TimeDelta::FromMicroseconds(1234)))
542 .Times(1); 521 .Times(1);
543 std::unique_ptr<remoting::pb::RpcMessage> rpc(new remoting::pb::RpcMessage()); 522 std::unique_ptr<pb::RpcMessage> rpc(new pb::RpcMessage());
544 rpc->set_handle(5); 523 rpc->set_handle(5);
545 rpc->set_proc(remoting::pb::RpcMessage::RPC_RC_ONDURATIONCHANGE); 524 rpc->set_proc(pb::RpcMessage::RPC_RC_ONDURATIONCHANGE);
546 rpc->set_integer64_value(1234); 525 rpc->set_integer64_value(1234);
547 OnReceivedRpc(std::move(rpc)); 526 OnReceivedRpc(std::move(rpc));
548 RunPendingTasks(); 527 RunPendingTasks();
549 ASSERT_EQ(render_client_->duration(), 528 ASSERT_EQ(render_client_->duration(),
550 base::TimeDelta::FromMicroseconds(1234)); 529 base::TimeDelta::FromMicroseconds(1234));
551 } 530 }
552 531
553 TEST_F(RemoteRendererImplTest, OnDurationChangeWithInvalidValue) { 532 TEST_F(CourierRendererTest, OnDurationChangeWithInvalidValue) {
554 InitializeRenderer(); 533 InitializeRenderer();
555 // Issues RPC_RC_ONDURATIONCHANGE RPC message. 534 // Issues RPC_RC_ONDURATIONCHANGE RPC message.
556 EXPECT_CALL(*render_client_, OnDurationChange(_)).Times(0); 535 EXPECT_CALL(*render_client_, OnDurationChange(_)).Times(0);
557 std::unique_ptr<remoting::pb::RpcMessage> rpc(new remoting::pb::RpcMessage()); 536 std::unique_ptr<pb::RpcMessage> rpc(new pb::RpcMessage());
558 rpc->set_handle(5); 537 rpc->set_handle(5);
559 rpc->set_proc(remoting::pb::RpcMessage::RPC_RC_ONDURATIONCHANGE); 538 rpc->set_proc(pb::RpcMessage::RPC_RC_ONDURATIONCHANGE);
560 rpc->set_integer64_value(-345); 539 rpc->set_integer64_value(-345);
561 OnReceivedRpc(std::move(rpc)); 540 OnReceivedRpc(std::move(rpc));
562 RunPendingTasks(); 541 RunPendingTasks();
563 } 542 }
564 543
565 // TODO(xjz): Tests for detecting PACING_TOO_SLOWLY and FRAME_DROP_RATE_HIGH. 544 // TODO(xjz): Tests for detecting PACING_TOO_SLOWLY and FRAME_DROP_RATE_HIGH.
566 545
546 } // namespace remoting
567 } // namespace media 547 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698