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

Side by Side Diff: content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h

Issue 1729683002: Remove old-style constraints from Chrome internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Complete the interface change Created 4 years, 9 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_WEBRTC_MOCK_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_MOCK_PEER_CONNECTION_DEPENDENCY_FACTORY_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_MOCK_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_MOCK_PEER_CONNECTION_DEPENDENCY_FACTORY_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 17 matching lines...) Expand all
28 bool RenderFrame(const cricket::VideoFrame* frame) override; 28 bool RenderFrame(const cricket::VideoFrame* frame) override;
29 29
30 int num() const { return num_; } 30 int num() const { return num_; }
31 31
32 private: 32 private:
33 int num_; 33 int num_;
34 }; 34 };
35 35
36 class MockAudioSource : public webrtc::AudioSourceInterface { 36 class MockAudioSource : public webrtc::AudioSourceInterface {
37 public: 37 public:
38 explicit MockAudioSource( 38 explicit MockAudioSource(const cricket::AudioOptions& options, bool remote);
39 const webrtc::MediaConstraintsInterface* constraints, bool remote);
40 39
41 void RegisterObserver(webrtc::ObserverInterface* observer) override; 40 void RegisterObserver(webrtc::ObserverInterface* observer) override;
42 void UnregisterObserver(webrtc::ObserverInterface* observer) override; 41 void UnregisterObserver(webrtc::ObserverInterface* observer) override;
43 MediaSourceInterface::SourceState state() const override; 42 MediaSourceInterface::SourceState state() const override;
44 bool remote() const override; 43 bool remote() const override;
45 44
46 // Changes the state of the source to live and notifies the observer. 45 // Changes the state of the source to live and notifies the observer.
47 void SetLive(); 46 void SetLive();
48 // Changes the state of the source to ended and notifies the observer. 47 // Changes the state of the source to ended and notifies the observer.
49 void SetEnded(); 48 void SetEnded();
50 49
51 const webrtc::MediaConstraintsInterface::Constraints& optional_constraints() {
52 return optional_constraints_;
53 }
54
55 const webrtc::MediaConstraintsInterface::Constraints&
56 mandatory_constraints() {
57 return mandatory_constraints_;
58 }
59
60 protected: 50 protected:
61 ~MockAudioSource() override; 51 ~MockAudioSource() override;
62 52
63 private: 53 private:
64 bool remote_; 54 bool remote_;
65 ObserverSet observers_; 55 ObserverSet observers_;
66 MediaSourceInterface::SourceState state_; 56 MediaSourceInterface::SourceState state_;
67 webrtc::MediaConstraintsInterface::Constraints optional_constraints_;
68 webrtc::MediaConstraintsInterface::Constraints mandatory_constraints_;
69 }; 57 };
70 58
71 class MockWebRtcVideoTrack : public webrtc::VideoTrackInterface { 59 class MockWebRtcVideoTrack : public webrtc::VideoTrackInterface {
72 public: 60 public:
73 MockWebRtcVideoTrack(const std::string& id, 61 MockWebRtcVideoTrack(const std::string& id,
74 webrtc::VideoTrackSourceInterface* source); 62 webrtc::VideoTrackSourceInterface* source);
75 void AddRenderer(webrtc::VideoRendererInterface* renderer) override; 63 void AddRenderer(webrtc::VideoRendererInterface* renderer) override;
76 void RemoveRenderer(webrtc::VideoRendererInterface* renderer) override; 64 void RemoveRenderer(webrtc::VideoRendererInterface* renderer) override;
77 std::string kind() const override; 65 std::string kind() const override;
78 std::string id() const override; 66 std::string id() const override;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // A mock factory for creating different objects for 118 // A mock factory for creating different objects for
131 // RTC PeerConnections. 119 // RTC PeerConnections.
132 class MockPeerConnectionDependencyFactory 120 class MockPeerConnectionDependencyFactory
133 : public PeerConnectionDependencyFactory { 121 : public PeerConnectionDependencyFactory {
134 public: 122 public:
135 MockPeerConnectionDependencyFactory(); 123 MockPeerConnectionDependencyFactory();
136 ~MockPeerConnectionDependencyFactory() override; 124 ~MockPeerConnectionDependencyFactory() override;
137 125
138 scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection( 126 scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection(
139 const webrtc::PeerConnectionInterface::RTCConfiguration& config, 127 const webrtc::PeerConnectionInterface::RTCConfiguration& config,
140 const webrtc::MediaConstraintsInterface* constraints,
141 blink::WebFrame* frame, 128 blink::WebFrame* frame,
142 webrtc::PeerConnectionObserver* observer) override; 129 webrtc::PeerConnectionObserver* observer) override;
143 scoped_refptr<webrtc::AudioSourceInterface> CreateLocalAudioSource( 130 scoped_refptr<webrtc::AudioSourceInterface> CreateLocalAudioSource(
144 const webrtc::MediaConstraintsInterface* constraints) override; 131 const cricket::AudioOptions& options) override;
145 WebRtcVideoCapturerAdapter* CreateVideoCapturer( 132 WebRtcVideoCapturerAdapter* CreateVideoCapturer(
146 bool is_screen_capture) override; 133 bool is_screen_capture) override;
147 scoped_refptr<webrtc::VideoTrackSourceInterface> CreateVideoSource( 134 scoped_refptr<webrtc::VideoTrackSourceInterface> CreateVideoSource(
148 cricket::VideoCapturer* capturer, 135 cricket::VideoCapturer* capturer) override;
149 const blink::WebMediaConstraints& constraints) override;
150 void CreateWebAudioSource(blink::WebMediaStreamSource* source) override; 136 void CreateWebAudioSource(blink::WebMediaStreamSource* source) override;
151 scoped_refptr<webrtc::MediaStreamInterface> CreateLocalMediaStream( 137 scoped_refptr<webrtc::MediaStreamInterface> CreateLocalMediaStream(
152 const std::string& label) override; 138 const std::string& label) override;
153 scoped_refptr<webrtc::VideoTrackInterface> CreateLocalVideoTrack( 139 scoped_refptr<webrtc::VideoTrackInterface> CreateLocalVideoTrack(
154 const std::string& id, 140 const std::string& id,
155 webrtc::VideoTrackSourceInterface* source) override; 141 webrtc::VideoTrackSourceInterface* source) override;
156 scoped_refptr<webrtc::VideoTrackInterface> CreateLocalVideoTrack( 142 scoped_refptr<webrtc::VideoTrackInterface> CreateLocalVideoTrack(
157 const std::string& id, 143 const std::string& id,
158 cricket::VideoCapturer* capturer) override; 144 cricket::VideoCapturer* capturer) override;
159 webrtc::SessionDescriptionInterface* CreateSessionDescription( 145 webrtc::SessionDescriptionInterface* CreateSessionDescription(
(...skipping 19 matching lines...) Expand all
179 private: 165 private:
180 bool fail_to_create_next_audio_capturer_; 166 bool fail_to_create_next_audio_capturer_;
181 scoped_refptr <MockAudioSource> last_audio_source_; 167 scoped_refptr <MockAudioSource> last_audio_source_;
182 168
183 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionDependencyFactory); 169 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionDependencyFactory);
184 }; 170 };
185 171
186 } // namespace content 172 } // namespace content
187 173
188 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_MOCK_PEER_CONNECTION_DEPENDENCY_FACTORY _H_ 174 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_MOCK_PEER_CONNECTION_DEPENDENCY_FACTORY _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698