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

Side by Side Diff: content/browser/renderer_host/media/video_capture_host_unittest.cc

Issue 2395163002: VideoCapture: migrate VideoCapture renderer-->host messages to mojo, part 2 (Closed)
Patch Set: rockot@s comments on renaming and return types 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 | « content/browser/renderer_host/media/video_capture_host.cc ('k') | content/common/BUILD.gn » ('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 (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 "content/browser/renderer_host/media/video_capture_host.h" 5 #include "content/browser/renderer_host/media/video_capture_host.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 .WillRepeatedly(Return()); 379 .WillRepeatedly(Return());
380 380
381 base::RunLoop run_loop; 381 base::RunLoop run_loop;
382 EXPECT_CALL(*host_.get(), OnBufferFilled(kDeviceId)) 382 EXPECT_CALL(*host_.get(), OnBufferFilled(kDeviceId))
383 .Times(AnyNumber()) 383 .Times(AnyNumber())
384 .WillOnce(ExitMessageLoop(task_runner_, run_loop.QuitClosure())); 384 .WillOnce(ExitMessageLoop(task_runner_, run_loop.QuitClosure()));
385 385
386 media::VideoCaptureParams params; 386 media::VideoCaptureParams params;
387 params.requested_format = media::VideoCaptureFormat( 387 params.requested_format = media::VideoCaptureFormat(
388 gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420); 388 gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420);
389 host_->OnStartCapture(kDeviceId, opened_session_id_, params); 389 host_->Start(kDeviceId, opened_session_id_, params);
390 run_loop.Run(); 390 run_loop.Run();
391 } 391 }
392 392
393 void StartStopCapture() { 393 void StartStopCapture() {
394 // Quickly start and then stop capture, without giving much chance for 394 // Quickly start and then stop capture, without giving much chance for
395 // asynchronous start operations to complete. 395 // asynchronous start operations to complete.
396 InSequence s; 396 InSequence s;
397 base::RunLoop run_loop; 397 base::RunLoop run_loop;
398 EXPECT_CALL(*host_.get(), 398 EXPECT_CALL(*host_.get(),
399 OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_STOPPED)); 399 OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_STOPPED));
400 media::VideoCaptureParams params; 400 media::VideoCaptureParams params;
401 params.requested_format = media::VideoCaptureFormat( 401 params.requested_format = media::VideoCaptureFormat(
402 gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420); 402 gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420);
403 host_->OnStartCapture(kDeviceId, opened_session_id_, params); 403 host_->Start(kDeviceId, opened_session_id_, params);
404 host_->Stop(kDeviceId); 404 host_->Stop(kDeviceId);
405 run_loop.RunUntilIdle(); 405 run_loop.RunUntilIdle();
406 WaitForVideoDeviceThread(); 406 WaitForVideoDeviceThread();
407 } 407 }
408 408
409 void PauseResumeCapture() { 409 void PauseResumeCapture() {
410 InSequence s; 410 InSequence s;
411 base::RunLoop run_loop; 411 base::RunLoop run_loop;
412 EXPECT_CALL(*host_.get(), 412 EXPECT_CALL(*host_.get(),
413 OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_PAUSED)); 413 OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_PAUSED));
414 host_->Pause(kDeviceId); 414 host_->Pause(kDeviceId);
415 415
416 EXPECT_CALL(*host_.get(), 416 EXPECT_CALL(*host_.get(),
417 OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_RESUMED)); 417 OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_RESUMED));
418 media::VideoCaptureParams params; 418 media::VideoCaptureParams params;
419 params.requested_format = media::VideoCaptureFormat( 419 params.requested_format = media::VideoCaptureFormat(
420 gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420); 420 gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420);
421 host_->OnResumeCapture(kDeviceId, opened_session_id_, params); 421 host_->Resume(kDeviceId, opened_session_id_, params);
422 run_loop.RunUntilIdle(); 422 run_loop.RunUntilIdle();
423 WaitForVideoDeviceThread(); 423 WaitForVideoDeviceThread();
424 } 424 }
425 425
426 #ifdef DUMP_VIDEO 426 #ifdef DUMP_VIDEO
427 void CaptureAndDumpVideo(int width, int height, int frame_rate) { 427 void CaptureAndDumpVideo(int width, int height, int frame_rate) {
428 InSequence s; 428 InSequence s;
429 EXPECT_CALL(*host_.get(), OnNewBufferCreated(kDeviceId, _, _, _)) 429 EXPECT_CALL(*host_.get(), OnNewBufferCreated(kDeviceId, _, _, _))
430 .Times(AnyNumber()).WillRepeatedly(Return()); 430 .Times(AnyNumber()).WillRepeatedly(Return());
431 431
432 base::RunLoop run_loop; 432 base::RunLoop run_loop;
433 EXPECT_CALL(*host_, OnBufferFilled(kDeviceId, _, _, _, _, _, _, _, _, _)) 433 EXPECT_CALL(*host_, OnBufferFilled(kDeviceId, _, _, _, _, _, _, _, _, _))
434 .Times(AnyNumber()) 434 .Times(AnyNumber())
435 .WillOnce(ExitMessageLoop(message_loop_, run_loop.QuitClosure())); 435 .WillOnce(ExitMessageLoop(message_loop_, run_loop.QuitClosure()));
436 436
437 media::VideoCaptureParams params; 437 media::VideoCaptureParams params;
438 params.requested_format = 438 params.requested_format =
439 media::VideoCaptureFormat(gfx::Size(width, height), frame_rate); 439 media::VideoCaptureFormat(gfx::Size(width, height), frame_rate);
440 host_->SetDumpVideo(true); 440 host_->SetDumpVideo(true);
441 host_->OnStartCapture(kDeviceId, opened_session_id_, params); 441 host_->Start(kDeviceId, opened_session_id_, params);
442 run_loop.Run(); 442 run_loop.Run();
443 } 443 }
444 #endif 444 #endif
445 445
446 void StopCapture() { 446 void StopCapture() {
447 base::RunLoop run_loop; 447 base::RunLoop run_loop;
448 EXPECT_CALL(*host_.get(), 448 EXPECT_CALL(*host_.get(),
449 OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_STOPPED)) 449 OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_STOPPED))
450 .WillOnce(ExitMessageLoop(task_runner_, run_loop.QuitClosure())); 450 .WillOnce(ExitMessageLoop(task_runner_, run_loop.QuitClosure()));
451 451
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 } 559 }
560 #endif 560 #endif
561 561
562 TEST_F(VideoCaptureHostTest, PauseResumeCapture) { 562 TEST_F(VideoCaptureHostTest, PauseResumeCapture) {
563 StartCapture(); 563 StartCapture();
564 PauseResumeCapture(); 564 PauseResumeCapture();
565 StopCapture(); 565 StopCapture();
566 } 566 }
567 567
568 } // namespace content 568 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_host.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698