| OLD | NEW |
| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 session_100.requested_format = media::VideoCaptureFormat( | 286 session_100.requested_format = media::VideoCaptureFormat( |
| 287 gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420); | 287 gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420); |
| 288 | 288 |
| 289 media::VideoCaptureParams session_200 = session_100; | 289 media::VideoCaptureParams session_200 = session_100; |
| 290 | 290 |
| 291 media::VideoCaptureParams session_300 = session_100; | 291 media::VideoCaptureParams session_300 = session_100; |
| 292 | 292 |
| 293 media::VideoCaptureParams session_1 = session_100; | 293 media::VideoCaptureParams session_1 = session_100; |
| 294 | 294 |
| 295 const gfx::Size capture_resolution(444, 200); | 295 const gfx::Size capture_resolution(444, 200); |
| 296 | 296 const media::VideoCaptureFormat capture_format(capture_resolution, 0.0, |
| 297 media::PIXEL_FORMAT_I420); |
| 297 // The device format needn't match the VideoCaptureParams (the camera can do | 298 // The device format needn't match the VideoCaptureParams (the camera can do |
| 298 // what it wants). Pick something random. | 299 // what it wants). Pick something random. |
| 299 media::VideoCaptureFormat device_format( | 300 media::VideoCaptureFormat device_format( |
| 300 gfx::Size(10, 10), 25, media::PIXEL_FORMAT_RGB24); | 301 gfx::Size(10, 10), 25, media::PIXEL_FORMAT_RGB24); |
| 301 | 302 |
| 302 const VideoCaptureControllerID client_a_route_1(0xa1a1a1a1); | 303 const VideoCaptureControllerID client_a_route_1(0xa1a1a1a1); |
| 303 const VideoCaptureControllerID client_a_route_2(0xa2a2a2a2); | 304 const VideoCaptureControllerID client_a_route_2(0xa2a2a2a2); |
| 304 const VideoCaptureControllerID client_b_route_1(0xb1b1b1b1); | 305 const VideoCaptureControllerID client_b_route_1(0xb1b1b1b1); |
| 305 const VideoCaptureControllerID client_b_route_2(0xb2b2b2b2); | 306 const VideoCaptureControllerID client_b_route_2(0xb2b2b2b2); |
| 306 | 307 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 318 controller_->AddClient(client_a_route_2, | 319 controller_->AddClient(client_a_route_2, |
| 319 client_a_.get(), | 320 client_a_.get(), |
| 320 base::kNullProcessHandle, | 321 base::kNullProcessHandle, |
| 321 200, | 322 200, |
| 322 session_200); | 323 session_200); |
| 323 ASSERT_EQ(3, controller_->GetClientCount()); | 324 ASSERT_EQ(3, controller_->GetClientCount()); |
| 324 | 325 |
| 325 // Now, simulate an incoming captured buffer from the capture device. As a | 326 // Now, simulate an incoming captured buffer from the capture device. As a |
| 326 // side effect this will cause the first buffer to be shared with clients. | 327 // side effect this will cause the first buffer to be shared with clients. |
| 327 uint8 buffer_no = 1; | 328 uint8 buffer_no = 1; |
| 328 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer; | 329 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer = |
| 329 buffer = | 330 device_->ReserveOutputBuffer(capture_format); |
| 330 device_->ReserveOutputBuffer(media::VideoFrame::I420, capture_resolution); | |
| 331 ASSERT_TRUE(buffer.get()); | 331 ASSERT_TRUE(buffer.get()); |
| 332 memset(buffer->data(), buffer_no++, buffer->size()); | 332 memset(buffer->data(), buffer_no++, buffer->size()); |
| 333 { | 333 { |
| 334 InSequence s; | 334 InSequence s; |
| 335 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_1)).Times(1); | 335 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_1)).Times(1); |
| 336 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_1,_)).Times(1); | 336 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_1,_)).Times(1); |
| 337 } | 337 } |
| 338 { | 338 { |
| 339 InSequence s; | 339 InSequence s; |
| 340 EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_1)).Times(1); | 340 EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_1)).Times(1); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 351 base::TimeTicks()); | 351 base::TimeTicks()); |
| 352 buffer = NULL; | 352 buffer = NULL; |
| 353 | 353 |
| 354 base::RunLoop().RunUntilIdle(); | 354 base::RunLoop().RunUntilIdle(); |
| 355 Mock::VerifyAndClearExpectations(client_a_.get()); | 355 Mock::VerifyAndClearExpectations(client_a_.get()); |
| 356 Mock::VerifyAndClearExpectations(client_b_.get()); | 356 Mock::VerifyAndClearExpectations(client_b_.get()); |
| 357 | 357 |
| 358 // Second buffer which ought to use the same shared memory buffer. In this | 358 // Second buffer which ought to use the same shared memory buffer. In this |
| 359 // case pretend that the Buffer pointer is held by the device for a long | 359 // case pretend that the Buffer pointer is held by the device for a long |
| 360 // delay. This shouldn't affect anything. | 360 // delay. This shouldn't affect anything. |
| 361 buffer = | 361 buffer = device_->ReserveOutputBuffer(capture_format); |
| 362 device_->ReserveOutputBuffer(media::VideoFrame::I420, capture_resolution); | |
| 363 ASSERT_TRUE(buffer.get()); | 362 ASSERT_TRUE(buffer.get()); |
| 364 memset(buffer->data(), buffer_no++, buffer->size()); | 363 memset(buffer->data(), buffer_no++, buffer->size()); |
| 365 device_->OnIncomingCapturedVideoFrame( | 364 device_->OnIncomingCapturedVideoFrame( |
| 366 buffer, | 365 buffer, |
| 367 WrapI420Buffer(buffer, capture_resolution), | 366 WrapI420Buffer(buffer, capture_resolution), |
| 368 base::TimeTicks()); | 367 base::TimeTicks()); |
| 369 buffer = NULL; | 368 buffer = NULL; |
| 370 | 369 |
| 371 // The buffer should be delivered to the clients in any order. | 370 // The buffer should be delivered to the clients in any order. |
| 372 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_1,_)).Times(1); | 371 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_1,_)).Times(1); |
| 373 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_1,_)).Times(1); | 372 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_1,_)).Times(1); |
| 374 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_2,_)).Times(1); | 373 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_2,_)).Times(1); |
| 375 base::RunLoop().RunUntilIdle(); | 374 base::RunLoop().RunUntilIdle(); |
| 376 Mock::VerifyAndClearExpectations(client_a_.get()); | 375 Mock::VerifyAndClearExpectations(client_a_.get()); |
| 377 Mock::VerifyAndClearExpectations(client_b_.get()); | 376 Mock::VerifyAndClearExpectations(client_b_.get()); |
| 378 | 377 |
| 379 // Add a fourth client now that some buffers have come through. | 378 // Add a fourth client now that some buffers have come through. |
| 380 controller_->AddClient(client_b_route_2, | 379 controller_->AddClient(client_b_route_2, |
| 381 client_b_.get(), | 380 client_b_.get(), |
| 382 base::kNullProcessHandle, | 381 base::kNullProcessHandle, |
| 383 1, | 382 1, |
| 384 session_1); | 383 session_1); |
| 385 Mock::VerifyAndClearExpectations(client_b_.get()); | 384 Mock::VerifyAndClearExpectations(client_b_.get()); |
| 386 | 385 |
| 387 // Third, fourth, and fifth buffers. Pretend they all arrive at the same time. | 386 // Third, fourth, and fifth buffers. Pretend they all arrive at the same time. |
| 388 for (int i = 0; i < kPoolSize; i++) { | 387 for (int i = 0; i < kPoolSize; i++) { |
| 389 buffer = device_->ReserveOutputBuffer(media::VideoFrame::I420, | 388 buffer = device_->ReserveOutputBuffer(capture_format); |
| 390 capture_resolution); | |
| 391 ASSERT_TRUE(buffer.get()); | 389 ASSERT_TRUE(buffer.get()); |
| 392 memset(buffer->data(), buffer_no++, buffer->size()); | 390 memset(buffer->data(), buffer_no++, buffer->size()); |
| 393 device_->OnIncomingCapturedVideoFrame( | 391 device_->OnIncomingCapturedVideoFrame( |
| 394 buffer, | 392 buffer, |
| 395 WrapI420Buffer(buffer, capture_resolution), | 393 WrapI420Buffer(buffer, capture_resolution), |
| 396 base::TimeTicks()); | 394 base::TimeTicks()); |
| 397 buffer = NULL; | 395 buffer = NULL; |
| 398 } | 396 } |
| 399 // ReserveOutputBuffer ought to fail now, because the pool is depleted. | 397 // ReserveOutputBuffer ought to fail now, because the pool is depleted. |
| 400 ASSERT_FALSE(device_->ReserveOutputBuffer(media::VideoFrame::I420, | 398 ASSERT_FALSE(device_->ReserveOutputBuffer(capture_format).get()); |
| 401 capture_resolution).get()); | |
| 402 | 399 |
| 403 // The new client needs to be told of 3 buffers; the old clients only 2. | 400 // The new client needs to be told of 3 buffers; the old clients only 2. |
| 404 EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_2)).Times(kPoolSize); | 401 EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_2)).Times(kPoolSize); |
| 405 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2,_)).Times(kPoolSize); | 402 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2,_)).Times(kPoolSize); |
| 406 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_1)) | 403 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_1)) |
| 407 .Times(kPoolSize - 1); | 404 .Times(kPoolSize - 1); |
| 408 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_1,_)).Times(kPoolSize); | 405 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_1,_)).Times(kPoolSize); |
| 409 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_2)) | 406 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_2)) |
| 410 .Times(kPoolSize - 1); | 407 .Times(kPoolSize - 1); |
| 411 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_2,_)).Times(kPoolSize); | 408 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_2,_)).Times(kPoolSize); |
| 412 EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_1)) | 409 EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_1)) |
| 413 .Times(kPoolSize - 1); | 410 .Times(kPoolSize - 1); |
| 414 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_1,_)).Times(kPoolSize); | 411 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_1,_)).Times(kPoolSize); |
| 415 base::RunLoop().RunUntilIdle(); | 412 base::RunLoop().RunUntilIdle(); |
| 416 Mock::VerifyAndClearExpectations(client_a_.get()); | 413 Mock::VerifyAndClearExpectations(client_a_.get()); |
| 417 Mock::VerifyAndClearExpectations(client_b_.get()); | 414 Mock::VerifyAndClearExpectations(client_b_.get()); |
| 418 | 415 |
| 419 // Now test the interaction of client shutdown and buffer delivery. | 416 // Now test the interaction of client shutdown and buffer delivery. |
| 420 // Kill A1 via renderer disconnect (synchronous). | 417 // Kill A1 via renderer disconnect (synchronous). |
| 421 controller_->RemoveClient(client_a_route_1, client_a_.get()); | 418 controller_->RemoveClient(client_a_route_1, client_a_.get()); |
| 422 // Kill B1 via session close (posts a task to disconnect). | 419 // Kill B1 via session close (posts a task to disconnect). |
| 423 EXPECT_CALL(*client_b_, DoEnded(client_b_route_1)).Times(1); | 420 EXPECT_CALL(*client_b_, DoEnded(client_b_route_1)).Times(1); |
| 424 controller_->StopSession(300); | 421 controller_->StopSession(300); |
| 425 // Queue up another buffer. | 422 // Queue up another buffer. |
| 426 buffer = | 423 buffer = device_->ReserveOutputBuffer(capture_format); |
| 427 device_->ReserveOutputBuffer(media::VideoFrame::I420, capture_resolution); | |
| 428 ASSERT_TRUE(buffer.get()); | 424 ASSERT_TRUE(buffer.get()); |
| 429 memset(buffer->data(), buffer_no++, buffer->size()); | 425 memset(buffer->data(), buffer_no++, buffer->size()); |
| 430 device_->OnIncomingCapturedVideoFrame( | 426 device_->OnIncomingCapturedVideoFrame( |
| 431 buffer, | 427 buffer, |
| 432 WrapI420Buffer(buffer, capture_resolution), | 428 WrapI420Buffer(buffer, capture_resolution), |
| 433 base::TimeTicks()); | 429 base::TimeTicks()); |
| 434 buffer = NULL; | 430 buffer = NULL; |
| 435 buffer = | 431 buffer = device_->ReserveOutputBuffer(capture_format); |
| 436 device_->ReserveOutputBuffer(media::VideoFrame::I420, capture_resolution); | |
| 437 { | 432 { |
| 438 // Kill A2 via session close (posts a task to disconnect, but A2 must not | 433 // Kill A2 via session close (posts a task to disconnect, but A2 must not |
| 439 // be sent either of these two buffers). | 434 // be sent either of these two buffers). |
| 440 EXPECT_CALL(*client_a_, DoEnded(client_a_route_2)).Times(1); | 435 EXPECT_CALL(*client_a_, DoEnded(client_a_route_2)).Times(1); |
| 441 controller_->StopSession(200); | 436 controller_->StopSession(200); |
| 442 } | 437 } |
| 443 ASSERT_TRUE(buffer.get()); | 438 ASSERT_TRUE(buffer.get()); |
| 444 memset(buffer->data(), buffer_no++, buffer->size()); | 439 memset(buffer->data(), buffer_no++, buffer->size()); |
| 445 device_->OnIncomingCapturedVideoFrame( | 440 device_->OnIncomingCapturedVideoFrame( |
| 446 buffer, | 441 buffer, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 462 int mailbox_buffers = kPoolSize / 2; | 457 int mailbox_buffers = kPoolSize / 2; |
| 463 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); | 458 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); |
| 464 #endif | 459 #endif |
| 465 int shm_buffers = kPoolSize - mailbox_buffers; | 460 int shm_buffers = kPoolSize - mailbox_buffers; |
| 466 if (shm_buffers == mailbox_buffers) { | 461 if (shm_buffers == mailbox_buffers) { |
| 467 shm_buffers--; | 462 shm_buffers--; |
| 468 mailbox_buffers++; | 463 mailbox_buffers++; |
| 469 } | 464 } |
| 470 | 465 |
| 471 for (int i = 0; i < shm_buffers; ++i) { | 466 for (int i = 0; i < shm_buffers; ++i) { |
| 472 buffer = device_->ReserveOutputBuffer(media::VideoFrame::I420, | 467 buffer = device_->ReserveOutputBuffer(capture_format); |
| 473 capture_resolution); | |
| 474 ASSERT_TRUE(buffer.get()); | 468 ASSERT_TRUE(buffer.get()); |
| 475 device_->OnIncomingCapturedVideoFrame( | 469 device_->OnIncomingCapturedVideoFrame( |
| 476 buffer, | 470 buffer, |
| 477 WrapI420Buffer(buffer, capture_resolution), | 471 WrapI420Buffer(buffer, capture_resolution), |
| 478 base::TimeTicks()); | 472 base::TimeTicks()); |
| 479 buffer = NULL; | 473 buffer = NULL; |
| 480 } | 474 } |
| 481 std::vector<uint32> mailbox_syncpoints(mailbox_buffers); | 475 std::vector<uint32> mailbox_syncpoints(mailbox_buffers); |
| 482 std::vector<uint32> release_syncpoints(mailbox_buffers); | 476 std::vector<uint32> release_syncpoints(mailbox_buffers); |
| 477 const media::VideoCaptureFormat capture_as_texture_format( |
| 478 gfx::Size(0, 0), 0.0, media::PIXEL_FORMAT_TEXTURE); |
| 483 for (int i = 0; i < mailbox_buffers; ++i) { | 479 for (int i = 0; i < mailbox_buffers; ++i) { |
| 484 buffer = device_->ReserveOutputBuffer(media::VideoFrame::NATIVE_TEXTURE, | 480 buffer = device_->ReserveOutputBuffer(capture_as_texture_format); |
| 485 gfx::Size(0, 0)); | |
| 486 ASSERT_TRUE(buffer.get()); | 481 ASSERT_TRUE(buffer.get()); |
| 487 #if !defined(OS_ANDROID) | 482 #if !defined(OS_ANDROID) |
| 488 mailbox_syncpoints[i] = gl_helper->InsertSyncPoint(); | 483 mailbox_syncpoints[i] = gl_helper->InsertSyncPoint(); |
| 489 #endif | 484 #endif |
| 490 device_->OnIncomingCapturedVideoFrame( | 485 device_->OnIncomingCapturedVideoFrame( |
| 491 buffer, | 486 buffer, |
| 492 WrapMailboxBuffer(make_scoped_ptr(new gpu::MailboxHolder( | 487 WrapMailboxBuffer(make_scoped_ptr(new gpu::MailboxHolder( |
| 493 gpu::Mailbox(), 0, mailbox_syncpoints[i])), | 488 gpu::Mailbox(), 0, mailbox_syncpoints[i])), |
| 494 base::Bind(&CacheSyncPoint, &release_syncpoints[i]), | 489 base::Bind(&CacheSyncPoint, &release_syncpoints[i]), |
| 495 capture_resolution), | 490 capture_resolution), |
| 496 base::TimeTicks()); | 491 base::TimeTicks()); |
| 497 buffer = NULL; | 492 buffer = NULL; |
| 498 } | 493 } |
| 499 // ReserveOutputBuffers ought to fail now regardless of buffer format, because | 494 // ReserveOutputBuffers ought to fail now regardless of buffer format, because |
| 500 // the pool is depleted. | 495 // the pool is depleted. |
| 501 ASSERT_FALSE(device_->ReserveOutputBuffer(media::VideoFrame::I420, | 496 ASSERT_FALSE(device_->ReserveOutputBuffer(capture_format).get()); |
| 502 capture_resolution).get()); | 497 ASSERT_FALSE(device_->ReserveOutputBuffer(capture_as_texture_format).get()); |
| 503 ASSERT_FALSE(device_->ReserveOutputBuffer(media::VideoFrame::NATIVE_TEXTURE, | |
| 504 gfx::Size(0, 0)).get()); | |
| 505 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2,_)).Times(shm_buffers); | 498 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2,_)).Times(shm_buffers); |
| 506 EXPECT_CALL(*client_b_, DoMailboxBufferReady(client_b_route_2)) | 499 EXPECT_CALL(*client_b_, DoMailboxBufferReady(client_b_route_2)) |
| 507 .Times(mailbox_buffers); | 500 .Times(mailbox_buffers); |
| 508 base::RunLoop().RunUntilIdle(); | 501 base::RunLoop().RunUntilIdle(); |
| 509 for (size_t i = 0; i < mailbox_syncpoints.size(); ++i) { | 502 for (size_t i = 0; i < mailbox_syncpoints.size(); ++i) { |
| 510 // A new release sync point must be inserted when the video frame is | 503 // A new release sync point must be inserted when the video frame is |
| 511 // returned to the Browser process. | 504 // returned to the Browser process. |
| 512 // See: MockVideoCaptureControllerEventHandler::OnMailboxBufferReady() and | 505 // See: MockVideoCaptureControllerEventHandler::OnMailboxBufferReady() and |
| 513 // VideoCaptureController::ReturnBuffer() | 506 // VideoCaptureController::ReturnBuffer() |
| 514 ASSERT_NE(mailbox_syncpoints[i], release_syncpoints[i]); | 507 ASSERT_NE(mailbox_syncpoints[i], release_syncpoints[i]); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 542 Mock::VerifyAndClearExpectations(client_a_.get()); | 535 Mock::VerifyAndClearExpectations(client_a_.get()); |
| 543 | 536 |
| 544 // Second client connects after the error state. It also should get told of | 537 // Second client connects after the error state. It also should get told of |
| 545 // the error. | 538 // the error. |
| 546 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); | 539 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); |
| 547 controller_->AddClient( | 540 controller_->AddClient( |
| 548 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); | 541 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); |
| 549 base::RunLoop().RunUntilIdle(); | 542 base::RunLoop().RunUntilIdle(); |
| 550 Mock::VerifyAndClearExpectations(client_b_.get()); | 543 Mock::VerifyAndClearExpectations(client_b_.get()); |
| 551 | 544 |
| 545 const media::VideoCaptureFormat capture_format(capture_resolution, 0.0, |
| 546 media::PIXEL_FORMAT_I420); |
| 552 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer = | 547 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer = |
| 553 device_->ReserveOutputBuffer(media::VideoFrame::I420, capture_resolution); | 548 device_->ReserveOutputBuffer(capture_format); |
| 554 ASSERT_TRUE(buffer.get()); | 549 ASSERT_TRUE(buffer.get()); |
| 555 | 550 |
| 556 device_->OnIncomingCapturedVideoFrame( | 551 device_->OnIncomingCapturedVideoFrame( |
| 557 buffer, | 552 buffer, |
| 558 WrapI420Buffer(buffer, capture_resolution), | 553 WrapI420Buffer(buffer, capture_resolution), |
| 559 base::TimeTicks()); | 554 base::TimeTicks()); |
| 560 buffer = NULL; | 555 buffer = NULL; |
| 561 | 556 |
| 562 base::RunLoop().RunUntilIdle(); | 557 base::RunLoop().RunUntilIdle(); |
| 563 } | 558 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 579 media::VideoCaptureFormat device_format( | 574 media::VideoCaptureFormat device_format( |
| 580 gfx::Size(10, 10), 25, media::PIXEL_FORMAT_ARGB); | 575 gfx::Size(10, 10), 25, media::PIXEL_FORMAT_ARGB); |
| 581 | 576 |
| 582 // Start the device. Then, before the first buffer, signal an error and | 577 // Start the device. Then, before the first buffer, signal an error and |
| 583 // deliver the buffer. The error should be propagated to clients; the buffer | 578 // deliver the buffer. The error should be propagated to clients; the buffer |
| 584 // should not be. | 579 // should not be. |
| 585 base::RunLoop().RunUntilIdle(); | 580 base::RunLoop().RunUntilIdle(); |
| 586 Mock::VerifyAndClearExpectations(client_a_.get()); | 581 Mock::VerifyAndClearExpectations(client_a_.get()); |
| 587 | 582 |
| 588 const gfx::Size dims(320, 240); | 583 const gfx::Size dims(320, 240); |
| 584 const media::VideoCaptureFormat capture_format(dims, 0.0, |
| 585 media::PIXEL_FORMAT_I420); |
| 589 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer = | 586 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer = |
| 590 device_->ReserveOutputBuffer(media::VideoFrame::I420, dims); | 587 device_->ReserveOutputBuffer(capture_format); |
| 591 ASSERT_TRUE(buffer.get()); | 588 ASSERT_TRUE(buffer.get()); |
| 592 | 589 |
| 593 device_->OnError("Test error"); | 590 device_->OnError("Test error"); |
| 594 device_->OnIncomingCapturedVideoFrame( | 591 device_->OnIncomingCapturedVideoFrame( |
| 595 buffer, | 592 buffer, |
| 596 WrapI420Buffer(buffer, dims), | 593 WrapI420Buffer(buffer, dims), |
| 597 base::TimeTicks()); | 594 base::TimeTicks()); |
| 598 buffer = NULL; | 595 buffer = NULL; |
| 599 | 596 |
| 600 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1); | 597 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 EXPECT_EQ(coded_size.width(), size_and_rotation.output_resolution.width()); | 700 EXPECT_EQ(coded_size.width(), size_and_rotation.output_resolution.width()); |
| 704 EXPECT_EQ(coded_size.height(), | 701 EXPECT_EQ(coded_size.height(), |
| 705 size_and_rotation.output_resolution.height()); | 702 size_and_rotation.output_resolution.height()); |
| 706 | 703 |
| 707 EXPECT_EQ(kSessionId, controller_->RemoveClient(route_id, client_a_.get())); | 704 EXPECT_EQ(kSessionId, controller_->RemoveClient(route_id, client_a_.get())); |
| 708 Mock::VerifyAndClearExpectations(client_a_.get()); | 705 Mock::VerifyAndClearExpectations(client_a_.get()); |
| 709 } | 706 } |
| 710 } | 707 } |
| 711 | 708 |
| 712 } // namespace content | 709 } // namespace content |
| OLD | NEW |