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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "content/renderer/media/media_stream_extra_data.h" | 9 #include "content/renderer/media/media_stream_extra_data.h" |
10 #include "content/renderer/media/mock_media_stream_dependency_factory.h" | 10 #include "content/renderer/media/mock_media_stream_dependency_factory.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 | 203 |
204 // Start ICE. | 204 // Start ICE. |
205 WebKit::WebICEOptions options; | 205 WebKit::WebICEOptions options; |
206 options.initialize(WebKit::WebICEOptions::CandidateTypeAll); | 206 options.initialize(WebKit::WebICEOptions::CandidateTypeAll); |
207 EXPECT_TRUE(pc_handler_->startIce(options)); | 207 EXPECT_TRUE(pc_handler_->startIce(options)); |
208 EXPECT_EQ(webrtc::PeerConnectionInterface::kUseAll, | 208 EXPECT_EQ(webrtc::PeerConnectionInterface::kUseAll, |
209 mock_peer_connection_->ice_options()); | 209 mock_peer_connection_->ice_options()); |
210 | 210 |
211 // Process ICE message. | 211 // Process ICE message. |
212 WebKit::WebICECandidateDescriptor candidate; | 212 WebKit::WebICECandidateDescriptor candidate; |
213 WebKit::WebString label = "test label"; | 213 WebKit::WebString label = "0"; |
214 sdp = "test sdp"; | 214 sdp = "test sdp"; |
215 candidate.initialize(label, sdp); | 215 candidate.initialize(label, sdp); |
216 EXPECT_TRUE(pc_handler_->processIceMessage(candidate)); | 216 EXPECT_TRUE(pc_handler_->processIceMessage(candidate)); |
217 EXPECT_EQ(UTF16ToUTF8(label), mock_peer_connection_->ice_label()); | 217 EXPECT_EQ(UTF16ToUTF8(label), mock_peer_connection_->sdp_mid()); |
Ronghua Wu (Left Chromium)
2012/07/30 18:09:10
will them equal?
Mallinath (Gone from Chromium)
2012/07/30 18:42:08
Removed label and using sdp_mid as per impl.
| |
218 EXPECT_EQ(UTF16ToUTF8(sdp), mock_peer_connection_->ice_sdp()); | 218 EXPECT_EQ(UTF16ToUTF8(sdp), mock_peer_connection_->ice_sdp()); |
219 | 219 |
220 // Add stream. | 220 // Add stream. |
221 std::string stream_label = "local_stream"; | 221 std::string stream_label = "local_stream"; |
222 WebKit::WebMediaStreamDescriptor local_stream( | 222 WebKit::WebMediaStreamDescriptor local_stream( |
223 CreateLocalMediaStream(stream_label)); | 223 CreateLocalMediaStream(stream_label)); |
224 | 224 |
225 pc_handler_->addStream(local_stream); | 225 pc_handler_->addStream(local_stream); |
226 EXPECT_EQ(stream_label, mock_peer_connection_->stream_label()); | 226 EXPECT_EQ(stream_label, mock_peer_connection_->stream_label()); |
227 EXPECT_TRUE(mock_peer_connection_->stream_changes_committed()); | 227 EXPECT_TRUE(mock_peer_connection_->stream_changes_committed()); |
(...skipping 25 matching lines...) Expand all Loading... | |
253 // On state change. | 253 // On state change. |
254 mock_peer_connection_->SetReadyState( | 254 mock_peer_connection_->SetReadyState( |
255 webrtc::PeerConnectionInterface::kActive); | 255 webrtc::PeerConnectionInterface::kActive); |
256 webrtc::PeerConnectionObserver::StateType state = | 256 webrtc::PeerConnectionObserver::StateType state = |
257 webrtc::PeerConnectionObserver::kReadyState; | 257 webrtc::PeerConnectionObserver::kReadyState; |
258 pc_handler_->OnStateChange(state); | 258 pc_handler_->OnStateChange(state); |
259 EXPECT_EQ(WebKit::WebPeerConnection00HandlerClient::ReadyStateActive, | 259 EXPECT_EQ(WebKit::WebPeerConnection00HandlerClient::ReadyStateActive, |
260 mock_client_->ready_state()); | 260 mock_client_->ready_state()); |
261 | 261 |
262 // On ICE candidate. | 262 // On ICE candidate. |
263 std::string candidate_label = "test label"; | 263 std::string candidate_label = "0"; |
264 std::string candidate_sdp = "test sdp"; | 264 std::string candidate_sdp = "test sdp"; |
265 int sdp_mline_index = 0; | |
265 scoped_ptr<webrtc::IceCandidateInterface> native_candidate( | 266 scoped_ptr<webrtc::IceCandidateInterface> native_candidate( |
266 mock_dependency_factory_->CreateIceCandidate(candidate_label, | 267 mock_dependency_factory_->CreateIceCandidate(candidate_label, |
267 candidate_sdp)); | 268 sdp_mline_index, |
269 candidate_sdp)); | |
268 pc_handler_->OnIceCandidate(native_candidate.get()); | 270 pc_handler_->OnIceCandidate(native_candidate.get()); |
269 EXPECT_EQ(candidate_label, mock_client_->candidate_label()); | 271 EXPECT_EQ(candidate_label, mock_client_->candidate_label()); |
270 EXPECT_EQ(candidate_sdp, mock_client_->candidate_sdp()); | 272 EXPECT_EQ(candidate_sdp, mock_client_->candidate_sdp()); |
271 EXPECT_TRUE(mock_client_->more_to_follow()); | 273 EXPECT_TRUE(mock_client_->more_to_follow()); |
272 | 274 |
273 // On ICE complete. | 275 // On ICE complete. |
274 pc_handler_->OnIceComplete(); | 276 pc_handler_->OnIceComplete(); |
275 EXPECT_TRUE(mock_client_->candidate_label().empty()); | 277 EXPECT_TRUE(mock_client_->candidate_label().empty()); |
276 EXPECT_TRUE(mock_client_->candidate_sdp().empty()); | 278 EXPECT_TRUE(mock_client_->candidate_sdp().empty()); |
277 EXPECT_FALSE(mock_client_->more_to_follow()); | 279 EXPECT_FALSE(mock_client_->more_to_follow()); |
(...skipping 23 matching lines...) Expand all Loading... | |
301 talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream_2( | 303 talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream_2( |
302 AddRemoteMockMediaStream(stream_label_2, video_track_label_2, | 304 AddRemoteMockMediaStream(stream_label_2, video_track_label_2, |
303 audio_track_label_2)); | 305 audio_track_label_2)); |
304 | 306 |
305 pc_handler_->OnAddStream(stream_1); | 307 pc_handler_->OnAddStream(stream_1); |
306 EXPECT_EQ(stream_label_1, mock_client_->stream_label()); | 308 EXPECT_EQ(stream_label_1, mock_client_->stream_label()); |
307 | 309 |
308 pc_handler_->OnAddStream(stream_2); | 310 pc_handler_->OnAddStream(stream_2); |
309 EXPECT_EQ(stream_label_2, mock_client_->stream_label()); | 311 EXPECT_EQ(stream_label_2, mock_client_->stream_label()); |
310 } | 312 } |
OLD | NEW |