| 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 "media/capture/video/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 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" | |
| 19 #include "content/browser/renderer_host/media/video_capture_controller.h" | 18 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 20 #include "content/public/test/test_browser_thread_bundle.h" | 19 #include "content/public/test/test_browser_thread_bundle.h" |
| 21 #include "media/base/limits.h" | 20 #include "media/base/limits.h" |
| 21 #include "media/capture/video/video_capture_buffer_pool.h" |
| 22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 24 |
| 25 using ::testing::_; | 25 using ::testing::_; |
| 26 using ::testing::Mock; | 26 using ::testing::Mock; |
| 27 using ::testing::InSequence; | 27 using ::testing::InSequence; |
| 28 using ::testing::SaveArg; | 28 using ::testing::SaveArg; |
| 29 | 29 |
| 30 namespace content { | 30 namespace content { |
| 31 | 31 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 42 MOCK_METHOD1(OnLog, void(const std::string& message)); | 42 MOCK_METHOD1(OnLog, void(const std::string& message)); |
| 43 MOCK_METHOD1(OnBufferDestroyed, void(int buffer_id_to_drop)); | 43 MOCK_METHOD1(OnBufferDestroyed, void(int buffer_id_to_drop)); |
| 44 | 44 |
| 45 void OnIncomingCapturedVideoFrame( | 45 void OnIncomingCapturedVideoFrame( |
| 46 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer, | 46 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer, |
| 47 const scoped_refptr<media::VideoFrame>& frame) override { | 47 const scoped_refptr<media::VideoFrame>& frame) override { |
| 48 MockOnIncomingCapturedVideoFrame(frame->coded_size()); | 48 MockOnIncomingCapturedVideoFrame(frame->coded_size()); |
| 49 } | 49 } |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // Note that this test does not exercise the class VideoCaptureDeviceClient |
| 53 // in isolation. The "unit under test" is an instance of |
| 54 // VideoCaptureDeviceClient with some context that is specific to |
| 55 // renderer_host/media, and therefore this test must live here and not in |
| 56 // media/capture/video. |
| 52 class VideoCaptureDeviceClientTest : public ::testing::Test { | 57 class VideoCaptureDeviceClientTest : public ::testing::Test { |
| 53 public: | 58 public: |
| 54 VideoCaptureDeviceClientTest() | 59 VideoCaptureDeviceClientTest() |
| 55 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 60 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
| 56 controller_(new MockVideoCaptureController(1)), | 61 controller_(new MockVideoCaptureController(1)), |
| 57 device_client_(controller_->NewDeviceClient()) {} | 62 device_client_(controller_->NewDeviceClient()) {} |
| 58 ~VideoCaptureDeviceClientTest() override {} | 63 ~VideoCaptureDeviceClientTest() override {} |
| 59 | 64 |
| 60 void TearDown() override { base::RunLoop().RunUntilIdle(); } | 65 void TearDown() override { base::RunLoop().RunUntilIdle(); } |
| 61 | 66 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 229 |
| 225 EXPECT_EQ(coded_size.width(), size_and_rotation.output_resolution.width()); | 230 EXPECT_EQ(coded_size.width(), size_and_rotation.output_resolution.width()); |
| 226 EXPECT_EQ(coded_size.height(), | 231 EXPECT_EQ(coded_size.height(), |
| 227 size_and_rotation.output_resolution.height()); | 232 size_and_rotation.output_resolution.height()); |
| 228 | 233 |
| 229 Mock::VerifyAndClearExpectations(controller_.get()); | 234 Mock::VerifyAndClearExpectations(controller_.get()); |
| 230 } | 235 } |
| 231 } | 236 } |
| 232 | 237 |
| 233 } // namespace content | 238 } // namespace content |
| OLD | NEW |