| OLD | NEW |
| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 ObserverSet observers_; | 65 ObserverSet observers_; |
| 66 MediaSourceInterface::SourceState state_; | 66 MediaSourceInterface::SourceState state_; |
| 67 webrtc::MediaConstraintsInterface::Constraints optional_constraints_; | 67 webrtc::MediaConstraintsInterface::Constraints optional_constraints_; |
| 68 webrtc::MediaConstraintsInterface::Constraints mandatory_constraints_; | 68 webrtc::MediaConstraintsInterface::Constraints mandatory_constraints_; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 class MockWebRtcVideoTrack : public webrtc::VideoTrackInterface { | 71 class MockWebRtcVideoTrack : public webrtc::VideoTrackInterface { |
| 72 public: | 72 public: |
| 73 MockWebRtcVideoTrack(const std::string& id, | 73 MockWebRtcVideoTrack(const std::string& id, |
| 74 webrtc::VideoTrackSourceInterface* source); | 74 webrtc::VideoTrackSourceInterface* source); |
| 75 void AddRenderer(webrtc::VideoRendererInterface* renderer) override; | 75 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, |
| 76 void RemoveRenderer(webrtc::VideoRendererInterface* renderer) override; | 76 const rtc::VideoSinkWants& wants) override; |
| 77 void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override; |
| 77 std::string kind() const override; | 78 std::string kind() const override; |
| 78 std::string id() const override; | 79 std::string id() const override; |
| 79 bool enabled() const override; | 80 bool enabled() const override; |
| 80 TrackState state() const override; | 81 TrackState state() const override; |
| 81 bool set_enabled(bool enable) override; | 82 bool set_enabled(bool enable) override; |
| 82 bool set_state(TrackState new_state) override; | 83 bool set_state(TrackState new_state) override; |
| 83 void RegisterObserver(webrtc::ObserverInterface* observer) override; | 84 void RegisterObserver(webrtc::ObserverInterface* observer) override; |
| 84 void UnregisterObserver(webrtc::ObserverInterface* observer) override; | 85 void UnregisterObserver(webrtc::ObserverInterface* observer) override; |
| 85 webrtc::VideoTrackSourceInterface* GetSource() const override; | 86 webrtc::VideoTrackSourceInterface* GetSource() const override; |
| 86 | 87 |
| 87 protected: | 88 protected: |
| 88 ~MockWebRtcVideoTrack() override; | 89 ~MockWebRtcVideoTrack() override; |
| 89 | 90 |
| 90 private: | 91 private: |
| 91 bool enabled_; | 92 bool enabled_; |
| 92 std::string id_; | 93 std::string id_; |
| 93 TrackState state_; | 94 TrackState state_; |
| 94 scoped_refptr<webrtc::VideoTrackSourceInterface> source_; | 95 scoped_refptr<webrtc::VideoTrackSourceInterface> source_; |
| 95 ObserverSet observers_; | 96 ObserverSet observers_; |
| 96 webrtc::VideoRendererInterface* renderer_; | 97 rtc::VideoSinkInterface<cricket::VideoFrame>* sink_; |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 class MockMediaStream : public webrtc::MediaStreamInterface { | 100 class MockMediaStream : public webrtc::MediaStreamInterface { |
| 100 public: | 101 public: |
| 101 explicit MockMediaStream(const std::string& label); | 102 explicit MockMediaStream(const std::string& label); |
| 102 | 103 |
| 103 bool AddTrack(webrtc::AudioTrackInterface* track) override; | 104 bool AddTrack(webrtc::AudioTrackInterface* track) override; |
| 104 bool AddTrack(webrtc::VideoTrackInterface* track) override; | 105 bool AddTrack(webrtc::VideoTrackInterface* track) override; |
| 105 bool RemoveTrack(webrtc::AudioTrackInterface* track) override; | 106 bool RemoveTrack(webrtc::AudioTrackInterface* track) override; |
| 106 bool RemoveTrack(webrtc::VideoTrackInterface* track) override; | 107 bool RemoveTrack(webrtc::VideoTrackInterface* track) override; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 private: | 180 private: |
| 180 bool fail_to_create_next_audio_capturer_; | 181 bool fail_to_create_next_audio_capturer_; |
| 181 scoped_refptr <MockAudioSource> last_audio_source_; | 182 scoped_refptr <MockAudioSource> last_audio_source_; |
| 182 | 183 |
| 183 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionDependencyFactory); | 184 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionDependencyFactory); |
| 184 }; | 185 }; |
| 185 | 186 |
| 186 } // namespace content | 187 } // namespace content |
| 187 | 188 |
| 188 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_MOCK_PEER_CONNECTION_DEPENDENCY_FACTORY
_H_ | 189 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_MOCK_PEER_CONNECTION_DEPENDENCY_FACTORY
_H_ |
| OLD | NEW |