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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
625 Mock::VerifyAndClearExpectations(client_a_.get()); | 625 Mock::VerifyAndClearExpectations(client_a_.get()); |
626 | 626 |
627 // Second client connects after the error state. It also should get told of | 627 // Second client connects after the error state. It also should get told of |
628 // the error. | 628 // the error. |
629 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); | 629 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); |
630 controller_->AddClient( | 630 controller_->AddClient( |
631 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); | 631 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); |
632 Mock::VerifyAndClearExpectations(client_b_.get()); | 632 Mock::VerifyAndClearExpectations(client_b_.get()); |
633 } | 633 } |
634 | 634 |
635 TEST_F(VideoCaptureControllerTest, DataCaptureInEachVideoFormatInSequence) { | |
636 // This Test will skip PIXEL_FORMAT_TEXTURE and PIXEL_FORMAT_UNKNOWN | |
637 for (int format = 0; format < media::PIXEL_FORMAT_TEXTURE; ++format) { | |
638 media::VideoCaptureParams params; | |
639 params.requested_format = media::VideoCaptureFormat( | |
640 gfx::Size(320, 240), 30, media::VideoPixelFormat(format)); | |
641 | |
642 const gfx::Size capture_resolution(320, 240); | |
643 | |
644 const VideoCaptureControllerID route(0x99); | |
645 | |
646 // Start with one client. | |
647 controller_->AddClient(route, | |
648 client_a_.get(), | |
649 base::kNullProcessHandle, | |
650 100, | |
651 params); | |
652 ASSERT_EQ(1, controller_->GetClientCount()); | |
653 | |
654 // Now, simulate an incoming captured buffer from the capture device. | |
655 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer; | |
656 buffer = | |
657 device_->ReserveOutputBuffer(media::VideoFrame::I420, | |
658 capture_resolution); | |
659 ASSERT_TRUE(buffer.get()); | |
660 | |
661 // Captured a new video frame. | |
662 device_->OnIncomingCapturedData( | |
663 static_cast<unsigned char*>(buffer.get()->data()), | |
zhaoze.zhou
2014/12/05 17:05:11
on the OnIncomingCapturedData(), there's no mechan
| |
664 buffer.get()->size(), | |
665 params.requested_format, | |
666 0, | |
667 base::TimeTicks()); | |
668 | |
669 base::RunLoop().RunUntilIdle(); | |
670 Mock::VerifyAndClearExpectations(client_a_.get()); | |
671 } | |
672 } | |
673 | |
635 } // namespace content | 674 } // namespace content |
OLD | NEW |