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 #include "content/renderer/media/mock_media_stream_dependency_factory.h" | 5 #include "content/renderer/media/mock_media_stream_dependency_factory.h" |
6 #include "content/renderer/media/mock_peer_connection_impl.h" | 6 #include "content/renderer/media/mock_peer_connection_impl.h" |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 | 41 |
42 MockPeerConnectionImpl::MockPeerConnectionImpl( | 42 MockPeerConnectionImpl::MockPeerConnectionImpl( |
43 MockMediaStreamDependencyFactory* factory) | 43 MockMediaStreamDependencyFactory* factory) |
44 : dependency_factory_(factory), | 44 : dependency_factory_(factory), |
45 local_streams_(new talk_base::RefCountedObject<MockStreamCollection>), | 45 local_streams_(new talk_base::RefCountedObject<MockStreamCollection>), |
46 remote_streams_(new talk_base::RefCountedObject<MockStreamCollection>), | 46 remote_streams_(new talk_base::RefCountedObject<MockStreamCollection>), |
47 hint_audio_(false), | 47 hint_audio_(false), |
48 hint_video_(false), | 48 hint_video_(false), |
49 action_(kAnswer), | 49 action_(kAnswer), |
50 ice_options_(kOnlyRelay), | 50 ice_options_(kOnlyRelay), |
51 ready_state_(kNew) { | 51 sdp_mline_index_(-1), |
52 ready_state_(kNew), | |
53 ice_state_(kIceNew) { | |
52 } | 54 } |
53 | 55 |
54 MockPeerConnectionImpl::~MockPeerConnectionImpl() {} | 56 MockPeerConnectionImpl::~MockPeerConnectionImpl() {} |
55 | 57 |
56 talk_base::scoped_refptr<StreamCollectionInterface> | 58 talk_base::scoped_refptr<StreamCollectionInterface> |
57 MockPeerConnectionImpl::local_streams() { | 59 MockPeerConnectionImpl::local_streams() { |
58 return local_streams_; | 60 return local_streams_; |
59 } | 61 } |
60 | 62 |
61 talk_base::scoped_refptr<StreamCollectionInterface> | 63 talk_base::scoped_refptr<StreamCollectionInterface> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 webrtc::SessionDescriptionInterface* desc) { | 124 webrtc::SessionDescriptionInterface* desc) { |
123 action_ = action; | 125 action_ = action; |
124 remote_desc_.reset(desc); | 126 remote_desc_.reset(desc); |
125 return desc->ToString(&description_sdp_); | 127 return desc->ToString(&description_sdp_); |
126 } | 128 } |
127 | 129 |
128 bool MockPeerConnectionImpl::ProcessIceMessage( | 130 bool MockPeerConnectionImpl::ProcessIceMessage( |
129 const webrtc::IceCandidateInterface* ice_candidate) { | 131 const webrtc::IceCandidateInterface* ice_candidate) { |
130 sdp_mid_ = ice_candidate->sdp_mid(); | 132 sdp_mid_ = ice_candidate->sdp_mid(); |
131 sdp_mline_index_ = ice_candidate->sdp_mline_index(); | 133 sdp_mline_index_ = ice_candidate->sdp_mline_index(); |
132 return ice_candidate->ToString(&ice_sdp_); | 134 return ice_candidate->ToString(&ice_sdp_); |
Ronghua Wu (Left Chromium)
2012/08/14 00:59:03
Call AddCandidate directly.
perkj_chrome
2012/08/14 09:15:40
Done.
| |
133 } | 135 } |
134 | 136 |
135 const webrtc::SessionDescriptionInterface* | 137 const webrtc::SessionDescriptionInterface* |
136 MockPeerConnectionImpl::local_description() const { | 138 MockPeerConnectionImpl::local_description() const { |
137 return local_desc_.get(); | 139 return local_desc_.get(); |
138 } | 140 } |
139 | 141 |
140 const webrtc::SessionDescriptionInterface* | 142 const webrtc::SessionDescriptionInterface* |
141 MockPeerConnectionImpl::remote_description() const { | 143 MockPeerConnectionImpl::remote_description() const { |
142 return remote_desc_.get(); | 144 return remote_desc_.get(); |
143 } | 145 } |
144 | 146 |
145 void MockPeerConnectionImpl::AddRemoteStream(MediaStreamInterface* stream) { | 147 void MockPeerConnectionImpl::AddRemoteStream(MediaStreamInterface* stream) { |
146 remote_streams_->AddStream(stream); | 148 remote_streams_->AddStream(stream); |
147 } | 149 } |
148 | 150 |
149 void MockPeerConnectionImpl::CreateOffer( | 151 void MockPeerConnectionImpl::CreateOffer( |
150 CreateSessionDescriptionObserver* observer, | 152 CreateSessionDescriptionObserver* observer, |
151 const MediaConstraintsInterface* constraints) { | 153 const MediaConstraintsInterface* constraints) { |
154 DCHECK(observer); | |
152 NOTIMPLEMENTED(); | 155 NOTIMPLEMENTED(); |
153 } | 156 } |
154 | 157 |
155 void MockPeerConnectionImpl::CreateAnswer( | 158 void MockPeerConnectionImpl::CreateAnswer( |
156 CreateSessionDescriptionObserver* observer, | 159 CreateSessionDescriptionObserver* observer, |
157 const MediaConstraintsInterface* constraints) { | 160 const MediaConstraintsInterface* constraints) { |
158 NOTIMPLEMENTED(); | 161 NOTIMPLEMENTED(); |
159 } | 162 } |
160 | 163 |
161 void MockPeerConnectionImpl::SetLocalDescription( | 164 void MockPeerConnectionImpl::SetLocalDescription( |
162 SetSessionDescriptionObserver* observer, | 165 SetSessionDescriptionObserver* observer, |
163 SessionDescriptionInterface* desc) { | 166 SessionDescriptionInterface* desc) { |
164 NOTIMPLEMENTED(); | 167 local_desc_.reset(desc); |
Ronghua Wu (Left Chromium)
2012/08/14 00:59:03
call the observer?
Ronghua Wu (Left Chromium)
2012/08/14 00:59:03
Is desc->ToString(&description_sdp_); needed here?
perkj_chrome
2012/08/14 09:15:40
Can't do that unfortunately since the WebKit class
perkj_chrome
2012/08/14 09:15:40
No - but it make sence to keep them the same as th
| |
165 } | 168 } |
166 | 169 |
167 void MockPeerConnectionImpl::SetRemoteDescription( | 170 void MockPeerConnectionImpl::SetRemoteDescription( |
168 SetSessionDescriptionObserver* observer, | 171 SetSessionDescriptionObserver* observer, |
169 SessionDescriptionInterface* desc) { | 172 SessionDescriptionInterface* desc) { |
170 NOTIMPLEMENTED(); | 173 remote_desc_.reset(desc); |
Ronghua Wu (Left Chromium)
2012/08/14 00:59:03
call the observer?
perkj_chrome
2012/08/14 09:15:40
dito
| |
171 } | 174 } |
172 | 175 |
173 bool MockPeerConnectionImpl::UpdateIce( | 176 bool MockPeerConnectionImpl::UpdateIce( |
174 const IceServers& configuration, | 177 const IceServers& configuration, |
175 const MediaConstraintsInterface* constraints) { | 178 const MediaConstraintsInterface* constraints) { |
176 NOTIMPLEMENTED(); | 179 return true; |
177 return false; | |
178 } | 180 } |
179 | 181 |
180 bool MockPeerConnectionImpl::AddIceCandidate( | 182 bool MockPeerConnectionImpl::AddIceCandidate( |
181 const IceCandidateInterface* candidate) { | 183 const IceCandidateInterface* candidate) { |
182 NOTIMPLEMENTED(); | 184 sdp_mid_ = candidate->sdp_mid(); |
183 return false; | 185 sdp_mline_index_ = candidate->sdp_mline_index(); |
186 return candidate->ToString(&ice_sdp_); | |
184 } | 187 } |
185 | 188 |
186 PeerConnectionInterface::IceState MockPeerConnectionImpl::ice_state() { | 189 PeerConnectionInterface::IceState MockPeerConnectionImpl::ice_state() { |
187 NOTIMPLEMENTED(); | 190 return ice_state_; |
188 return kIceNew; | |
189 } | 191 } |
190 | 192 |
191 } // namespace webrtc | 193 } // namespace webrtc |
OLD | NEW |