| 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_PEER_CONNECTION_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "third_party/libjingle/source/talk/app/webrtcv1/peerconnection.h" | 12 #include "third_party/libjingle/source/talk/app/webrtc/peerconnection.h" |
| 13 | 13 |
| 14 namespace webrtc { | 14 namespace webrtc { |
| 15 | 15 |
| 16 class MockPeerConnectionImpl : public PeerConnection { | 16 class MockStreamCollection; |
| 17 |
| 18 class MockPeerConnectionImpl : public PeerConnectionInterface { |
| 17 public: | 19 public: |
| 18 MockPeerConnectionImpl(); | 20 MockPeerConnectionImpl(); |
| 21 |
| 22 // PeerConnectionInterface implementation. |
| 23 virtual void ProcessSignalingMessage(const std::string& msg) OVERRIDE; |
| 24 virtual bool Send(const std::string& msg) OVERRIDE; |
| 25 virtual talk_base::scoped_refptr<StreamCollectionInterface> |
| 26 local_streams() OVERRIDE; |
| 27 virtual talk_base::scoped_refptr<StreamCollectionInterface> |
| 28 remote_streams() OVERRIDE; |
| 29 virtual void AddStream(LocalMediaStreamInterface* stream) OVERRIDE; |
| 30 virtual void RemoveStream(LocalMediaStreamInterface* stream) OVERRIDE; |
| 31 virtual void CommitStreamChanges() OVERRIDE; |
| 32 virtual void Close() OVERRIDE; |
| 33 virtual ReadyState ready_state() OVERRIDE; |
| 34 virtual SdpState sdp_state() OVERRIDE; |
| 35 |
| 36 void AddRemoteStream(MediaStreamInterface* stream); |
| 37 void ClearStreamChangesCommitted() { stream_changes_committed_ = false; } |
| 38 |
| 39 const std::string& signaling_message() const { return signaling_message_; } |
| 40 const std::string& stream_label() const { return stream_label_; } |
| 41 bool stream_changes_committed() const { return stream_changes_committed_; } |
| 42 |
| 43 protected: |
| 19 virtual ~MockPeerConnectionImpl(); | 44 virtual ~MockPeerConnectionImpl(); |
| 20 | 45 |
| 21 // PeerConnection implementation. | |
| 22 virtual void RegisterObserver(PeerConnectionObserver* observer) OVERRIDE; | |
| 23 virtual bool SignalingMessage(const std::string& msg) OVERRIDE; | |
| 24 virtual bool AddStream(const std::string& stream_id, bool video) OVERRIDE; | |
| 25 virtual bool RemoveStream(const std::string& stream_id) OVERRIDE; | |
| 26 virtual bool Connect() OVERRIDE; | |
| 27 virtual bool Close() OVERRIDE; | |
| 28 virtual bool SetAudioDevice( | |
| 29 const std::string& wave_in_device, | |
| 30 const std::string& wave_out_device, int opts) OVERRIDE; | |
| 31 virtual bool SetLocalVideoRenderer(cricket::VideoRenderer* renderer) OVERRIDE; | |
| 32 virtual bool SetVideoRenderer( | |
| 33 const std::string& stream_id, | |
| 34 cricket::VideoRenderer* renderer) OVERRIDE; | |
| 35 virtual bool SetVideoCapture(const std::string& cam_device) OVERRIDE; | |
| 36 virtual ReadyState GetReadyState() OVERRIDE; | |
| 37 | |
| 38 PeerConnectionObserver* observer() const { return observer_; } | |
| 39 const std::string& signaling_message() const { return signaling_message_; } | |
| 40 const std::string& stream_id() const { return stream_id_; } | |
| 41 bool video_stream() const { return video_stream_; } | |
| 42 bool connected() const { return connected_; } | |
| 43 bool video_capture_set() const { return video_capture_set_; } | |
| 44 const std::string& video_renderer_stream_id() const { | |
| 45 return video_renderer_stream_id_; | |
| 46 } | |
| 47 | |
| 48 private: | 46 private: |
| 49 PeerConnectionObserver* observer_; | |
| 50 std::string signaling_message_; | 47 std::string signaling_message_; |
| 51 std::string stream_id_; | 48 std::string stream_label_; |
| 52 bool video_stream_; | 49 bool stream_changes_committed_; |
| 53 bool connected_; | 50 talk_base::scoped_refptr<MockStreamCollection> remote_streams_; |
| 54 bool video_capture_set_; | |
| 55 std::string video_renderer_stream_id_; | |
| 56 | 51 |
| 57 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl); | 52 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl); |
| 58 }; | 53 }; |
| 59 | 54 |
| 60 } // namespace webrtc | 55 } // namespace webrtc |
| 61 | 56 |
| 62 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ | 57 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ |
| OLD | NEW |