| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 virtual ~MockLocalVideoTrack(); | 99 virtual ~MockLocalVideoTrack(); |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 bool enabled_; | 102 bool enabled_; |
| 103 std::string id_; | 103 std::string id_; |
| 104 TrackState state_; | 104 TrackState state_; |
| 105 scoped_refptr<webrtc::VideoSourceInterface> source_; | 105 scoped_refptr<webrtc::VideoSourceInterface> source_; |
| 106 webrtc::ObserverInterface* observer_; | 106 webrtc::ObserverInterface* observer_; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 class MockLocalAudioTrack : public webrtc::AudioTrackInterface { | |
| 110 public: | |
| 111 explicit MockLocalAudioTrack(const std::string& id) | |
| 112 : enabled_(false), | |
| 113 id_(id), | |
| 114 state_(MediaStreamTrackInterface::kLive), | |
| 115 observer_(NULL) { | |
| 116 } | |
| 117 virtual std::string kind() const OVERRIDE; | |
| 118 virtual std::string id() const OVERRIDE; | |
| 119 virtual bool enabled() const OVERRIDE; | |
| 120 virtual TrackState state() const OVERRIDE; | |
| 121 virtual bool set_enabled(bool enable) OVERRIDE; | |
| 122 virtual bool set_state(TrackState new_state) OVERRIDE; | |
| 123 virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; | |
| 124 virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; | |
| 125 virtual webrtc::AudioSourceInterface* GetSource() const OVERRIDE; | |
| 126 | |
| 127 protected: | |
| 128 virtual ~MockLocalAudioTrack() {} | |
| 129 | |
| 130 private: | |
| 131 bool enabled_; | |
| 132 std::string id_; | |
| 133 TrackState state_; | |
| 134 webrtc::ObserverInterface* observer_; | |
| 135 }; | |
| 136 | |
| 137 // A mock factory for creating different objects for | 109 // A mock factory for creating different objects for |
| 138 // RTC MediaStreams and PeerConnections. | 110 // RTC MediaStreams and PeerConnections. |
| 139 class MockMediaStreamDependencyFactory : public MediaStreamDependencyFactory { | 111 class MockMediaStreamDependencyFactory : public MediaStreamDependencyFactory { |
| 140 public: | 112 public: |
| 141 MockMediaStreamDependencyFactory(); | 113 MockMediaStreamDependencyFactory(); |
| 142 virtual ~MockMediaStreamDependencyFactory(); | 114 virtual ~MockMediaStreamDependencyFactory(); |
| 143 | 115 |
| 144 virtual scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection( | 116 virtual scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection( |
| 145 const webrtc::PeerConnectionInterface::IceServers& ice_servers, | 117 const webrtc::PeerConnectionInterface::IceServers& ice_servers, |
| 146 const webrtc::MediaConstraintsInterface* constraints, | 118 const webrtc::MediaConstraintsInterface* constraints, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 bool mock_pc_factory_created_; | 160 bool mock_pc_factory_created_; |
| 189 scoped_refptr <MockAudioSource> last_audio_source_; | 161 scoped_refptr <MockAudioSource> last_audio_source_; |
| 190 scoped_refptr <MockVideoSource> last_video_source_; | 162 scoped_refptr <MockVideoSource> last_video_source_; |
| 191 | 163 |
| 192 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory); | 164 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory); |
| 193 }; | 165 }; |
| 194 | 166 |
| 195 } // namespace content | 167 } // namespace content |
| 196 | 168 |
| 197 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ | 169 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ |
| OLD | NEW |