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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 EXPECT_TRUE(mock_peer_connection_->sdp_mid().empty()); | 218 EXPECT_TRUE(mock_peer_connection_->sdp_mid().empty()); |
219 EXPECT_EQ(UTF16ToUTF8(sdp), mock_peer_connection_->ice_sdp()); | 219 EXPECT_EQ(UTF16ToUTF8(sdp), mock_peer_connection_->ice_sdp()); |
220 | 220 |
221 // Add stream. | 221 // Add stream. |
222 std::string stream_label = "local_stream"; | 222 std::string stream_label = "local_stream"; |
223 WebKit::WebMediaStreamDescriptor local_stream( | 223 WebKit::WebMediaStreamDescriptor local_stream( |
224 CreateLocalMediaStream(stream_label)); | 224 CreateLocalMediaStream(stream_label)); |
225 | 225 |
226 pc_handler_->addStream(local_stream); | 226 pc_handler_->addStream(local_stream); |
227 EXPECT_EQ(stream_label, mock_peer_connection_->stream_label()); | 227 EXPECT_EQ(stream_label, mock_peer_connection_->stream_label()); |
228 EXPECT_TRUE(mock_peer_connection_->stream_changes_committed()); | |
229 | 228 |
230 // On add stream. ( Remote stream received) | 229 // On add stream. ( Remote stream received) |
231 std::string remote_stream_label("remote_stream"); | 230 std::string remote_stream_label("remote_stream"); |
232 talk_base::scoped_refptr<webrtc::MediaStreamInterface> remote_stream( | 231 talk_base::scoped_refptr<webrtc::MediaStreamInterface> remote_stream( |
233 AddRemoteMockMediaStream(remote_stream_label, "video", "audio")); | 232 AddRemoteMockMediaStream(remote_stream_label, "video", "audio")); |
234 pc_handler_->OnAddStream(remote_stream); | 233 pc_handler_->OnAddStream(remote_stream); |
235 EXPECT_EQ(remote_stream_label, mock_client_->stream_label()); | 234 EXPECT_EQ(remote_stream_label, mock_client_->stream_label()); |
236 | 235 |
237 // Remove stream. | 236 // Remove stream. |
238 WebKit::WebVector<WebKit::WebMediaStreamDescriptor> empty_streams( | 237 WebKit::WebVector<WebKit::WebMediaStreamDescriptor> empty_streams( |
239 static_cast<size_t>(0)); | 238 static_cast<size_t>(0)); |
240 pc_handler_->removeStream(local_stream); | 239 pc_handler_->removeStream(local_stream); |
241 EXPECT_EQ("", mock_peer_connection_->stream_label()); | 240 EXPECT_EQ("", mock_peer_connection_->stream_label()); |
242 mock_peer_connection_->ClearStreamChangesCommitted(); | |
243 EXPECT_TRUE(!mock_peer_connection_->stream_changes_committed()); | |
244 | 241 |
245 // On remove stream. | 242 // On remove stream. |
246 pc_handler_->OnRemoveStream(remote_stream); | 243 pc_handler_->OnRemoveStream(remote_stream); |
247 EXPECT_TRUE(mock_client_->stream_label().empty()); | 244 EXPECT_TRUE(mock_client_->stream_label().empty()); |
248 | 245 |
249 // Add stream again. | 246 // Add stream again. |
250 pc_handler_->addStream(local_stream); | 247 pc_handler_->addStream(local_stream); |
251 EXPECT_EQ(stream_label, mock_peer_connection_->stream_label()); | 248 EXPECT_EQ(stream_label, mock_peer_connection_->stream_label()); |
252 EXPECT_TRUE(mock_peer_connection_->stream_changes_committed()); | |
253 | 249 |
254 // On state change. | 250 // On state change. |
255 mock_peer_connection_->SetReadyState( | 251 mock_peer_connection_->SetReadyState( |
256 webrtc::PeerConnectionInterface::kActive); | 252 webrtc::PeerConnectionInterface::kActive); |
257 webrtc::PeerConnectionObserver::StateType state = | 253 webrtc::PeerConnectionObserver::StateType state = |
258 webrtc::PeerConnectionObserver::kReadyState; | 254 webrtc::PeerConnectionObserver::kReadyState; |
259 pc_handler_->OnStateChange(state); | 255 pc_handler_->OnStateChange(state); |
260 EXPECT_EQ(WebKit::WebPeerConnection00HandlerClient::ReadyStateActive, | 256 EXPECT_EQ(WebKit::WebPeerConnection00HandlerClient::ReadyStateActive, |
261 mock_client_->ready_state()); | 257 mock_client_->ready_state()); |
262 | 258 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream_2( | 300 talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream_2( |
305 AddRemoteMockMediaStream(stream_label_2, video_track_label_2, | 301 AddRemoteMockMediaStream(stream_label_2, video_track_label_2, |
306 audio_track_label_2)); | 302 audio_track_label_2)); |
307 | 303 |
308 pc_handler_->OnAddStream(stream_1); | 304 pc_handler_->OnAddStream(stream_1); |
309 EXPECT_EQ(stream_label_1, mock_client_->stream_label()); | 305 EXPECT_EQ(stream_label_1, mock_client_->stream_label()); |
310 | 306 |
311 pc_handler_->OnAddStream(stream_2); | 307 pc_handler_->OnAddStream(stream_2); |
312 EXPECT_EQ(stream_label_2, mock_client_->stream_label()); | 308 EXPECT_EQ(stream_label_2, mock_client_->stream_label()); |
313 } | 309 } |
OLD | NEW |