| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 WebKit::WebMediaStreamSource::TypeAudio, | 81 WebKit::WebMediaStreamSource::TypeAudio, |
| 82 WebKit::WebString::fromUTF8("audio_track")); | 82 WebKit::WebString::fromUTF8("audio_track")); |
| 83 WebKit::WebVector<WebKit::WebMediaStreamSource> video_sources( | 83 WebKit::WebVector<WebKit::WebMediaStreamSource> video_sources( |
| 84 static_cast<size_t>(1)); | 84 static_cast<size_t>(1)); |
| 85 video_sources[0].initialize(WebKit::WebString::fromUTF8(video_track_label), | 85 video_sources[0].initialize(WebKit::WebString::fromUTF8(video_track_label), |
| 86 WebKit::WebMediaStreamSource::TypeVideo, | 86 WebKit::WebMediaStreamSource::TypeVideo, |
| 87 WebKit::WebString::fromUTF8("video_track")); | 87 WebKit::WebString::fromUTF8("video_track")); |
| 88 WebKit::WebMediaStreamDescriptor local_stream; | 88 WebKit::WebMediaStreamDescriptor local_stream; |
| 89 local_stream.initialize(UTF8ToUTF16(stream_label), audio_sources, | 89 local_stream.initialize(UTF8ToUTF16(stream_label), audio_sources, |
| 90 video_sources); | 90 video_sources); |
| 91 local_stream.setExtraData(new MediaStreamExtraData(native_stream)); | 91 local_stream.setExtraData(new content::MediaStreamExtraData(native_stream)); |
| 92 return local_stream; | 92 return local_stream; |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Creates a remote MediaStream and adds it to the mocked native | 95 // Creates a remote MediaStream and adds it to the mocked native |
| 96 // peer connection. | 96 // peer connection. |
| 97 talk_base::scoped_refptr<webrtc::MediaStreamInterface> | 97 talk_base::scoped_refptr<webrtc::MediaStreamInterface> |
| 98 AddRemoteMockMediaStream(const std::string& stream_label, | 98 AddRemoteMockMediaStream(const std::string& stream_label, |
| 99 const std::string& video_track_label, | 99 const std::string& video_track_label, |
| 100 const std::string& audio_track_label) { | 100 const std::string& audio_track_label) { |
| 101 // We use a local stream as a remote since for testing purposes we really | 101 // We use a local stream as a remote since for testing purposes we really |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream_2( | 297 talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream_2( |
| 298 AddRemoteMockMediaStream(stream_label_2, video_track_label_2, | 298 AddRemoteMockMediaStream(stream_label_2, video_track_label_2, |
| 299 audio_track_label_2)); | 299 audio_track_label_2)); |
| 300 | 300 |
| 301 pc_handler_->OnAddStream(stream_1); | 301 pc_handler_->OnAddStream(stream_1); |
| 302 EXPECT_EQ(stream_label_1, mock_client_->stream_label()); | 302 EXPECT_EQ(stream_label_1, mock_client_->stream_label()); |
| 303 | 303 |
| 304 pc_handler_->OnAddStream(stream_2); | 304 pc_handler_->OnAddStream(stream_2); |
| 305 EXPECT_EQ(stream_label_2, mock_client_->stream_label()); | 305 EXPECT_EQ(stream_label_2, mock_client_->stream_label()); |
| 306 } | 306 } |
| OLD | NEW |