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

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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 Mock::VerifyAndClearExpectations(client_a_.get()); 625 Mock::VerifyAndClearExpectations(client_a_.get());
626 626
627 // Second client connects after the error state. It also should get told of 627 // Second client connects after the error state. It also should get told of
628 // the error. 628 // the error.
629 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); 629 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1);
630 controller_->AddClient( 630 controller_->AddClient(
631 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); 631 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200);
632 Mock::VerifyAndClearExpectations(client_b_.get()); 632 Mock::VerifyAndClearExpectations(client_b_.get());
633 } 633 }
634 634
635 // Exercise OnIncomingCapturedData() code path of VideoCaptureController
kbalazs 2014/12/04 17:00:30 Instead of comment please make the name of the tes
zhaoze.zhou 2014/12/04 19:01:42 All Done.
636 TEST_F(VideoCaptureControllerTest, OnIncomingCapturedData) {
637
638 for (int index = media::PIXEL_FORMAT_I420; index <= media::PIXEL_FORMAT_MAX;
kbalazs 2014/12/04 17:00:30 I would jut assign 0 first, it doesn't matter whic
639 index++) {
640 media::VideoPixelFormat format;
641 format = static_cast<media::VideoPixelFormat>(index);
642 media::VideoCaptureParams session_100;
kbalazs 2014/12/04 17:00:30 100? Copy paste programming?
643 session_100.requested_format = media::VideoCaptureFormat(
644 gfx::Size(320, 240), 30, format);
645
646 gfx::Size capture_resolution(320,240);
kbalazs 2014/12/04 17:00:30 (320, 240) ^ | SPACE!!!
647
648 // The device format needn't match the VideoCaptureParams (the camera can do
649 // what it wants). Pick something random.
650 media::VideoCaptureFormat device_format(
651 gfx::Size(10, 10), 25, media::PIXEL_FORMAT_RGB24);
652
653 const VideoCaptureControllerID client_a_route_1(0x99);
kbalazs 2014/12/04 17:00:30 There is only one client, you can just name it cli
654
655 // add clients
656 controller_->AddClient(client_a_route_1,
657 client_a_.get(),
658 base::kNullProcessHandle,
659 100,
660 session_100);
661 ASSERT_EQ(1, controller_->GetClientCount());
662
663 // Now, simulate an incoming captured buffer from the capture device.
664 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer;
665 buffer =
666 device_->ReserveOutputBuffer(media::VideoFrame::I420,
667 capture_resolution);
668 ASSERT_TRUE(buffer.get());
669
670 // Captured a new video frame
671 device_->OnIncomingCapturedData(
672 (unsigned char*)buffer.get()->data(),
kbalazs 2014/12/04 17:00:30 C-style cast? should be static_cast
673 buffer.get()->size(),
674 session_100.requested_format,
675 0,
676 base::TimeTicks());
677
678 base::RunLoop().RunUntilIdle();
679 Mock::VerifyAndClearExpectations(client_a_.get());
680 }
681 }
682
635 } // namespace content 683 } // 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