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 "content/renderer/media/mock_media_stream_impl.h" | 5 #include "content/renderer/media/mock_media_stream_impl.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "content/renderer/media/rtc_video_decoder.h" | 9 #include "content/renderer/media/rtc_video_decoder.h" |
8 | 10 |
9 MockMediaStreamImpl::MockMediaStreamImpl() | 11 MockMediaStreamImpl::MockMediaStreamImpl() |
10 : MediaStreamImpl(NULL, NULL, NULL, NULL) { | 12 : MediaStreamImpl(NULL, NULL, NULL, NULL) { |
11 } | 13 } |
12 | 14 |
13 MockMediaStreamImpl::~MockMediaStreamImpl() {} | 15 MockMediaStreamImpl::~MockMediaStreamImpl() {} |
14 | 16 |
15 WebKit::WebPeerConnectionHandler* | 17 WebKit::WebPeerConnectionHandler* |
16 MockMediaStreamImpl::CreatePeerConnectionHandler( | 18 MockMediaStreamImpl::CreatePeerConnectionHandler( |
17 WebKit::WebPeerConnectionHandlerClient* client) { | 19 WebKit::WebPeerConnectionHandlerClient* client) { |
18 NOTIMPLEMENTED(); | 20 NOTIMPLEMENTED(); |
19 return NULL; | 21 return NULL; |
20 } | 22 } |
21 | 23 |
22 void MockMediaStreamImpl::ClosePeerConnection() { | 24 void MockMediaStreamImpl::ClosePeerConnection() { |
23 video_label_.clear(); | 25 get_track_label_.clear(); |
24 } | 26 } |
25 | 27 |
26 bool MockMediaStreamImpl::SetVideoCaptureModule(const std::string& label) { | 28 webrtc::MediaStreamTrackInterface* |
27 video_label_ = label; | 29 MockMediaStreamImpl::GetLocalMediaStreamTrack(std::string label) { |
28 return true; | 30 MockMediaStreamTrackPtrMap::iterator it = mock_local_tracks_.find(label); |
| 31 if (it == mock_local_tracks_.end()) |
| 32 return NULL; |
| 33 webrtc::MediaStreamTrackInterface* stream = it->second; |
| 34 return stream; |
29 } | 35 } |
30 | 36 |
31 scoped_refptr<media::VideoDecoder> MockMediaStreamImpl::GetVideoDecoder( | 37 scoped_refptr<media::VideoDecoder> MockMediaStreamImpl::GetVideoDecoder( |
32 const GURL& url, | 38 const GURL& url, |
33 media::MessageLoopFactory* message_loop_factory) { | 39 media::MessageLoopFactory* message_loop_factory) { |
34 NOTIMPLEMENTED(); | 40 NOTIMPLEMENTED(); |
35 return NULL; | 41 return NULL; |
36 } | 42 } |
37 | 43 |
38 void MockMediaStreamImpl::OnStreamGenerated( | 44 void MockMediaStreamImpl::OnStreamGenerated( |
(...skipping 12 matching lines...) Expand all Loading... |
51 const std::string& label, | 57 const std::string& label, |
52 int index) { | 58 int index) { |
53 NOTIMPLEMENTED(); | 59 NOTIMPLEMENTED(); |
54 } | 60 } |
55 | 61 |
56 void MockMediaStreamImpl::OnAudioDeviceFailed( | 62 void MockMediaStreamImpl::OnAudioDeviceFailed( |
57 const std::string& label, | 63 const std::string& label, |
58 int index) { | 64 int index) { |
59 NOTIMPLEMENTED(); | 65 NOTIMPLEMENTED(); |
60 } | 66 } |
| 67 |
| 68 void MockMediaStreamImpl::AddTrack( |
| 69 std::string label, |
| 70 webrtc::MediaStreamTrackInterface* track) { |
| 71 mock_local_tracks_.insert( |
| 72 std::pair<std::string, webrtc::MediaStreamTrackInterface*>(label, track)); |
| 73 } |
OLD | NEW |