| Index: content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc
|
| diff --git a/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc b/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc
|
| index 9ba692d9d8c3da6eb1fd47c9f37af6e3673ca195..5ef2ef9d87e450b8cfb49f9c081213326b3645a1 100644
|
| --- a/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc
|
| +++ b/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc
|
| @@ -339,7 +339,7 @@ class StubClient : public media::VideoCaptureDevice::Client {
|
| int rotation,
|
| bool flip_vert,
|
| bool flip_horiz,
|
| - const media::VideoCaptureCapability& frame_info) OVERRIDE {
|
| + const media::VideoCaptureFormat& frame_format) OVERRIDE {
|
| FAIL();
|
| }
|
|
|
| @@ -594,14 +594,12 @@ TEST_F(WebContentsVideoCaptureDeviceTest, InvalidInitialWebContentsError) {
|
| // practice; we should be able to recover gracefully.
|
| ResetWebContents();
|
|
|
| - media::VideoCaptureCapability capture_format(
|
| - kTestWidth,
|
| - kTestHeight,
|
| - kTestFramesPerSecond,
|
| - media::PIXEL_FORMAT_I420,
|
| - media::ConstantResolutionVideoCaptureDevice);
|
| - device()->AllocateAndStart(
|
| - capture_format, client_observer()->PassClient());
|
| + media::VideoCaptureParams capture_params;
|
| + capture_params.requested_format.frame_size.SetSize(kTestWidth, kTestHeight);
|
| + capture_params.requested_format.frame_rate = kTestFramesPerSecond;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| + capture_params.allow_resolution_change = false;
|
| + device()->AllocateAndStart(capture_params, client_observer()->PassClient());
|
| ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForError());
|
| device()->StopAndDeAllocate();
|
| }
|
| @@ -609,14 +607,12 @@ TEST_F(WebContentsVideoCaptureDeviceTest, InvalidInitialWebContentsError) {
|
| TEST_F(WebContentsVideoCaptureDeviceTest, WebContentsDestroyed) {
|
| // We'll simulate the tab being closed after the capture pipeline is up and
|
| // running.
|
| - media::VideoCaptureCapability capture_format(
|
| - kTestWidth,
|
| - kTestHeight,
|
| - kTestFramesPerSecond,
|
| - media::PIXEL_FORMAT_I420,
|
| - media::ConstantResolutionVideoCaptureDevice);
|
| - device()->AllocateAndStart(
|
| - capture_format, client_observer()->PassClient());
|
| + media::VideoCaptureParams capture_params;
|
| + capture_params.requested_format.frame_size.SetSize(kTestWidth, kTestHeight);
|
| + capture_params.requested_format.frame_rate = kTestFramesPerSecond;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| + capture_params.allow_resolution_change = false;
|
| + device()->AllocateAndStart(capture_params, client_observer()->PassClient());
|
| // Do one capture to prove
|
| source()->SetSolidColor(SK_ColorRED);
|
| SimulateDrawEvent();
|
| @@ -635,14 +631,12 @@ TEST_F(WebContentsVideoCaptureDeviceTest, WebContentsDestroyed) {
|
|
|
| TEST_F(WebContentsVideoCaptureDeviceTest,
|
| StopDeviceBeforeCaptureMachineCreation) {
|
| - media::VideoCaptureCapability capture_format(
|
| - kTestWidth,
|
| - kTestHeight,
|
| - kTestFramesPerSecond,
|
| - media::PIXEL_FORMAT_I420,
|
| - media::ConstantResolutionVideoCaptureDevice);
|
| - device()->AllocateAndStart(
|
| - capture_format, client_observer()->PassClient());
|
| + media::VideoCaptureParams capture_params;
|
| + capture_params.requested_format.frame_size.SetSize(kTestWidth, kTestHeight);
|
| + capture_params.requested_format.frame_rate = kTestFramesPerSecond;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| + capture_params.allow_resolution_change = false;
|
| + device()->AllocateAndStart(capture_params, client_observer()->PassClient());
|
|
|
| // Make a point of not running the UI messageloop here.
|
| device()->StopAndDeAllocate();
|
| @@ -659,14 +653,12 @@ TEST_F(WebContentsVideoCaptureDeviceTest, StopWithRendererWorkToDo) {
|
| // Set up the test to use RGB copies and an normal
|
| source()->SetCanCopyToVideoFrame(false);
|
| source()->SetUseFrameSubscriber(false);
|
| - media::VideoCaptureCapability capture_format(
|
| - kTestWidth,
|
| - kTestHeight,
|
| - kTestFramesPerSecond,
|
| - media::PIXEL_FORMAT_I420,
|
| - media::ConstantResolutionVideoCaptureDevice);
|
| - device()->AllocateAndStart(
|
| - capture_format, client_observer()->PassClient());
|
| + media::VideoCaptureParams capture_params;
|
| + capture_params.requested_format.frame_size.SetSize(kTestWidth, kTestHeight);
|
| + capture_params.requested_format.frame_rate = kTestFramesPerSecond;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| + capture_params.allow_resolution_change = false;
|
| + device()->AllocateAndStart(capture_params, client_observer()->PassClient());
|
|
|
| base::RunLoop().RunUntilIdle();
|
|
|
| @@ -681,14 +673,12 @@ TEST_F(WebContentsVideoCaptureDeviceTest, StopWithRendererWorkToDo) {
|
| }
|
|
|
| TEST_F(WebContentsVideoCaptureDeviceTest, DeviceRestart) {
|
| - media::VideoCaptureCapability capture_format(
|
| - kTestWidth,
|
| - kTestHeight,
|
| - kTestFramesPerSecond,
|
| - media::PIXEL_FORMAT_I420,
|
| - media::ConstantResolutionVideoCaptureDevice);
|
| - device()->AllocateAndStart(
|
| - capture_format, client_observer()->PassClient());
|
| + media::VideoCaptureParams capture_params;
|
| + capture_params.requested_format.frame_size.SetSize(kTestWidth, kTestHeight);
|
| + capture_params.requested_format.frame_rate = kTestFramesPerSecond;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| + capture_params.allow_resolution_change = false;
|
| + device()->AllocateAndStart(capture_params, client_observer()->PassClient());
|
| base::RunLoop().RunUntilIdle();
|
| source()->SetSolidColor(SK_ColorRED);
|
| SimulateDrawEvent();
|
| @@ -707,7 +697,7 @@ TEST_F(WebContentsVideoCaptureDeviceTest, DeviceRestart) {
|
| base::RunLoop().RunUntilIdle();
|
|
|
| StubClientObserver observer2;
|
| - device()->AllocateAndStart(capture_format, observer2.PassClient());
|
| + device()->AllocateAndStart(capture_params, observer2.PassClient());
|
| source()->SetSolidColor(SK_ColorBLUE);
|
| SimulateDrawEvent();
|
| ASSERT_NO_FATAL_FAILURE(observer2.WaitForNextColor(SK_ColorBLUE));
|
| @@ -722,14 +712,12 @@ TEST_F(WebContentsVideoCaptureDeviceTest, DeviceRestart) {
|
| // consumer. The test will alternate between the three capture paths, simulating
|
| // falling in and out of accelerated compositing.
|
| TEST_F(WebContentsVideoCaptureDeviceTest, GoesThroughAllTheMotions) {
|
| - media::VideoCaptureCapability capture_format(
|
| - kTestWidth,
|
| - kTestHeight,
|
| - kTestFramesPerSecond,
|
| - media::PIXEL_FORMAT_I420,
|
| - media::ConstantResolutionVideoCaptureDevice);
|
| - device()->AllocateAndStart(
|
| - capture_format, client_observer()->PassClient());
|
| + media::VideoCaptureParams capture_params;
|
| + capture_params.requested_format.frame_size.SetSize(kTestWidth, kTestHeight);
|
| + capture_params.requested_format.frame_rate = kTestFramesPerSecond;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| + capture_params.allow_resolution_change = false;
|
| + device()->AllocateAndStart(capture_params, client_observer()->PassClient());
|
|
|
| for (int i = 0; i < 6; i++) {
|
| const char* name = NULL;
|
| @@ -775,18 +763,17 @@ TEST_F(WebContentsVideoCaptureDeviceTest, GoesThroughAllTheMotions) {
|
| }
|
|
|
| TEST_F(WebContentsVideoCaptureDeviceTest, RejectsInvalidAllocateParams) {
|
| - media::VideoCaptureCapability capture_format(
|
| - 1280,
|
| - 720,
|
| - -2,
|
| - media::PIXEL_FORMAT_I420,
|
| - media::ConstantResolutionVideoCaptureDevice);
|
| + media::VideoCaptureParams capture_params;
|
| + capture_params.requested_format.frame_size.SetSize(1280, 720);
|
| + capture_params.requested_format.frame_rate = -2;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| + capture_params.allow_resolution_change = false;
|
| BrowserThread::PostTask(
|
| BrowserThread::UI,
|
| FROM_HERE,
|
| base::Bind(&media::VideoCaptureDevice::AllocateAndStart,
|
| base::Unretained(device()),
|
| - capture_format,
|
| + capture_params,
|
| base::Passed(client_observer()->PassClient())));
|
| ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForError());
|
| BrowserThread::PostTask(
|
| @@ -798,17 +785,15 @@ TEST_F(WebContentsVideoCaptureDeviceTest, RejectsInvalidAllocateParams) {
|
| }
|
|
|
| TEST_F(WebContentsVideoCaptureDeviceTest, BadFramesGoodFrames) {
|
| - media::VideoCaptureCapability capture_format(
|
| - kTestWidth,
|
| - kTestHeight,
|
| - kTestFramesPerSecond,
|
| - media::PIXEL_FORMAT_I420,
|
| - media::ConstantResolutionVideoCaptureDevice);
|
| + media::VideoCaptureParams capture_params;
|
| + capture_params.requested_format.frame_size.SetSize(kTestWidth, kTestHeight);
|
| + capture_params.requested_format.frame_rate = kTestFramesPerSecond;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| + capture_params.allow_resolution_change = false;
|
| // 1x1 is too small to process; we intend for this to result in an error.
|
| source()->SetCopyResultSize(1, 1);
|
| source()->SetSolidColor(SK_ColorRED);
|
| - device()->AllocateAndStart(
|
| - capture_format, client_observer()->PassClient());
|
| + device()->AllocateAndStart(capture_params, client_observer()->PassClient());
|
|
|
| // These frames ought to be dropped during the Render stage. Let
|
| // several captures to happen.
|
|
|