| 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(0, mock_peer_connection_->sdp_mline_index()); |
| 218 EXPECT_TRUE(mock_peer_connection_->sdp_mid().empty()); |
| 218 EXPECT_EQ(UTF16ToUTF8(sdp), mock_peer_connection_->ice_sdp()); | 219 EXPECT_EQ(UTF16ToUTF8(sdp), mock_peer_connection_->ice_sdp()); |
| 219 | 220 |
| 220 // Add stream. | 221 // Add stream. |
| 221 std::string stream_label = "local_stream"; | 222 std::string stream_label = "local_stream"; |
| 222 WebKit::WebMediaStreamDescriptor local_stream( | 223 WebKit::WebMediaStreamDescriptor local_stream( |
| 223 CreateLocalMediaStream(stream_label)); | 224 CreateLocalMediaStream(stream_label)); |
| 224 | 225 |
| 225 pc_handler_->addStream(local_stream); | 226 pc_handler_->addStream(local_stream); |
| 226 EXPECT_EQ(stream_label, mock_peer_connection_->stream_label()); | 227 EXPECT_EQ(stream_label, mock_peer_connection_->stream_label()); |
| 227 EXPECT_TRUE(mock_peer_connection_->stream_changes_committed()); | 228 EXPECT_TRUE(mock_peer_connection_->stream_changes_committed()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 253 // On state change. | 254 // On state change. |
| 254 mock_peer_connection_->SetReadyState( | 255 mock_peer_connection_->SetReadyState( |
| 255 webrtc::PeerConnectionInterface::kActive); | 256 webrtc::PeerConnectionInterface::kActive); |
| 256 webrtc::PeerConnectionObserver::StateType state = | 257 webrtc::PeerConnectionObserver::StateType state = |
| 257 webrtc::PeerConnectionObserver::kReadyState; | 258 webrtc::PeerConnectionObserver::kReadyState; |
| 258 pc_handler_->OnStateChange(state); | 259 pc_handler_->OnStateChange(state); |
| 259 EXPECT_EQ(WebKit::WebPeerConnection00HandlerClient::ReadyStateActive, | 260 EXPECT_EQ(WebKit::WebPeerConnection00HandlerClient::ReadyStateActive, |
| 260 mock_client_->ready_state()); | 261 mock_client_->ready_state()); |
| 261 | 262 |
| 262 // On ICE candidate. | 263 // On ICE candidate. |
| 263 std::string candidate_label = "test label"; | 264 std::string candidate_label = "0"; |
| 264 std::string candidate_sdp = "test sdp"; | 265 std::string candidate_sdp = "test sdp"; |
| 266 int sdp_mline_index = 0; |
| 265 scoped_ptr<webrtc::IceCandidateInterface> native_candidate( | 267 scoped_ptr<webrtc::IceCandidateInterface> native_candidate( |
| 266 mock_dependency_factory_->CreateIceCandidate(candidate_label, | 268 mock_dependency_factory_->CreateIceCandidate(candidate_label, |
| 267 candidate_sdp)); | 269 sdp_mline_index, |
| 270 candidate_sdp)); |
| 268 pc_handler_->OnIceCandidate(native_candidate.get()); | 271 pc_handler_->OnIceCandidate(native_candidate.get()); |
| 269 EXPECT_EQ(candidate_label, mock_client_->candidate_label()); | 272 EXPECT_EQ(candidate_label, mock_client_->candidate_label()); |
| 270 EXPECT_EQ(candidate_sdp, mock_client_->candidate_sdp()); | 273 EXPECT_EQ(candidate_sdp, mock_client_->candidate_sdp()); |
| 271 EXPECT_TRUE(mock_client_->more_to_follow()); | 274 EXPECT_TRUE(mock_client_->more_to_follow()); |
| 272 | 275 |
| 273 // On ICE complete. | 276 // On ICE complete. |
| 274 pc_handler_->OnIceComplete(); | 277 pc_handler_->OnIceComplete(); |
| 275 EXPECT_TRUE(mock_client_->candidate_label().empty()); | 278 EXPECT_TRUE(mock_client_->candidate_label().empty()); |
| 276 EXPECT_TRUE(mock_client_->candidate_sdp().empty()); | 279 EXPECT_TRUE(mock_client_->candidate_sdp().empty()); |
| 277 EXPECT_FALSE(mock_client_->more_to_follow()); | 280 EXPECT_FALSE(mock_client_->more_to_follow()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 301 talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream_2( | 304 talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream_2( |
| 302 AddRemoteMockMediaStream(stream_label_2, video_track_label_2, | 305 AddRemoteMockMediaStream(stream_label_2, video_track_label_2, |
| 303 audio_track_label_2)); | 306 audio_track_label_2)); |
| 304 | 307 |
| 305 pc_handler_->OnAddStream(stream_1); | 308 pc_handler_->OnAddStream(stream_1); |
| 306 EXPECT_EQ(stream_label_1, mock_client_->stream_label()); | 309 EXPECT_EQ(stream_label_1, mock_client_->stream_label()); |
| 307 | 310 |
| 308 pc_handler_->OnAddStream(stream_2); | 311 pc_handler_->OnAddStream(stream_2); |
| 309 EXPECT_EQ(stream_label_2, mock_client_->stream_label()); | 312 EXPECT_EQ(stream_label_2, mock_client_->stream_label()); |
| 310 } | 313 } |
| OLD | NEW |