OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_registry.h" | 5 #include "content/renderer/media/mock_media_stream_registry.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 10 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 void MockMediaStreamRegistry::Init(const std::string& stream_url) { | 25 void MockMediaStreamRegistry::Init(const std::string& stream_url) { |
26 stream_url_ = stream_url; | 26 stream_url_ = stream_url; |
27 scoped_refptr<webrtc::MediaStreamInterface> stream( | 27 scoped_refptr<webrtc::MediaStreamInterface> stream( |
28 factory_->CreateLocalMediaStream(kTestStreamLabel)); | 28 factory_->CreateLocalMediaStream(kTestStreamLabel)); |
29 WebKit::WebVector<WebKit::WebMediaStreamTrack> webkit_audio_tracks; | 29 WebKit::WebVector<WebKit::WebMediaStreamTrack> webkit_audio_tracks; |
30 WebKit::WebVector<WebKit::WebMediaStreamTrack> webkit_video_tracks; | 30 WebKit::WebVector<WebKit::WebMediaStreamTrack> webkit_video_tracks; |
31 WebKit::WebString webkit_stream_label(UTF8ToUTF16(stream->label())); | 31 WebKit::WebString webkit_stream_label(UTF8ToUTF16(stream->label())); |
32 test_stream_.initialize(webkit_stream_label, | 32 test_stream_.initialize(webkit_stream_label, |
33 webkit_audio_tracks, webkit_video_tracks); | 33 webkit_audio_tracks, webkit_video_tracks); |
34 test_stream_.setExtraData(new MediaStreamExtraData(stream, false)); | 34 test_stream_.setExtraData(new MediaStreamExtraData(stream.get(), false)); |
35 } | 35 } |
36 | 36 |
37 bool MockMediaStreamRegistry::AddVideoTrack(const std::string& track_id) { | 37 bool MockMediaStreamRegistry::AddVideoTrack(const std::string& track_id) { |
38 cricket::VideoCapturer* capturer = NULL; | 38 cricket::VideoCapturer* capturer = NULL; |
39 return factory_->AddNativeVideoMediaTrack(track_id, &test_stream_, capturer); | 39 return factory_->AddNativeVideoMediaTrack(track_id, &test_stream_, capturer); |
40 } | 40 } |
41 | 41 |
42 WebKit::WebMediaStream MockMediaStreamRegistry::GetMediaStream( | 42 WebKit::WebMediaStream MockMediaStreamRegistry::GetMediaStream( |
43 const std::string& url) { | 43 const std::string& url) { |
44 if (url != stream_url_) { | 44 if (url != stream_url_) { |
45 return WebKit::WebMediaStream(); | 45 return WebKit::WebMediaStream(); |
46 } | 46 } |
47 return test_stream_; | 47 return test_stream_; |
48 } | 48 } |
49 | 49 |
50 const WebKit::WebMediaStream MockMediaStreamRegistry::test_stream() const { | 50 const WebKit::WebMediaStream MockMediaStreamRegistry::test_stream() const { |
51 return test_stream_; | 51 return test_stream_; |
52 } | 52 } |
53 | 53 |
54 } // namespace content | 54 } // namespace content |
OLD | NEW |