| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "content/browser/renderer_host/media/video_capture_device_client.h" | 5 #include "content/browser/renderer_host/media/video_capture_device_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 : VideoCaptureController(max_buffers) {} | 37 : VideoCaptureController(max_buffers) {} |
| 38 ~MockVideoCaptureController() override {} | 38 ~MockVideoCaptureController() override {} |
| 39 | 39 |
| 40 MOCK_METHOD1(MockDoIncomingCapturedVideoFrameOnIOThread, | 40 MOCK_METHOD1(MockDoIncomingCapturedVideoFrameOnIOThread, |
| 41 void(const gfx::Size&)); | 41 void(const gfx::Size&)); |
| 42 MOCK_METHOD0(DoErrorOnIOThread, void()); | 42 MOCK_METHOD0(DoErrorOnIOThread, void()); |
| 43 MOCK_METHOD1(DoLogOnIOThread, void(const std::string& message)); | 43 MOCK_METHOD1(DoLogOnIOThread, void(const std::string& message)); |
| 44 MOCK_METHOD1(DoBufferDestroyedOnIOThread, void(int buffer_id_to_drop)); | 44 MOCK_METHOD1(DoBufferDestroyedOnIOThread, void(int buffer_id_to_drop)); |
| 45 | 45 |
| 46 void DoIncomingCapturedVideoFrameOnIOThread( | 46 void DoIncomingCapturedVideoFrameOnIOThread( |
| 47 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer, | 47 std::unique_ptr<device::VideoCaptureDevice::Client::Buffer> buffer, |
| 48 const scoped_refptr<media::VideoFrame>& frame) override { | 48 const scoped_refptr<media::VideoFrame>& frame) override { |
| 49 MockDoIncomingCapturedVideoFrameOnIOThread(frame->coded_size()); | 49 MockDoIncomingCapturedVideoFrameOnIOThread(frame->coded_size()); |
| 50 } | 50 } |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 class VideoCaptureDeviceClientTest : public ::testing::Test { | 53 class VideoCaptureDeviceClientTest : public ::testing::Test { |
| 54 public: | 54 public: |
| 55 VideoCaptureDeviceClientTest() | 55 VideoCaptureDeviceClientTest() |
| 56 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 56 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
| 57 controller_(new MockVideoCaptureController(1)), | 57 controller_(new MockVideoCaptureController(1)), |
| 58 device_client_(controller_->NewDeviceClient()) {} | 58 device_client_(controller_->NewDeviceClient()) {} |
| 59 ~VideoCaptureDeviceClientTest() override {} | 59 ~VideoCaptureDeviceClientTest() override {} |
| 60 | 60 |
| 61 void TearDown() override { base::RunLoop().RunUntilIdle(); } | 61 void TearDown() override { base::RunLoop().RunUntilIdle(); } |
| 62 | 62 |
| 63 protected: | 63 protected: |
| 64 const content::TestBrowserThreadBundle thread_bundle_; | 64 const content::TestBrowserThreadBundle thread_bundle_; |
| 65 const std::unique_ptr<MockVideoCaptureController> controller_; | 65 const std::unique_ptr<MockVideoCaptureController> controller_; |
| 66 const std::unique_ptr<media::VideoCaptureDevice::Client> device_client_; | 66 const std::unique_ptr<device::VideoCaptureDevice::Client> device_client_; |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClientTest); | 69 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClientTest); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace | 72 } // namespace |
| 73 | 73 |
| 74 // A small test for reference and to verify VideoCaptureDeviceClient is | 74 // A small test for reference and to verify VideoCaptureDeviceClient is |
| 75 // minimally functional. | 75 // minimally functional. |
| 76 TEST_F(VideoCaptureDeviceClientTest, Minimal) { | 76 TEST_F(VideoCaptureDeviceClientTest, Minimal) { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 EXPECT_EQ(coded_size.width(), size_and_rotation.output_resolution.width()); | 230 EXPECT_EQ(coded_size.width(), size_and_rotation.output_resolution.width()); |
| 231 EXPECT_EQ(coded_size.height(), | 231 EXPECT_EQ(coded_size.height(), |
| 232 size_and_rotation.output_resolution.height()); | 232 size_and_rotation.output_resolution.height()); |
| 233 | 233 |
| 234 Mock::VerifyAndClearExpectations(controller_.get()); | 234 Mock::VerifyAndClearExpectations(controller_.get()); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace content | 238 } // namespace content |
| OLD | NEW |