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

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

Issue 760593003: Add PIXEL_FORMAT_NV12 into VideoPixelFormat (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 (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 // Unit test for VideoCaptureController. 5 // Unit test for VideoCaptureController.
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 ASSERT_TRUE(buffer.get()); 573 ASSERT_TRUE(buffer.get());
574 574
575 device_->OnIncomingCapturedVideoFrame( 575 device_->OnIncomingCapturedVideoFrame(
576 buffer, 576 buffer,
577 media::VideoCaptureFormat( 577 media::VideoCaptureFormat(
578 capture_resolution, 30, media::PIXEL_FORMAT_I420), 578 capture_resolution, 30, media::PIXEL_FORMAT_I420),
579 WrapI420Buffer(buffer, capture_resolution), 579 WrapI420Buffer(buffer, capture_resolution),
580 base::TimeTicks()); 580 base::TimeTicks());
581 buffer = NULL; 581 buffer = NULL;
582 582
583 // Exercises the OnIncomingCapturedData() codepath when VideoPixelFormat
584 // is PIXEL_FORMAT_NV12
585 device_->OnIncomingCapturedData(
ostap 2014/12/03 18:45:44 I think you have to add other test, not insert cod
586 NULL,
587 0,
588 media::VideoCaptureFormat(
589 gfx::Size(320,240), 30, media::PIXEL_FORMAT_NV12),
590 0,
591 base::TimeTicks());
592
583 base::RunLoop().RunUntilIdle(); 593 base::RunLoop().RunUntilIdle();
584 } 594 }
585 595
586 // Exercises the OnError() codepath of VideoCaptureController, and tests the 596 // Exercises the OnError() codepath of VideoCaptureController, and tests the
587 // behavior of various operations after the error state has been signalled. 597 // behavior of various operations after the error state has been signalled.
588 TEST_F(VideoCaptureControllerTest, ErrorAfterDeviceCreation) { 598 TEST_F(VideoCaptureControllerTest, ErrorAfterDeviceCreation) {
589 media::VideoCaptureParams session_100; 599 media::VideoCaptureParams session_100;
590 session_100.requested_format = media::VideoCaptureFormat( 600 session_100.requested_format = media::VideoCaptureFormat(
591 gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420); 601 gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420);
592 602
(...skipping 20 matching lines...) Expand all
613 623
614 device_->OnError("Test error"); 624 device_->OnError("Test error");
615 device_->OnIncomingCapturedVideoFrame( 625 device_->OnIncomingCapturedVideoFrame(
616 buffer, 626 buffer,
617 media::VideoCaptureFormat( 627 media::VideoCaptureFormat(
618 dims, device_format.frame_rate, media::PIXEL_FORMAT_I420), 628 dims, device_format.frame_rate, media::PIXEL_FORMAT_I420),
619 WrapI420Buffer(buffer, dims), 629 WrapI420Buffer(buffer, dims),
620 base::TimeTicks()); 630 base::TimeTicks());
621 buffer = NULL; 631 buffer = NULL;
622 632
633 device_->OnIncomingCapturedData(
634 NULL,
635 0,
636 media::VideoCaptureFormat(
637 gfx::Size(320,240), 30, media::PIXEL_FORMAT_NV12),
638 0,
639 base::TimeTicks());
640
623 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1); 641 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1);
624 base::RunLoop().RunUntilIdle(); 642 base::RunLoop().RunUntilIdle();
625 Mock::VerifyAndClearExpectations(client_a_.get()); 643 Mock::VerifyAndClearExpectations(client_a_.get());
626 644
627 // Second client connects after the error state. It also should get told of 645 // Second client connects after the error state. It also should get told of
628 // the error. 646 // the error.
629 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); 647 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1);
630 controller_->AddClient( 648 controller_->AddClient(
631 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); 649 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200);
632 Mock::VerifyAndClearExpectations(client_b_.get()); 650 Mock::VerifyAndClearExpectations(client_b_.get());
633 } 651 }
634 652
635 } // namespace content 653 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_controller.cc ('k') | media/video/capture/video_capture_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698