OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ |
6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ | 6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ |
7 | 7 |
8 #include "content/renderer/media/media_stream_video_source.h" | 8 #include "content/renderer/media/media_stream_video_source.h" |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 class MockMediaStreamVideoSource : public MediaStreamVideoSource { | 15 class MockMediaStreamVideoSource : public MediaStreamVideoSource { |
16 public: | 16 public: |
17 explicit MockMediaStreamVideoSource(bool manual_get_supported_formats); | 17 explicit MockMediaStreamVideoSource(bool manual_get_supported_formats); |
18 MockMediaStreamVideoSource(bool manual_get_supported_formats, | 18 MockMediaStreamVideoSource(bool manual_get_supported_formats, |
19 bool respond_to_request_refresh_frame); | 19 bool respond_to_request_refresh_frame); |
| 20 MockMediaStreamVideoSource(const media::VideoCaptureFormat& format, |
| 21 bool respond_to_request_refresh_frame); |
20 virtual ~MockMediaStreamVideoSource(); | 22 virtual ~MockMediaStreamVideoSource(); |
21 | 23 |
22 MOCK_METHOD1(DoSetMutedState, void(bool muted_state)); | 24 MOCK_METHOD1(DoSetMutedState, void(bool muted_state)); |
23 | 25 |
24 // Simulate that the underlying source start successfully. | 26 // Simulate that the underlying source start successfully. |
25 void StartMockedSource(); | 27 void StartMockedSource(); |
26 | 28 |
27 // Simulate that the underlying source fail to start. | 29 // Simulate that the underlying source fail to start. |
28 void FailToStartMockedSource(); | 30 void FailToStartMockedSource(); |
29 | 31 |
(...skipping 30 matching lines...) Expand all Loading... |
60 void GetCurrentSupportedFormats( | 62 void GetCurrentSupportedFormats( |
61 int max_requested_height, | 63 int max_requested_height, |
62 int max_requested_width, | 64 int max_requested_width, |
63 double max_requested_frame_rate, | 65 double max_requested_frame_rate, |
64 const VideoCaptureDeviceFormatsCB& callback) override; | 66 const VideoCaptureDeviceFormatsCB& callback) override; |
65 void StartSourceImpl( | 67 void StartSourceImpl( |
66 const media::VideoCaptureFormat& format, | 68 const media::VideoCaptureFormat& format, |
67 const blink::WebMediaConstraints& constraints, | 69 const blink::WebMediaConstraints& constraints, |
68 const VideoCaptureDeliverFrameCB& frame_callback) override; | 70 const VideoCaptureDeliverFrameCB& frame_callback) override; |
69 void StopSourceImpl() override; | 71 void StopSourceImpl() override; |
| 72 base::Optional<media::VideoCaptureFormat> GetCurrentFormatImpl() |
| 73 const override; |
70 | 74 |
71 private: | 75 private: |
72 media::VideoCaptureFormat format_; | 76 media::VideoCaptureFormat format_; |
73 media::VideoCaptureFormats supported_formats_; | 77 media::VideoCaptureFormats supported_formats_; |
74 bool manual_get_supported_formats_; | 78 bool manual_get_supported_formats_; |
75 bool respond_to_request_refresh_frame_; | 79 bool respond_to_request_refresh_frame_; |
76 int max_requested_height_; | 80 int max_requested_height_; |
77 int max_requested_width_; | 81 int max_requested_width_; |
78 double max_requested_frame_rate_; | 82 double max_requested_frame_rate_; |
79 bool attempted_to_start_; | 83 bool attempted_to_start_; |
80 VideoCaptureDeviceFormatsCB formats_callback_; | 84 VideoCaptureDeviceFormatsCB formats_callback_; |
81 VideoCaptureDeliverFrameCB frame_callback_; | 85 VideoCaptureDeliverFrameCB frame_callback_; |
82 | 86 |
83 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamVideoSource); | 87 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamVideoSource); |
84 }; | 88 }; |
85 | 89 |
86 } // namespace content | 90 } // namespace content |
87 | 91 |
88 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ | 92 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ |
OLD | NEW |