Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: content/renderer/media/mock_media_stream_video_source.h

Issue 2972553002: Remove MediaStreamVideoSource::GetCurrentSupportedFormats() (Closed)
Patch Set: remove extra use in media_stream_video_capturer_source_unittest.cc Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 MockMediaStreamVideoSource();
18 MockMediaStreamVideoSource(bool manual_get_supported_formats, 18 explicit MockMediaStreamVideoSource(bool respond_to_request_refresh_frame);
19 bool respond_to_request_refresh_frame);
20 MockMediaStreamVideoSource(const media::VideoCaptureFormat& format, 19 MockMediaStreamVideoSource(const media::VideoCaptureFormat& format,
21 bool respond_to_request_refresh_frame); 20 bool respond_to_request_refresh_frame);
22 virtual ~MockMediaStreamVideoSource(); 21 virtual ~MockMediaStreamVideoSource();
23 22
24 MOCK_METHOD1(DoSetMutedState, void(bool muted_state)); 23 MOCK_METHOD1(DoSetMutedState, void(bool muted_state));
25 24
26 // Simulate that the underlying source start successfully. 25 // Simulate that the underlying source start successfully.
27 void StartMockedSource(); 26 void StartMockedSource();
28 27
29 // Simulate that the underlying source fail to start. 28 // Simulate that the underlying source fail to start.
30 void FailToStartMockedSource(); 29 void FailToStartMockedSource();
31 30
32 // Returns true if StartSource has been called and StartMockedSource 31 // Returns true if StartSource has been called and StartMockedSource
33 // or FailToStartMockedSource has not been called. 32 // or FailToStartMockedSource has not been called.
34 bool SourceHasAttemptedToStart() { return attempted_to_start_; } 33 bool SourceHasAttemptedToStart() { return attempted_to_start_; }
35 34
36 void SetSupportedFormats(const media::VideoCaptureFormats& formats) {
37 supported_formats_ = formats;
38 }
39
40 // Delivers |frame| to all registered tracks on the IO thread. Its up to the 35 // Delivers |frame| to all registered tracks on the IO thread. Its up to the
41 // call to make sure MockMediaStreamVideoSource is not destroyed before the 36 // call to make sure MockMediaStreamVideoSource is not destroyed before the
42 // frame has been delivered. 37 // frame has been delivered.
43 void DeliverVideoFrame(const scoped_refptr<media::VideoFrame>& frame); 38 void DeliverVideoFrame(const scoped_refptr<media::VideoFrame>& frame);
44 39
45 void CompleteGetSupportedFormats(); 40 void CompleteGetSupportedFormats();
46 41
47 const media::VideoCaptureFormat& start_format() const { return format_; } 42 const media::VideoCaptureFormat& start_format() const { return format_; }
48 int max_requested_height() const { return max_requested_height_; } 43 int max_requested_height() const { return max_requested_height_; }
49 int max_requested_width() const { return max_requested_width_; } 44 int max_requested_width() const { return max_requested_width_; }
50 double max_requested_frame_rate() const { return max_requested_frame_rate_; } 45 double max_requested_frame_rate() const { return max_requested_frame_rate_; }
51 46
52 void SetMutedState(bool muted_state) override { 47 void SetMutedState(bool muted_state) override {
53 MediaStreamVideoSource::SetMutedState(muted_state); 48 MediaStreamVideoSource::SetMutedState(muted_state);
54 DoSetMutedState(muted_state); 49 DoSetMutedState(muted_state);
55 } 50 }
56 51
57 // Implements MediaStreamVideoSource. 52 // Implements MediaStreamVideoSource.
58 void RequestRefreshFrame() override; 53 void RequestRefreshFrame() override;
59 54
60 protected: 55 protected:
61 // Implements MediaStreamVideoSource. 56 // Implements MediaStreamVideoSource.
62 void GetCurrentSupportedFormats(
63 int max_requested_height,
64 int max_requested_width,
65 double max_requested_frame_rate,
66 const VideoCaptureDeviceFormatsCB& callback) override;
67 void StartSourceImpl( 57 void StartSourceImpl(
68 const media::VideoCaptureFormat& format, 58 const media::VideoCaptureFormat& format,
69 const blink::WebMediaConstraints& constraints, 59 const blink::WebMediaConstraints& constraints,
70 const VideoCaptureDeliverFrameCB& frame_callback) override; 60 const VideoCaptureDeliverFrameCB& frame_callback) override;
71 void StopSourceImpl() override; 61 void StopSourceImpl() override;
72 base::Optional<media::VideoCaptureFormat> GetCurrentFormatImpl() 62 base::Optional<media::VideoCaptureFormat> GetCurrentFormatImpl()
73 const override; 63 const override;
74 64
75 private: 65 private:
76 media::VideoCaptureFormat format_; 66 media::VideoCaptureFormat format_;
77 media::VideoCaptureFormats supported_formats_;
78 bool manual_get_supported_formats_;
79 bool respond_to_request_refresh_frame_; 67 bool respond_to_request_refresh_frame_;
80 int max_requested_height_; 68 int max_requested_height_;
81 int max_requested_width_; 69 int max_requested_width_;
82 double max_requested_frame_rate_; 70 double max_requested_frame_rate_;
83 bool attempted_to_start_; 71 bool attempted_to_start_;
84 VideoCaptureDeviceFormatsCB formats_callback_;
85 VideoCaptureDeliverFrameCB frame_callback_; 72 VideoCaptureDeliverFrameCB frame_callback_;
86 73
87 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamVideoSource); 74 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamVideoSource);
88 }; 75 };
89 76
90 } // namespace content 77 } // namespace content
91 78
92 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ 79 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_
OLDNEW
« no previous file with comments | « content/renderer/media/mock_media_stream_registry.cc ('k') | content/renderer/media/mock_media_stream_video_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698