Chromium Code Reviews| 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..5580c4a1017ccbaa3a42f46ee04df8febc84f0e8 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, CaptureInEachVideoFormatInSequence) { |
| + for (int format = 0; format < media::PIXEL_FORMAT_TEXTURE; ++format) { |
|
zhaoze.zhou
2014/12/04 23:01:34
Ah.. crashed.. OnIncomingCapturedData() didn't sup
mcasas
2014/12/04 23:11:54
Fair enough.
I would add a comment saying that y
zhaoze.zhou
2014/12/04 23:22:56
Done. Thanks for your suggestion. :)
|
| + media::VideoCaptureParams params; |
| + params.requested_format = media::VideoCaptureFormat( |
| + gfx::Size(320, 240), 30, media::VideoPixelFormat(format)); |
| + |
| + const gfx::Size capture_resolution(320, 240); |
| + |
| + const VideoCaptureControllerID route(0x99); |
| + |
| + // Start with one client. |
| + 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 |