OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DEPENDENCY_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ |
6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ | 6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 virtual MediaSourceInterface::SourceState state() const OVERRIDE; | 23 virtual MediaSourceInterface::SourceState state() const OVERRIDE; |
24 virtual cricket::VideoCapturer* GetVideoCapturer() OVERRIDE; | 24 virtual cricket::VideoCapturer* GetVideoCapturer() OVERRIDE; |
25 virtual void AddSink(cricket::VideoRenderer* output) OVERRIDE; | 25 virtual void AddSink(cricket::VideoRenderer* output) OVERRIDE; |
26 virtual void RemoveSink(cricket::VideoRenderer* output) OVERRIDE; | 26 virtual void RemoveSink(cricket::VideoRenderer* output) OVERRIDE; |
27 virtual const cricket::VideoOptions* options() const OVERRIDE; | 27 virtual const cricket::VideoOptions* options() const OVERRIDE; |
28 | 28 |
29 // Changes the state of the source to live and notifies the observer. | 29 // Changes the state of the source to live and notifies the observer. |
30 void SetLive(); | 30 void SetLive(); |
31 // Changes the state of the source to ended and notifies the observer. | 31 // Changes the state of the source to ended and notifies the observer. |
32 void SetEnded(); | 32 void SetEnded(); |
| 33 // Set the video capturer. |
| 34 void SetVideoCapturer(cricket::VideoCapturer* capturer); |
33 | 35 |
34 protected: | 36 protected: |
35 virtual ~MockVideoSource(); | 37 virtual ~MockVideoSource(); |
36 | 38 |
37 private: | 39 private: |
38 void FireOnChanged(); | 40 void FireOnChanged(); |
39 | 41 |
40 std::vector<webrtc::ObserverInterface*> observers_; | 42 std::vector<webrtc::ObserverInterface*> observers_; |
41 MediaSourceInterface::SourceState state_; | 43 MediaSourceInterface::SourceState state_; |
| 44 scoped_ptr<cricket::VideoCapturer> capturer_; |
42 }; | 45 }; |
43 | 46 |
44 class MockAudioSource : public webrtc::AudioSourceInterface { | 47 class MockAudioSource : public webrtc::AudioSourceInterface { |
45 public: | 48 public: |
46 explicit MockAudioSource( | 49 explicit MockAudioSource( |
47 const webrtc::MediaConstraintsInterface* constraints); | 50 const webrtc::MediaConstraintsInterface* constraints); |
48 | 51 |
49 virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; | 52 virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; |
50 virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; | 53 virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; |
51 virtual MediaSourceInterface::SourceState state() const OVERRIDE; | 54 virtual MediaSourceInterface::SourceState state() const OVERRIDE; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE; | 156 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE; |
154 virtual bool InitializeAudioSource( | 157 virtual bool InitializeAudioSource( |
155 int render_view_id, const StreamDeviceInfo& device_info) OVERRIDE; | 158 int render_view_id, const StreamDeviceInfo& device_info) OVERRIDE; |
156 virtual bool CreateWebAudioSource( | 159 virtual bool CreateWebAudioSource( |
157 WebKit::WebMediaStreamSource* source) OVERRIDE; | 160 WebKit::WebMediaStreamSource* source) OVERRIDE; |
158 virtual scoped_refptr<webrtc::MediaStreamInterface> | 161 virtual scoped_refptr<webrtc::MediaStreamInterface> |
159 CreateLocalMediaStream(const std::string& label) OVERRIDE; | 162 CreateLocalMediaStream(const std::string& label) OVERRIDE; |
160 virtual scoped_refptr<webrtc::VideoTrackInterface> | 163 virtual scoped_refptr<webrtc::VideoTrackInterface> |
161 CreateLocalVideoTrack(const std::string& id, | 164 CreateLocalVideoTrack(const std::string& id, |
162 webrtc::VideoSourceInterface* source) OVERRIDE; | 165 webrtc::VideoSourceInterface* source) OVERRIDE; |
| 166 virtual scoped_refptr<webrtc::VideoTrackInterface> |
| 167 CreateLocalVideoTrack(const std::string& id, |
| 168 cricket::VideoCapturer* capturer) OVERRIDE; |
163 virtual scoped_refptr<webrtc::AudioTrackInterface> | 169 virtual scoped_refptr<webrtc::AudioTrackInterface> |
164 CreateLocalAudioTrack(const std::string& id, | 170 CreateLocalAudioTrack(const std::string& id, |
165 webrtc::AudioSourceInterface* source) OVERRIDE; | 171 webrtc::AudioSourceInterface* source) OVERRIDE; |
166 virtual webrtc::SessionDescriptionInterface* CreateSessionDescription( | 172 virtual webrtc::SessionDescriptionInterface* CreateSessionDescription( |
167 const std::string& type, | 173 const std::string& type, |
168 const std::string& sdp, | 174 const std::string& sdp, |
169 webrtc::SdpParseError* error) OVERRIDE; | 175 webrtc::SdpParseError* error) OVERRIDE; |
170 virtual webrtc::IceCandidateInterface* CreateIceCandidate( | 176 virtual webrtc::IceCandidateInterface* CreateIceCandidate( |
171 const std::string& sdp_mid, | 177 const std::string& sdp_mid, |
172 int sdp_mline_index, | 178 int sdp_mline_index, |
173 const std::string& sdp) OVERRIDE; | 179 const std::string& sdp) OVERRIDE; |
174 | 180 |
175 virtual bool EnsurePeerConnectionFactory() OVERRIDE; | 181 virtual bool EnsurePeerConnectionFactory() OVERRIDE; |
176 virtual bool PeerConnectionFactoryCreated() OVERRIDE; | 182 virtual bool PeerConnectionFactoryCreated() OVERRIDE; |
177 | 183 |
178 MockAudioSource* last_audio_source() { return last_audio_source_; } | 184 MockAudioSource* last_audio_source() { return last_audio_source_; } |
179 MockVideoSource* last_video_source() { return last_video_source_; } | 185 MockVideoSource* last_video_source() { return last_video_source_; } |
180 | 186 |
181 private: | 187 private: |
182 bool mock_pc_factory_created_; | 188 bool mock_pc_factory_created_; |
183 scoped_refptr <MockAudioSource> last_audio_source_; | 189 scoped_refptr <MockAudioSource> last_audio_source_; |
184 scoped_refptr <MockVideoSource> last_video_source_; | 190 scoped_refptr <MockVideoSource> last_video_source_; |
185 | 191 |
186 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory); | 192 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory); |
187 }; | 193 }; |
188 | 194 |
189 } // namespace content | 195 } // namespace content |
190 | 196 |
191 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ | 197 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ |
OLD | NEW |