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 "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" | 13 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" |
14 | 14 |
15 class MockMediaStreamDependencyFactory; | 15 class MockMediaStreamDependencyFactory; |
16 | 16 |
17 namespace webrtc { | 17 namespace webrtc { |
18 | 18 |
19 class MockStreamCollection; | 19 class MockStreamCollection; |
20 | 20 |
21 class MockPeerConnectionImpl : public PeerConnectionInterface { | 21 class MockPeerConnectionImpl : public PeerConnectionInterface { |
22 public: | 22 public: |
23 explicit MockPeerConnectionImpl(MockMediaStreamDependencyFactory* factory); | 23 explicit MockPeerConnectionImpl(MockMediaStreamDependencyFactory* factory); |
24 | 24 |
25 // PeerConnectionInterface implementation. | 25 // PeerConnectionInterface implementation. |
26 virtual void ProcessSignalingMessage(const std::string& msg) OVERRIDE; | |
27 virtual bool Send(const std::string& msg) OVERRIDE; | |
28 virtual talk_base::scoped_refptr<StreamCollectionInterface> | 26 virtual talk_base::scoped_refptr<StreamCollectionInterface> |
29 local_streams() OVERRIDE; | 27 local_streams() OVERRIDE; |
30 virtual talk_base::scoped_refptr<StreamCollectionInterface> | 28 virtual talk_base::scoped_refptr<StreamCollectionInterface> |
31 remote_streams() OVERRIDE; | 29 remote_streams() OVERRIDE; |
32 virtual void AddStream(LocalMediaStreamInterface* stream) OVERRIDE; | 30 virtual void AddStream(LocalMediaStreamInterface* stream) OVERRIDE; |
33 virtual bool AddStream(MediaStreamInterface* local_stream, | 31 virtual bool AddStream(MediaStreamInterface* local_stream, |
34 const MediaConstraintsInterface* constraints) OVERRIDE; | 32 const MediaConstraintsInterface* constraints) OVERRIDE; |
35 virtual void RemoveStream(LocalMediaStreamInterface* stream) OVERRIDE; | |
36 virtual void RemoveStream(MediaStreamInterface* local_stream) OVERRIDE; | 33 virtual void RemoveStream(MediaStreamInterface* local_stream) OVERRIDE; |
37 virtual bool RemoveStream(const std::string& label) OVERRIDE; | |
38 virtual void CommitStreamChanges() OVERRIDE; | |
39 virtual void Close() OVERRIDE; | |
40 virtual ReadyState ready_state() OVERRIDE; | 34 virtual ReadyState ready_state() OVERRIDE; |
41 virtual SdpState sdp_state() OVERRIDE; | |
42 virtual bool StartIce(IceOptions options) OVERRIDE; | 35 virtual bool StartIce(IceOptions options) OVERRIDE; |
43 | 36 |
44 virtual webrtc::SessionDescriptionInterface* CreateOffer( | 37 virtual webrtc::SessionDescriptionInterface* CreateOffer( |
45 const webrtc::MediaHints& hints) OVERRIDE; | 38 const webrtc::MediaHints& hints) OVERRIDE; |
46 virtual webrtc::SessionDescriptionInterface* CreateAnswer( | 39 virtual webrtc::SessionDescriptionInterface* CreateAnswer( |
47 const webrtc::MediaHints& hints, | 40 const webrtc::MediaHints& hints, |
48 const webrtc::SessionDescriptionInterface* offer) OVERRIDE; | 41 const webrtc::SessionDescriptionInterface* offer) OVERRIDE; |
49 virtual bool SetLocalDescription( | 42 virtual bool SetLocalDescription( |
50 Action action, | 43 Action action, |
51 webrtc::SessionDescriptionInterface* desc) OVERRIDE; | 44 webrtc::SessionDescriptionInterface* desc) OVERRIDE; |
(...skipping 17 matching lines...) Expand all Loading... |
69 virtual void SetLocalDescription(SetSessionDescriptionObserver* observer, | 62 virtual void SetLocalDescription(SetSessionDescriptionObserver* observer, |
70 SessionDescriptionInterface* desc) OVERRIDE; | 63 SessionDescriptionInterface* desc) OVERRIDE; |
71 virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer, | 64 virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer, |
72 SessionDescriptionInterface* desc) OVERRIDE; | 65 SessionDescriptionInterface* desc) OVERRIDE; |
73 virtual bool UpdateIce(const IceServers& configuration, | 66 virtual bool UpdateIce(const IceServers& configuration, |
74 const MediaConstraintsInterface* constraints) OVERRIDE; | 67 const MediaConstraintsInterface* constraints) OVERRIDE; |
75 virtual bool AddIceCandidate(const IceCandidateInterface* candidate) OVERRIDE; | 68 virtual bool AddIceCandidate(const IceCandidateInterface* candidate) OVERRIDE; |
76 virtual IceState ice_state() OVERRIDE; | 69 virtual IceState ice_state() OVERRIDE; |
77 | 70 |
78 void AddRemoteStream(MediaStreamInterface* stream); | 71 void AddRemoteStream(MediaStreamInterface* stream); |
79 void ClearStreamChangesCommitted() { stream_changes_committed_ = false; } | |
80 void SetReadyState(ReadyState state) { ready_state_ = state; } | 72 void SetReadyState(ReadyState state) { ready_state_ = state; } |
81 | 73 |
82 const std::string& signaling_message() const { return signaling_message_; } | |
83 const std::string& stream_label() const { return stream_label_; } | 74 const std::string& stream_label() const { return stream_label_; } |
84 bool stream_changes_committed() const { return stream_changes_committed_; } | |
85 bool hint_audio() const { return hint_audio_; } | 75 bool hint_audio() const { return hint_audio_; } |
86 bool hint_video() const { return hint_video_; } | 76 bool hint_video() const { return hint_video_; } |
87 Action action() const { return action_; } | 77 Action action() const { return action_; } |
88 const std::string& description_sdp() const { return description_sdp_; } | 78 const std::string& description_sdp() const { return description_sdp_; } |
89 IceOptions ice_options() const { return ice_options_; } | 79 IceOptions ice_options() const { return ice_options_; } |
90 const std::string& sdp_mid() const { return sdp_mid_; } | 80 const std::string& sdp_mid() const { return sdp_mid_; } |
91 int sdp_mline_index() const { return sdp_mline_index_; } | 81 int sdp_mline_index() const { return sdp_mline_index_; } |
92 const std::string& ice_sdp() const { return ice_sdp_; } | 82 const std::string& ice_sdp() const { return ice_sdp_; } |
93 | 83 |
94 static const char kDummyOffer[]; | 84 static const char kDummyOffer[]; |
95 | 85 |
96 protected: | 86 protected: |
97 virtual ~MockPeerConnectionImpl(); | 87 virtual ~MockPeerConnectionImpl(); |
98 | 88 |
99 private: | 89 private: |
100 // Used for creating MockSessionDescription. | 90 // Used for creating MockSessionDescription. |
101 MockMediaStreamDependencyFactory* dependency_factory_; | 91 MockMediaStreamDependencyFactory* dependency_factory_; |
102 | 92 |
103 std::string signaling_message_; | |
104 std::string stream_label_; | 93 std::string stream_label_; |
105 bool stream_changes_committed_; | |
106 talk_base::scoped_refptr<MockStreamCollection> local_streams_; | 94 talk_base::scoped_refptr<MockStreamCollection> local_streams_; |
107 talk_base::scoped_refptr<MockStreamCollection> remote_streams_; | 95 talk_base::scoped_refptr<MockStreamCollection> remote_streams_; |
108 scoped_ptr<webrtc::SessionDescriptionInterface> local_desc_; | 96 scoped_ptr<webrtc::SessionDescriptionInterface> local_desc_; |
109 scoped_ptr<webrtc::SessionDescriptionInterface> remote_desc_; | 97 scoped_ptr<webrtc::SessionDescriptionInterface> remote_desc_; |
110 bool hint_audio_; | 98 bool hint_audio_; |
111 bool hint_video_; | 99 bool hint_video_; |
112 Action action_; | 100 Action action_; |
113 std::string description_sdp_; | 101 std::string description_sdp_; |
114 IceOptions ice_options_; | 102 IceOptions ice_options_; |
115 std::string sdp_mid_; | 103 std::string sdp_mid_; |
116 int sdp_mline_index_; | 104 int sdp_mline_index_; |
117 std::string ice_sdp_; | 105 std::string ice_sdp_; |
118 ReadyState ready_state_; | 106 ReadyState ready_state_; |
119 | 107 |
120 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl); | 108 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl); |
121 }; | 109 }; |
122 | 110 |
123 } // namespace webrtc | 111 } // namespace webrtc |
124 | 112 |
125 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ | 113 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ |
OLD | NEW |