Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef SERVICES_VIDEO_CAPTURE_TEST_MOCK_DEVICE_TEST_H_ | 5 #ifndef SERVICES_VIDEO_CAPTURE_TEST_MOCK_DEVICE_TEST_H_ |
| 6 #define SERVICES_VIDEO_CAPTURE_TEST_MOCK_DEVICE_TEST_H_ | 6 #define SERVICES_VIDEO_CAPTURE_TEST_MOCK_DEVICE_TEST_H_ |
| 7 | 7 |
| 8 #include "base/test/mock_callback.h" | 8 #include "base/test/mock_callback.h" |
| 9 #include "media/capture/video/video_capture_device.h" | 9 #include "media/capture/video/video_capture_device.h" |
| 10 #include "services/service_manager/public/cpp/service_context_ref.h" | |
| 10 #include "services/video_capture/device_factory_media_to_mojo_adapter.h" | 11 #include "services/video_capture/device_factory_media_to_mojo_adapter.h" |
| 11 #include "services/video_capture/public/interfaces/service.mojom.h" | 12 #include "services/video_capture/public/interfaces/device_factory_provider.mojom .h" |
| 12 #include "services/video_capture/test/mock_device_factory.h" | 13 #include "services/video_capture/test/mock_device_factory.h" |
| 13 #include "services/video_capture/test/mock_receiver.h" | 14 #include "services/video_capture/test/mock_receiver.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class MessageLoop; | 18 class MessageLoop; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace video_capture { | 21 namespace video_capture { |
| 21 | 22 |
| 22 // To ensure correct operation, this mock device holds on to the |client| | 23 // To ensure correct operation, this mock device holds on to the |client| |
| 23 // that is passed to it in AllocateAndStart() and releases it on | 24 // that is passed to it in AllocateAndStart() and releases it on |
| 24 // StopAndDeAllocate(). | 25 // StopAndDeAllocate(). |
| 25 class MockDevice : public media::VideoCaptureDevice { | 26 class MockDevice : public media::VideoCaptureDevice { |
| 26 public: | 27 public: |
| 27 MockDevice(); | 28 MockDevice(); |
| 28 ~MockDevice() override; | 29 ~MockDevice() override; |
| 29 | 30 |
| 30 void SendStubFrame(const media::VideoCaptureFormat& format, | 31 void SendStubFrame(const media::VideoCaptureFormat& format, |
| 31 int rotation, | 32 int rotation, |
| 32 int frame_id); | 33 int frame_feedback_id); |
| 33 | 34 |
| 34 // media::VideoCaptureDevice: | 35 // media::VideoCaptureDevice implementation. |
| 35 MOCK_METHOD2(DoAllocateAndStart, | 36 MOCK_METHOD2(DoAllocateAndStart, |
| 36 void(const media::VideoCaptureParams& params, | 37 void(const media::VideoCaptureParams& params, |
| 37 std::unique_ptr<Client>* client)); | 38 std::unique_ptr<Client>* client)); |
| 38 MOCK_METHOD0(RequestRefreshFrame, void()); | 39 MOCK_METHOD0(RequestRefreshFrame, void()); |
| 39 MOCK_METHOD0(DoStopAndDeAllocate, void()); | 40 MOCK_METHOD0(DoStopAndDeAllocate, void()); |
| 40 MOCK_METHOD1(DoGetPhotoCapabilities, | 41 MOCK_METHOD1(DoGetPhotoCapabilities, |
| 41 void(GetPhotoCapabilitiesCallback* callback)); | 42 void(GetPhotoCapabilitiesCallback* callback)); |
| 42 MOCK_METHOD2(DoSetPhotoOptions, | 43 MOCK_METHOD2(DoSetPhotoOptions, |
| 43 void(media::mojom::PhotoSettingsPtr* settings, | 44 void(media::mojom::PhotoSettingsPtr* settings, |
| 44 SetPhotoOptionsCallback* callback)); | 45 SetPhotoOptionsCallback* callback)); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 75 base::MockCallback<mojom::DeviceFactory::GetDeviceInfosCallback> | 76 base::MockCallback<mojom::DeviceFactory::GetDeviceInfosCallback> |
| 76 device_infos_receiver_; | 77 device_infos_receiver_; |
| 77 | 78 |
| 78 MockDevice mock_device_; | 79 MockDevice mock_device_; |
| 79 std::unique_ptr<MockReceiver> mock_receiver_; | 80 std::unique_ptr<MockReceiver> mock_receiver_; |
| 80 mojom::DevicePtr device_proxy_; | 81 mojom::DevicePtr device_proxy_; |
| 81 mojom::ReceiverPtr mock_receiver_proxy_; | 82 mojom::ReceiverPtr mock_receiver_proxy_; |
| 82 media::VideoCaptureParams requested_settings_; | 83 media::VideoCaptureParams requested_settings_; |
| 83 | 84 |
| 84 private: | 85 private: |
| 85 std::unique_ptr<base::MessageLoop> message_loop_; | 86 std::unique_ptr<base::MessageLoop> message_loop_; |
|
mcasas
2017/04/27 20:10:02
In subsequent CLs we should remove MessageLoop
in
chfremer
2017/04/27 23:48:14
Acknowledged.
| |
| 87 service_manager::ServiceContextRefFactory ref_factory_; | |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 } // namespace video_capture | 90 } // namespace video_capture |
| 89 | 91 |
| 90 #endif // SERVICES_VIDEO_CAPTURE_TEST_MOCK_DEVICE_TEST_H_ | 92 #endif // SERVICES_VIDEO_CAPTURE_TEST_MOCK_DEVICE_TEST_H_ |
| OLD | NEW |