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

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: Remove un-needed mock framewok 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 TEST_F(VideoCaptureControllerTest, DataCaptureInEachVideoFormatInSequence) {
636 // This Test will skip PIXEL_FORMAT_TEXTURE and PIXEL_FORMAT_UNKNOWN
637 for (int format = 0; format < media::PIXEL_FORMAT_TEXTURE; ++format) {
638 media::VideoCaptureParams params;
639 params.requested_format = media::VideoCaptureFormat(
640 gfx::Size(320, 240), 30, media::VideoPixelFormat(format));
641
642 const gfx::Size capture_resolution(320, 240);
643
644 const VideoCaptureControllerID route(0x99);
645
646 // Start with one client.
647 controller_->AddClient(route,
648 client_a_.get(),
649 base::kNullProcessHandle,
650 100,
651 params);
652 ASSERT_EQ(1, controller_->GetClientCount());
653
654 // Now, simulate an incoming captured buffer from the capture device.
655 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer;
656 buffer =
657 device_->ReserveOutputBuffer(media::VideoFrame::I420,
658 capture_resolution);
659 ASSERT_TRUE(buffer.get());
660
661 // Captured a new video frame.
662 device_->OnIncomingCapturedData(
663 static_cast<unsigned char*>(buffer.get()->data()),
664 buffer.get()->size(),
665 params.requested_format,
666 0,
667 base::TimeTicks());
668 }
669 }
670
635 } // namespace content 671 } // 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