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

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

Issue 532833003: content/ fixups for scoped_refptr operator T* removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error Created 6 years, 3 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 buffer, 405 buffer,
406 media::VideoCaptureFormat(capture_resolution, 406 media::VideoCaptureFormat(capture_resolution,
407 device_format.frame_rate, 407 device_format.frame_rate,
408 media::PIXEL_FORMAT_I420), 408 media::PIXEL_FORMAT_I420),
409 WrapI420Buffer(buffer, capture_resolution), 409 WrapI420Buffer(buffer, capture_resolution),
410 base::TimeTicks()); 410 base::TimeTicks());
411 buffer = NULL; 411 buffer = NULL;
412 } 412 }
413 // ReserveOutputBuffer ought to fail now, because the pool is depleted. 413 // ReserveOutputBuffer ought to fail now, because the pool is depleted.
414 ASSERT_FALSE(device_->ReserveOutputBuffer(media::VideoFrame::I420, 414 ASSERT_FALSE(device_->ReserveOutputBuffer(media::VideoFrame::I420,
415 capture_resolution)); 415 capture_resolution).get());
416 416
417 // The new client needs to be told of 3 buffers; the old clients only 2. 417 // The new client needs to be told of 3 buffers; the old clients only 2.
418 EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_2)).Times(kPoolSize); 418 EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_2)).Times(kPoolSize);
419 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2)).Times(kPoolSize); 419 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2)).Times(kPoolSize);
420 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_1)) 420 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_1))
421 .Times(kPoolSize - 1); 421 .Times(kPoolSize - 1);
422 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_1)).Times(kPoolSize); 422 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_1)).Times(kPoolSize);
423 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_2)) 423 EXPECT_CALL(*client_a_, DoBufferCreated(client_a_route_2))
424 .Times(kPoolSize - 1); 424 .Times(kPoolSize - 1);
425 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_2)).Times(kPoolSize); 425 EXPECT_CALL(*client_a_, DoBufferReady(client_a_route_2)).Times(kPoolSize);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 make_scoped_ptr(new gpu::MailboxHolder( 518 make_scoped_ptr(new gpu::MailboxHolder(
519 gpu::Mailbox(), 0, mailbox_syncpoints[i])), 519 gpu::Mailbox(), 0, mailbox_syncpoints[i])),
520 base::Bind(&CacheSyncPoint, &release_syncpoints[i]), 520 base::Bind(&CacheSyncPoint, &release_syncpoints[i]),
521 capture_resolution), 521 capture_resolution),
522 base::TimeTicks()); 522 base::TimeTicks());
523 buffer = NULL; 523 buffer = NULL;
524 } 524 }
525 // ReserveOutputBuffers ought to fail now regardless of buffer format, because 525 // ReserveOutputBuffers ought to fail now regardless of buffer format, because
526 // the pool is depleted. 526 // the pool is depleted.
527 ASSERT_FALSE(device_->ReserveOutputBuffer(media::VideoFrame::I420, 527 ASSERT_FALSE(device_->ReserveOutputBuffer(media::VideoFrame::I420,
528 capture_resolution)); 528 capture_resolution).get());
529 ASSERT_FALSE(device_->ReserveOutputBuffer(media::VideoFrame::NATIVE_TEXTURE, 529 ASSERT_FALSE(device_->ReserveOutputBuffer(media::VideoFrame::NATIVE_TEXTURE,
530 gfx::Size(0, 0))); 530 gfx::Size(0, 0)).get());
531 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2)).Times(shm_buffers); 531 EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2)).Times(shm_buffers);
532 EXPECT_CALL(*client_b_, DoMailboxBufferReady(client_b_route_2)) 532 EXPECT_CALL(*client_b_, DoMailboxBufferReady(client_b_route_2))
533 .Times(mailbox_buffers); 533 .Times(mailbox_buffers);
534 base::RunLoop().RunUntilIdle(); 534 base::RunLoop().RunUntilIdle();
535 for (size_t i = 0; i < mailbox_syncpoints.size(); ++i) { 535 for (size_t i = 0; i < mailbox_syncpoints.size(); ++i) {
536 // A new release sync point must be inserted when the video frame is 536 // A new release sync point must be inserted when the video frame is
537 // returned to the Browser process. 537 // returned to the Browser process.
538 // See: MockVideoCaptureControllerEventHandler::OnMailboxBufferReady() and 538 // See: MockVideoCaptureControllerEventHandler::OnMailboxBufferReady() and
539 // VideoCaptureController::ReturnBuffer() 539 // VideoCaptureController::ReturnBuffer()
540 ASSERT_NE(mailbox_syncpoints[i], release_syncpoints[i]); 540 ASSERT_NE(mailbox_syncpoints[i], release_syncpoints[i]);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 635
636 // Second client connects after the error state. It also should get told of 636 // Second client connects after the error state. It also should get told of
637 // the error. 637 // the error.
638 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); 638 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1);
639 controller_->AddClient( 639 controller_->AddClient(
640 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); 640 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200);
641 Mock::VerifyAndClearExpectations(client_b_.get()); 641 Mock::VerifyAndClearExpectations(client_b_.get());
642 } 642 }
643 643
644 } // namespace content 644 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_factory_impl.cc ('k') | content/browser/utility_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698