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 21 matching lines...) Expand all Loading... |
32 protected: | 32 protected: |
33 virtual ~MockVideoSource(); | 33 virtual ~MockVideoSource(); |
34 | 34 |
35 private: | 35 private: |
36 webrtc::ObserverInterface* observer_; | 36 webrtc::ObserverInterface* observer_; |
37 MediaSourceInterface::SourceState state_; | 37 MediaSourceInterface::SourceState state_; |
38 }; | 38 }; |
39 | 39 |
40 class MockLocalVideoTrack : public webrtc::VideoTrackInterface { | 40 class MockLocalVideoTrack : public webrtc::VideoTrackInterface { |
41 public: | 41 public: |
42 MockLocalVideoTrack(std::string label, | 42 MockLocalVideoTrack(std::string id, |
43 webrtc::VideoSourceInterface* source); | 43 webrtc::VideoSourceInterface* source); |
44 virtual void AddRenderer(webrtc::VideoRendererInterface* renderer) OVERRIDE; | 44 virtual void AddRenderer(webrtc::VideoRendererInterface* renderer) OVERRIDE; |
45 virtual void RemoveRenderer( | 45 virtual void RemoveRenderer( |
46 webrtc::VideoRendererInterface* renderer) OVERRIDE; | 46 webrtc::VideoRendererInterface* renderer) OVERRIDE; |
47 virtual cricket::VideoRenderer* FrameInput() OVERRIDE; | 47 virtual cricket::VideoRenderer* FrameInput() OVERRIDE; |
48 virtual std::string kind() const OVERRIDE; | 48 virtual std::string kind() const OVERRIDE; |
49 virtual std::string label() const OVERRIDE; | 49 virtual std::string id() const OVERRIDE; |
50 virtual bool enabled() const OVERRIDE; | 50 virtual bool enabled() const OVERRIDE; |
51 virtual TrackState state() const OVERRIDE; | 51 virtual TrackState state() const OVERRIDE; |
52 virtual bool set_enabled(bool enable) OVERRIDE; | 52 virtual bool set_enabled(bool enable) OVERRIDE; |
53 virtual bool set_state(TrackState new_state) OVERRIDE; | 53 virtual bool set_state(TrackState new_state) OVERRIDE; |
54 virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; | 54 virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; |
55 virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; | 55 virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; |
56 virtual webrtc::VideoSourceInterface* GetSource() const OVERRIDE; | 56 virtual webrtc::VideoSourceInterface* GetSource() const OVERRIDE; |
57 | 57 |
58 protected: | 58 protected: |
59 virtual ~MockLocalVideoTrack(); | 59 virtual ~MockLocalVideoTrack(); |
60 | 60 |
61 private: | 61 private: |
62 bool enabled_; | 62 bool enabled_; |
63 std::string label_; | 63 std::string id_; |
64 scoped_refptr<webrtc::VideoSourceInterface> source_; | 64 scoped_refptr<webrtc::VideoSourceInterface> source_; |
65 }; | 65 }; |
66 | 66 |
67 class MockLocalAudioTrack : public webrtc::AudioTrackInterface { | 67 class MockLocalAudioTrack : public webrtc::AudioTrackInterface { |
68 public: | 68 public: |
69 explicit MockLocalAudioTrack(const std::string& label) | 69 explicit MockLocalAudioTrack(const std::string& id) |
70 : enabled_(false), | 70 : enabled_(false), |
71 label_(label) { | 71 id_(id) { |
72 } | 72 } |
73 virtual std::string kind() const OVERRIDE; | 73 virtual std::string kind() const OVERRIDE; |
74 virtual std::string label() const OVERRIDE; | 74 virtual std::string id() const OVERRIDE; |
75 virtual bool enabled() const OVERRIDE; | 75 virtual bool enabled() const OVERRIDE; |
76 virtual TrackState state() const OVERRIDE; | 76 virtual TrackState state() const OVERRIDE; |
77 virtual bool set_enabled(bool enable) OVERRIDE; | 77 virtual bool set_enabled(bool enable) OVERRIDE; |
78 virtual bool set_state(TrackState new_state) OVERRIDE; | 78 virtual bool set_state(TrackState new_state) OVERRIDE; |
79 virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; | 79 virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; |
80 virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; | 80 virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; |
81 virtual webrtc::AudioSourceInterface* GetSource() const OVERRIDE; | 81 virtual webrtc::AudioSourceInterface* GetSource() const OVERRIDE; |
82 | 82 |
83 protected: | 83 protected: |
84 virtual ~MockLocalAudioTrack() {} | 84 virtual ~MockLocalAudioTrack() {} |
85 | 85 |
86 private: | 86 private: |
87 bool enabled_; | 87 bool enabled_; |
88 std::string label_; | 88 std::string id_; |
89 }; | 89 }; |
90 | 90 |
91 // A mock factory for creating different objects for | 91 // A mock factory for creating different objects for |
92 // RTC MediaStreams and PeerConnections. | 92 // RTC MediaStreams and PeerConnections. |
93 class MockMediaStreamDependencyFactory : public MediaStreamDependencyFactory { | 93 class MockMediaStreamDependencyFactory : public MediaStreamDependencyFactory { |
94 public: | 94 public: |
95 MockMediaStreamDependencyFactory(); | 95 MockMediaStreamDependencyFactory(); |
96 virtual ~MockMediaStreamDependencyFactory(); | 96 virtual ~MockMediaStreamDependencyFactory(); |
97 | 97 |
98 virtual scoped_refptr<webrtc::PeerConnectionInterface> | 98 virtual scoped_refptr<webrtc::PeerConnectionInterface> |
99 CreatePeerConnection(const webrtc::JsepInterface::IceServers& ice_servers, | 99 CreatePeerConnection(const webrtc::JsepInterface::IceServers& ice_servers, |
100 const webrtc::MediaConstraintsInterface* constraints, | 100 const webrtc::MediaConstraintsInterface* constraints, |
101 WebKit::WebFrame* frame, | 101 WebKit::WebFrame* frame, |
102 webrtc::PeerConnectionObserver* observer) OVERRIDE; | 102 webrtc::PeerConnectionObserver* observer) OVERRIDE; |
103 virtual scoped_refptr<webrtc::VideoSourceInterface> | 103 virtual scoped_refptr<webrtc::VideoSourceInterface> |
104 CreateVideoSource( | 104 CreateVideoSource( |
105 int video_session_id, | 105 int video_session_id, |
106 bool is_screencast, | 106 bool is_screencast, |
107 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE; | 107 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE; |
108 virtual scoped_refptr<webrtc::LocalMediaStreamInterface> | 108 virtual scoped_refptr<webrtc::LocalMediaStreamInterface> |
109 CreateLocalMediaStream(const std::string& label) OVERRIDE; | 109 CreateLocalMediaStream(const std::string& label) OVERRIDE; |
110 virtual scoped_refptr<webrtc::VideoTrackInterface> | 110 virtual scoped_refptr<webrtc::VideoTrackInterface> |
111 CreateLocalVideoTrack(const std::string& label, | 111 CreateLocalVideoTrack(const std::string& id, |
112 webrtc::VideoSourceInterface* source) OVERRIDE; | 112 webrtc::VideoSourceInterface* source) OVERRIDE; |
113 virtual scoped_refptr<webrtc::LocalAudioTrackInterface> | 113 virtual scoped_refptr<webrtc::LocalAudioTrackInterface> |
114 CreateLocalAudioTrack(const std::string& label, | 114 CreateLocalAudioTrack(const std::string& id, |
115 webrtc::AudioDeviceModule* audio_device) OVERRIDE; | 115 webrtc::AudioDeviceModule* audio_device) OVERRIDE; |
116 virtual webrtc::SessionDescriptionInterface* CreateSessionDescription( | 116 virtual webrtc::SessionDescriptionInterface* CreateSessionDescription( |
117 const std::string& sdp) OVERRIDE; | |
118 virtual webrtc::SessionDescriptionInterface* CreateSessionDescription( | |
119 const std::string& type, | 117 const std::string& type, |
120 const std::string& sdp) OVERRIDE; | 118 const std::string& sdp) OVERRIDE; |
121 virtual webrtc::IceCandidateInterface* CreateIceCandidate( | 119 virtual webrtc::IceCandidateInterface* CreateIceCandidate( |
122 const std::string& sdp_mid, | 120 const std::string& sdp_mid, |
123 int sdp_mline_index, | 121 int sdp_mline_index, |
124 const std::string& sdp) OVERRIDE; | 122 const std::string& sdp) OVERRIDE; |
125 | 123 |
126 virtual bool EnsurePeerConnectionFactory() OVERRIDE; | 124 virtual bool EnsurePeerConnectionFactory() OVERRIDE; |
127 virtual bool PeerConnectionFactoryCreated() OVERRIDE; | 125 virtual bool PeerConnectionFactoryCreated() OVERRIDE; |
128 virtual void SetAudioDeviceSessionId(int session_id) OVERRIDE; | 126 virtual void SetAudioDeviceSessionId(int session_id) OVERRIDE; |
129 | 127 |
130 MockVideoSource* last_video_source() { return last_video_source_; } | 128 MockVideoSource* last_video_source() { return last_video_source_; } |
131 | 129 |
132 private: | 130 private: |
133 bool mock_pc_factory_created_; | 131 bool mock_pc_factory_created_; |
134 scoped_refptr <MockVideoSource> last_video_source_; | 132 scoped_refptr <MockVideoSource> last_video_source_; |
135 | 133 |
136 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory); | 134 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory); |
137 }; | 135 }; |
138 | 136 |
139 } // namespace content | 137 } // namespace content |
140 | 138 |
141 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ | 139 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ |
OLD | NEW |