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

Side by Side Diff: content/browser/renderer_host/media/video_capture_controller_unittest.cc

Issue 1179323002: Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hubbe@s comments and minor rebase Created 5 years, 6 months 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 base::kNullProcessHandle, 322 base::kNullProcessHandle,
323 200, 323 200,
324 session_200); 324 session_200);
325 ASSERT_EQ(3, controller_->GetClientCount()); 325 ASSERT_EQ(3, controller_->GetClientCount());
326 326
327 // Now, simulate an incoming captured buffer from the capture device. As a 327 // Now, simulate an incoming captured buffer from the capture device. As a
328 // side effect this will cause the first buffer to be shared with clients. 328 // side effect this will cause the first buffer to be shared with clients.
329 uint8 buffer_no = 1; 329 uint8 buffer_no = 1;
330 ASSERT_EQ(0.0, device_->GetBufferPoolUtilization()); 330 ASSERT_EQ(0.0, device_->GetBufferPoolUtilization());
331 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer( 331 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer(
332 device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420, 332 device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
333 capture_resolution)); 333 media::PIXEL_STORAGE_CPU));
334 ASSERT_TRUE(buffer.get()); 334 ASSERT_TRUE(buffer.get());
335 ASSERT_EQ(1.0 / kPoolSize, device_->GetBufferPoolUtilization()); 335 ASSERT_EQ(1.0 / kPoolSize, device_->GetBufferPoolUtilization());
336 memset(buffer->data(), buffer_no++, buffer->size()); 336 memset(buffer->data(), buffer_no++, buffer->size());
337 { 337 {
338 InSequence s; 338 InSequence s;
339 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_1)).Times(1); 339 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_1)).Times(1);
340 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_1,_)).Times(1); 340 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_1,_)).Times(1);
341 } 341 }
342 { 342 {
343 InSequence s; 343 InSequence s;
(...skipping 22 matching lines...) Expand all
366 double resource_utilization_in_metadata = -1.0; 366 double resource_utilization_in_metadata = -1.0;
367 ASSERT_TRUE(video_frame->metadata()->GetDouble( 367 ASSERT_TRUE(video_frame->metadata()->GetDouble(
368 media::VideoFrameMetadata::RESOURCE_UTILIZATION, 368 media::VideoFrameMetadata::RESOURCE_UTILIZATION,
369 &resource_utilization_in_metadata)); 369 &resource_utilization_in_metadata));
370 ASSERT_EQ(0.5, resource_utilization_in_metadata); 370 ASSERT_EQ(0.5, resource_utilization_in_metadata);
371 371
372 // Second buffer which ought to use the same shared memory buffer. In this 372 // Second buffer which ought to use the same shared memory buffer. In this
373 // case pretend that the Buffer pointer is held by the device for a long 373 // case pretend that the Buffer pointer is held by the device for a long
374 // delay. This shouldn't affect anything. 374 // delay. This shouldn't affect anything.
375 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer2 = 375 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer2 =
376 device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420, 376 device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
377 capture_resolution); 377 media::PIXEL_STORAGE_CPU);
378 ASSERT_TRUE(buffer2.get()); 378 ASSERT_TRUE(buffer2.get());
379 memset(buffer2->data(), buffer_no++, buffer2->size()); 379 memset(buffer2->data(), buffer_no++, buffer2->size());
380 video_frame = 380 video_frame =
381 WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer2->data())); 381 WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer2->data()));
382 ASSERT_FALSE(video_frame->metadata()->HasKey( 382 ASSERT_FALSE(video_frame->metadata()->HasKey(
383 media::VideoFrameMetadata::RESOURCE_UTILIZATION)); 383 media::VideoFrameMetadata::RESOURCE_UTILIZATION));
384 client_a_->resource_utilization_ = 0.5; 384 client_a_->resource_utilization_ = 0.5;
385 client_b_->resource_utilization_ = 3.14; 385 client_b_->resource_utilization_ = 3.14;
386 device_->OnIncomingCapturedVideoFrame(buffer2.Pass(), video_frame, 386 device_->OnIncomingCapturedVideoFrame(buffer2.Pass(), video_frame,
387 base::TimeTicks()); 387 base::TimeTicks());
(...skipping 17 matching lines...) Expand all
405 controller_->AddClient(client_b_route_2, 405 controller_->AddClient(client_b_route_2,
406 client_b_.get(), 406 client_b_.get(),
407 base::kNullProcessHandle, 407 base::kNullProcessHandle,
408 1, 408 1,
409 session_1); 409 session_1);
410 Mock::VerifyAndClearExpectations(client_b_.get()); 410 Mock::VerifyAndClearExpectations(client_b_.get());
411 411
412 // Third, fourth, and fifth buffers. Pretend they all arrive at the same time. 412 // Third, fourth, and fifth buffers. Pretend they all arrive at the same time.
413 for (int i = 0; i < kPoolSize; i++) { 413 for (int i = 0; i < kPoolSize; i++) {
414 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer = 414 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer =
415 device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420, 415 device_->ReserveOutputBuffer(capture_resolution,
416 capture_resolution); 416 media::PIXEL_FORMAT_I420,
417 media::PIXEL_STORAGE_CPU);
417 ASSERT_TRUE(buffer.get()); 418 ASSERT_TRUE(buffer.get());
418 memset(buffer->data(), buffer_no++, buffer->size()); 419 memset(buffer->data(), buffer_no++, buffer->size());
419 video_frame = 420 video_frame =
420 WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data())); 421 WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data()));
421 device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame, 422 device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame,
422 base::TimeTicks()); 423 base::TimeTicks());
423 } 424 }
424 // ReserveOutputBuffer ought to fail now, because the pool is depleted. 425 // ReserveOutputBuffer ought to fail now, because the pool is depleted.
425 ASSERT_FALSE(device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420, 426 ASSERT_FALSE(device_->ReserveOutputBuffer(capture_resolution,
426 capture_resolution).get()); 427 media::PIXEL_FORMAT_I420,
428 media::PIXEL_STORAGE_CPU).get());
427 429
428 // The new client needs to be told of 3 buffers; the old clients only 2. 430 // The new client needs to be told of 3 buffers; the old clients only 2.
429 EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_2)).Times(kPoolSize); 431 EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_2)).Times(kPoolSize);
430 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2,_)).Times(kPoolSize); 432 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2,_)).Times(kPoolSize);
431 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_1)) 433 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_1))
432 .Times(kPoolSize - 1); 434 .Times(kPoolSize - 1);
433 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_1,_)).Times(kPoolSize); 435 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_1,_)).Times(kPoolSize);
434 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_2)) 436 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_2))
435 .Times(kPoolSize - 1); 437 .Times(kPoolSize - 1);
436 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_2,_)).Times(kPoolSize); 438 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_2,_)).Times(kPoolSize);
437 EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_1)) 439 EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_1))
438 .Times(kPoolSize - 1); 440 .Times(kPoolSize - 1);
439 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_1,_)).Times(kPoolSize); 441 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_1,_)).Times(kPoolSize);
440 base::RunLoop().RunUntilIdle(); 442 base::RunLoop().RunUntilIdle();
441 Mock::VerifyAndClearExpectations(client_a_.get()); 443 Mock::VerifyAndClearExpectations(client_a_.get());
442 Mock::VerifyAndClearExpectations(client_b_.get()); 444 Mock::VerifyAndClearExpectations(client_b_.get());
443 445
444 // Now test the interaction of client shutdown and buffer delivery. 446 // Now test the interaction of client shutdown and buffer delivery.
445 // Kill A1 via renderer disconnect (synchronous). 447 // Kill A1 via renderer disconnect (synchronous).
446 controller_->RemoveClient(client_a_route_1, client_a_.get()); 448 controller_->RemoveClient(client_a_route_1, client_a_.get());
447 // Kill B1 via session close (posts a task to disconnect). 449 // Kill B1 via session close (posts a task to disconnect).
448 EXPECT_CALL(*client_b_, DoEnded(client_b_route_1)).Times(1); 450 EXPECT_CALL(*client_b_, DoEnded(client_b_route_1)).Times(1);
449 controller_->StopSession(300); 451 controller_->StopSession(300);
450 // Queue up another buffer. 452 // Queue up another buffer.
451 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer3 = 453 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer3 =
452 device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420, 454 device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
453 capture_resolution); 455 media::PIXEL_STORAGE_CPU);
454 ASSERT_TRUE(buffer3.get()); 456 ASSERT_TRUE(buffer3.get());
455 memset(buffer3->data(), buffer_no++, buffer3->size()); 457 memset(buffer3->data(), buffer_no++, buffer3->size());
456 video_frame = 458 video_frame =
457 WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer3->data())); 459 WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer3->data()));
458 device_->OnIncomingCapturedVideoFrame(buffer3.Pass(), video_frame, 460 device_->OnIncomingCapturedVideoFrame(buffer3.Pass(), video_frame,
459 base::TimeTicks()); 461 base::TimeTicks());
460 462
461 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer4 = 463 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer4 =
462 device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420, 464 device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
463 capture_resolution); 465 media::PIXEL_STORAGE_CPU);
464 { 466 {
465 // Kill A2 via session close (posts a task to disconnect, but A2 must not 467 // Kill A2 via session close (posts a task to disconnect, but A2 must not
466 // be sent either of these two buffers). 468 // be sent either of these two buffers).
467 EXPECT_CALL(*client_a_, DoEnded(client_a_route_2)).Times(1); 469 EXPECT_CALL(*client_a_, DoEnded(client_a_route_2)).Times(1);
468 controller_->StopSession(200); 470 controller_->StopSession(200);
469 } 471 }
470 ASSERT_TRUE(buffer4.get()); 472 ASSERT_TRUE(buffer4.get());
471 memset(buffer4->data(), buffer_no++, buffer4->size()); 473 memset(buffer4->data(), buffer_no++, buffer4->size());
472 video_frame = 474 video_frame =
473 WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer4->data())); 475 WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer4->data()));
(...skipping 14 matching lines...) Expand all
488 int mailbox_buffers = kPoolSize / 2; 490 int mailbox_buffers = kPoolSize / 2;
489 #endif 491 #endif
490 int shm_buffers = kPoolSize - mailbox_buffers; 492 int shm_buffers = kPoolSize - mailbox_buffers;
491 if (shm_buffers == mailbox_buffers) { 493 if (shm_buffers == mailbox_buffers) {
492 shm_buffers--; 494 shm_buffers--;
493 mailbox_buffers++; 495 mailbox_buffers++;
494 } 496 }
495 497
496 for (int i = 0; i < shm_buffers; ++i) { 498 for (int i = 0; i < shm_buffers; ++i) {
497 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer = 499 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer =
498 device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420, 500 device_->ReserveOutputBuffer(capture_resolution,
499 capture_resolution); 501 media::PIXEL_FORMAT_I420,
502 media::PIXEL_STORAGE_CPU);
500 ASSERT_TRUE(buffer.get()); 503 ASSERT_TRUE(buffer.get());
501 video_frame = 504 video_frame =
502 WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data())); 505 WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data()));
503 device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame, 506 device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame,
504 base::TimeTicks()); 507 base::TimeTicks());
505 } 508 }
506 std::vector<uint32> mailbox_syncpoints(mailbox_buffers); 509 std::vector<uint32> mailbox_syncpoints(mailbox_buffers);
507 std::vector<uint32> release_syncpoints(mailbox_buffers); 510 std::vector<uint32> release_syncpoints(mailbox_buffers);
508 for (int i = 0; i < mailbox_buffers; ++i) { 511 for (int i = 0; i < mailbox_buffers; ++i) {
509 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer = 512 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer =
510 device_->ReserveOutputBuffer(media::PIXEL_FORMAT_TEXTURE, 513 device_->ReserveOutputBuffer(capture_resolution,
511 capture_resolution); 514 media::PIXEL_FORMAT_ARGB,
515 media::PIXEL_STORAGE_TEXTURE);
512 ASSERT_TRUE(buffer.get()); 516 ASSERT_TRUE(buffer.get());
513 #if !defined(OS_ANDROID) 517 #if !defined(OS_ANDROID)
514 mailbox_syncpoints[i] = 518 mailbox_syncpoints[i] =
515 ImageTransportFactory::GetInstance()->GetGLHelper()->InsertSyncPoint(); 519 ImageTransportFactory::GetInstance()->GetGLHelper()->InsertSyncPoint();
516 #endif 520 #endif
517 device_->OnIncomingCapturedVideoFrame( 521 device_->OnIncomingCapturedVideoFrame(
518 buffer.Pass(), 522 buffer.Pass(),
519 WrapMailboxBuffer(gpu::MailboxHolder(gpu::Mailbox::Generate(), 0, 523 WrapMailboxBuffer(gpu::MailboxHolder(gpu::Mailbox::Generate(), 0,
520 mailbox_syncpoints[i]), 524 mailbox_syncpoints[i]),
521 base::Bind(&CacheSyncPoint, &release_syncpoints[i]), 525 base::Bind(&CacheSyncPoint, &release_syncpoints[i]),
522 capture_resolution), 526 capture_resolution),
523 base::TimeTicks()); 527 base::TimeTicks());
524 } 528 }
525 // ReserveOutputBuffers ought to fail now regardless of buffer format, because 529 // ReserveOutputBuffers ought to fail now regardless of buffer format, because
526 // the pool is depleted. 530 // the pool is depleted.
527 ASSERT_FALSE(device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420, 531 ASSERT_FALSE(device_->ReserveOutputBuffer(capture_resolution,
528 capture_resolution).get()); 532 media::PIXEL_FORMAT_I420,
529 ASSERT_FALSE(device_->ReserveOutputBuffer(media::PIXEL_FORMAT_TEXTURE, 533 media::PIXEL_STORAGE_CPU).get());
530 capture_resolution).get()); 534 ASSERT_FALSE(device_->ReserveOutputBuffer(capture_resolution,
535 media::PIXEL_FORMAT_ARGB,
536 media::PIXEL_STORAGE_TEXTURE)
537 .get());
531 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2,_)).Times(shm_buffers); 538 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2,_)).Times(shm_buffers);
532 EXPECT_CALL(*client_b_, DoMailboxBufferReady(client_b_route_2)) 539 EXPECT_CALL(*client_b_, DoMailboxBufferReady(client_b_route_2))
533 .Times(mailbox_buffers); 540 .Times(mailbox_buffers);
534 #if !defined(OS_ANDROID) 541 #if !defined(OS_ANDROID)
535 EXPECT_CALL(*client_b_, DoBufferDestroyed(client_b_route_2)); 542 EXPECT_CALL(*client_b_, DoBufferDestroyed(client_b_route_2));
536 #endif 543 #endif
537 base::RunLoop().RunUntilIdle(); 544 base::RunLoop().RunUntilIdle();
538 for (size_t i = 0; i < mailbox_syncpoints.size(); ++i) { 545 for (size_t i = 0; i < mailbox_syncpoints.size(); ++i) {
539 // A new release sync point must be inserted when the video frame is 546 // A new release sync point must be inserted when the video frame is
540 // returned to the Browser process. 547 // returned to the Browser process.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 579
573 // Second client connects after the error state. It also should get told of 580 // Second client connects after the error state. It also should get told of
574 // the error. 581 // the error.
575 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); 582 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1);
576 controller_->AddClient( 583 controller_->AddClient(
577 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); 584 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200);
578 base::RunLoop().RunUntilIdle(); 585 base::RunLoop().RunUntilIdle();
579 Mock::VerifyAndClearExpectations(client_b_.get()); 586 Mock::VerifyAndClearExpectations(client_b_.get());
580 587
581 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer( 588 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer(
582 device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420, 589 device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
583 capture_resolution)); 590 media::PIXEL_STORAGE_CPU));
584 ASSERT_TRUE(buffer.get()); 591 ASSERT_TRUE(buffer.get());
585 scoped_refptr<media::VideoFrame> video_frame = 592 scoped_refptr<media::VideoFrame> video_frame =
586 WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data())); 593 WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data()));
587 device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame, 594 device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame,
588 base::TimeTicks()); 595 base::TimeTicks());
589 596
590 base::RunLoop().RunUntilIdle(); 597 base::RunLoop().RunUntilIdle();
591 } 598 }
592 599
593 // Exercises the OnError() codepath of VideoCaptureController, and tests the 600 // Exercises the OnError() codepath of VideoCaptureController, and tests the
(...skipping 14 matching lines...) Expand all
608 gfx::Size(10, 10), 25, media::PIXEL_FORMAT_ARGB); 615 gfx::Size(10, 10), 25, media::PIXEL_FORMAT_ARGB);
609 616
610 // Start the device. Then, before the first buffer, signal an error and 617 // Start the device. Then, before the first buffer, signal an error and
611 // deliver the buffer. The error should be propagated to clients; the buffer 618 // deliver the buffer. The error should be propagated to clients; the buffer
612 // should not be. 619 // should not be.
613 base::RunLoop().RunUntilIdle(); 620 base::RunLoop().RunUntilIdle();
614 Mock::VerifyAndClearExpectations(client_a_.get()); 621 Mock::VerifyAndClearExpectations(client_a_.get());
615 622
616 const gfx::Size dims(320, 240); 623 const gfx::Size dims(320, 240);
617 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer( 624 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer(
618 device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420, dims)); 625 device_->ReserveOutputBuffer(dims, media::PIXEL_FORMAT_I420,
626 media::PIXEL_STORAGE_CPU));
619 ASSERT_TRUE(buffer.get()); 627 ASSERT_TRUE(buffer.get());
620 628
621 scoped_refptr<media::VideoFrame> video_frame = 629 scoped_refptr<media::VideoFrame> video_frame =
622 WrapI420Buffer(dims, static_cast<uint8*>(buffer->data())); 630 WrapI420Buffer(dims, static_cast<uint8*>(buffer->data()));
623 device_->OnError("Test Error"); 631 device_->OnError("Test Error");
624 device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame, 632 device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame,
625 base::TimeTicks()); 633 base::TimeTicks());
626 634
627 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1); 635 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1);
628 base::RunLoop().RunUntilIdle(); 636 base::RunLoop().RunUntilIdle();
(...skipping 15 matching lines...) Expand all
644 // buffer. 652 // buffer.
645 const size_t kScratchpadSizeInBytes = 400; 653 const size_t kScratchpadSizeInBytes = 400;
646 unsigned char data[kScratchpadSizeInBytes]; 654 unsigned char data[kScratchpadSizeInBytes];
647 // Initialize memory to satisfy DrMemory tests. 655 // Initialize memory to satisfy DrMemory tests.
648 memset(data, 0, kScratchpadSizeInBytes); 656 memset(data, 0, kScratchpadSizeInBytes);
649 const gfx::Size capture_resolution(10, 10); 657 const gfx::Size capture_resolution(10, 10);
650 ASSERT_GE(kScratchpadSizeInBytes, capture_resolution.GetArea() * 4u) 658 ASSERT_GE(kScratchpadSizeInBytes, capture_resolution.GetArea() * 4u)
651 << "Scratchpad is too small to hold the largest pixel format (ARGB)."; 659 << "Scratchpad is too small to hold the largest pixel format (ARGB).";
652 660
653 const int kSessionId = 100; 661 const int kSessionId = 100;
654 // This Test skips PIXEL_FORMAT_TEXTURE and PIXEL_FORMAT_UNKNOWN. 662 // This Test skips PIXEL_FORMAT_UNKNOWN.
655 for (int format = 0; format < media::PIXEL_FORMAT_TEXTURE; ++format) { 663 for (int format = 0; format < media::PIXEL_FORMAT_UNKNOWN; ++format) {
hubbe 2015/06/18 19:23:11 Seems brittle. How about iterate to media::PIXEL_F
mcasas 2015/06/19 02:58:35 Done.
656 media::VideoCaptureParams params; 664 media::VideoCaptureParams params;
657 params.requested_format = media::VideoCaptureFormat( 665 params.requested_format = media::VideoCaptureFormat(
658 capture_resolution, 30, media::VideoPixelFormat(format)); 666 capture_resolution, 30, media::VideoPixelFormat(format));
659 667
660 // Start with one client. 668 // Start with one client.
661 const VideoCaptureControllerID route_id(0x99); 669 const VideoCaptureControllerID route_id(0x99);
662 controller_->AddClient(route_id, 670 controller_->AddClient(route_id,
663 client_a_.get(), 671 client_a_.get(),
664 base::kNullProcessHandle, 672 base::kNullProcessHandle,
665 kSessionId, 673 kSessionId,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 EXPECT_EQ(coded_size.width(), size_and_rotation.output_resolution.width()); 740 EXPECT_EQ(coded_size.width(), size_and_rotation.output_resolution.width());
733 EXPECT_EQ(coded_size.height(), 741 EXPECT_EQ(coded_size.height(),
734 size_and_rotation.output_resolution.height()); 742 size_and_rotation.output_resolution.height());
735 743
736 EXPECT_EQ(kSessionId, controller_->RemoveClient(route_id, client_a_.get())); 744 EXPECT_EQ(kSessionId, controller_->RemoveClient(route_id, client_a_.get()));
737 Mock::VerifyAndClearExpectations(client_a_.get()); 745 Mock::VerifyAndClearExpectations(client_a_.get());
738 } 746 }
739 } 747 }
740 748
741 } // namespace content 749 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698