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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_controller_unittest.cc
diff --git a/content/browser/renderer_host/media/video_capture_controller_unittest.cc b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
index 091a288285c9aeab9d18aa385c8f34566f277929..2be3a7582bb3e3800a184e56a9bb6333f67b1739 100644
--- a/content/browser/renderer_host/media/video_capture_controller_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
@@ -632,4 +632,42 @@ TEST_F(VideoCaptureControllerTest, ErrorAfterDeviceCreation) {
Mock::VerifyAndClearExpectations(client_b_.get());
}
+TEST_F(VideoCaptureControllerTest, CaptureAllVideoFormats) {
mcasas 2014/12/04 21:09:06 Suggest test name like: CaptureInEachVideoFormatIn
zhaoze.zhou 2014/12/04 21:54:16 Done.
+ for (int format = 0; format <= media::PIXEL_FORMAT_MAX; format++) {
mcasas 2014/12/04 21:09:07 for (VideoPixelFormat format = 0; format < PIXEL_F
zhaoze.zhou 2014/12/04 21:54:16 for this, it will need to cast format to int when
mcasas 2014/12/04 23:11:53 Ah, true. Leave it then.
+ media::VideoCaptureParams params;
+ params.requested_format = media::VideoCaptureFormat(
+ gfx::Size(320, 240), 30, media::VideoPixelFormat(format));
+
+ gfx::Size capture_resolution(320, 240);
mcasas 2014/12/04 21:09:06 const?
zhaoze.zhou 2014/12/04 21:54:16 Done.
+
+ const VideoCaptureControllerID route(0x99);
+
+ // add clients
+ controller_->AddClient(route,
+ client_a_.get(),
+ base::kNullProcessHandle,
+ 100,
+ params);
+ ASSERT_EQ(1, controller_->GetClientCount());
+
+ // Now, simulate an incoming captured buffer from the capture device.
+ scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer;
+ buffer =
+ device_->ReserveOutputBuffer(media::VideoFrame::I420,
+ capture_resolution);
+ ASSERT_TRUE(buffer.get());
+
+ // Captured a new video frame
+ device_->OnIncomingCapturedData(
+ static_cast<unsigned char*>(buffer.get()->data()),
+ buffer.get()->size(),
+ params.requested_format,
+ 0,
+ base::TimeTicks());
+
+ base::RunLoop().RunUntilIdle();
+ Mock::VerifyAndClearExpectations(client_a_.get());
+ }
+}
+
} // namespace content
« 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