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

Side by Side Diff: media/mojo/clients/mojo_renderer_unittest.cc

Issue 2386443002: media: Use native BufferingState in media mojo interfaces (Closed)
Patch Set: media: Use native media enums in media mojo interfaces Created 4 years, 2 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
« no previous file with comments | « media/mojo/clients/mojo_renderer.cc ('k') | media/mojo/common/media_type_converters.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/test_message_loop.h" 10 #include "base/test/test_message_loop.h"
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 // Flushing should pause media-time updates. 365 // Flushing should pause media-time updates.
366 EXPECT_CALL(*mock_renderer_, Flush(_)).WillOnce(RunClosure<0>()); 366 EXPECT_CALL(*mock_renderer_, Flush(_)).WillOnce(RunClosure<0>());
367 Flush(); 367 Flush();
368 base::TimeDelta pause_time = mojo_renderer_->GetMediaTime(); 368 base::TimeDelta pause_time = mojo_renderer_->GetMediaTime();
369 EXPECT_GT(pause_time, kStartTime); 369 EXPECT_GT(pause_time, kStartTime);
370 WaitFor(kSleepTime); 370 WaitFor(kSleepTime);
371 EXPECT_EQ(pause_time, mojo_renderer_->GetMediaTime()); 371 EXPECT_EQ(pause_time, mojo_renderer_->GetMediaTime());
372 Destroy(); 372 Destroy();
373 } 373 }
374 374
375 TEST_F(MojoRendererTest, OnBufferingStateChange) {
376 Initialize();
377 Play();
378
379 EXPECT_CALL(renderer_client_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH))
380 .Times(1);
381 remote_renderer_client_->OnBufferingStateChange(BUFFERING_HAVE_ENOUGH);
382
383 EXPECT_CALL(renderer_client_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING))
384 .Times(1);
385 remote_renderer_client_->OnBufferingStateChange(BUFFERING_HAVE_NOTHING);
386
387 base::RunLoop().RunUntilIdle();
388 }
389
375 TEST_F(MojoRendererTest, OnEnded) { 390 TEST_F(MojoRendererTest, OnEnded) {
376 Initialize(); 391 Initialize();
377 Play(); 392 Play();
378 393
379 EXPECT_CALL(renderer_client_, OnEnded()).Times(1); 394 EXPECT_CALL(renderer_client_, OnEnded()).Times(1);
380 remote_renderer_client_->OnEnded(); 395 remote_renderer_client_->OnEnded();
381 base::RunLoop().RunUntilIdle(); 396 base::RunLoop().RunUntilIdle();
382 } 397 }
383 398
384 // TODO(xhwang): Add tests for all RendererClient methods. 399 // TODO(xhwang): Add tests for all RendererClient methods.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 Play(); 440 Play();
426 remote_renderer_client_->OnError(PIPELINE_ERROR_DECODE); 441 remote_renderer_client_->OnError(PIPELINE_ERROR_DECODE);
427 base::RunLoop().RunUntilIdle(); 442 base::RunLoop().RunUntilIdle();
428 443
429 EXPECT_CALL(*mock_renderer_, SetPlaybackRate(0.0)).Times(1); 444 EXPECT_CALL(*mock_renderer_, SetPlaybackRate(0.0)).Times(1);
430 mojo_renderer_->SetPlaybackRate(0.0); 445 mojo_renderer_->SetPlaybackRate(0.0);
431 Flush(); 446 Flush();
432 } 447 }
433 448
434 } // namespace media 449 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/clients/mojo_renderer.cc ('k') | media/mojo/common/media_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698