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_peer_connection_impl.h" | 5 #include "content/renderer/media/mock_peer_connection_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace webrtc { | 9 namespace webrtc { |
10 | 10 |
11 MockPeerConnectionImpl::MockPeerConnectionImpl() | 11 MockPeerConnectionImpl::MockPeerConnectionImpl() |
12 : observer_(NULL), | 12 : stream_changes_committed_(false) { |
13 video_stream_(false), | |
14 connected_(false), | |
15 video_capture_set_(false) { | |
16 } | 13 } |
17 | 14 |
18 MockPeerConnectionImpl::~MockPeerConnectionImpl() {} | 15 MockPeerConnectionImpl::~MockPeerConnectionImpl() {} |
19 | 16 |
20 void MockPeerConnectionImpl::RegisterObserver( | 17 void MockPeerConnectionImpl::ProcessSignalingMessage(const std::string& msg) { |
21 PeerConnectionObserver* observer) { | 18 signaling_message_ = msg; |
22 observer_ = observer; | |
23 } | 19 } |
24 | 20 |
25 bool MockPeerConnectionImpl::SignalingMessage( | 21 bool MockPeerConnectionImpl::Send(const std::string& msg) { |
26 const std::string& signaling_message) { | |
27 signaling_message_ = signaling_message; | |
28 return true; | |
29 } | |
30 | |
31 bool MockPeerConnectionImpl::AddStream( | |
32 const std::string& stream_id, | |
33 bool video) { | |
34 stream_id_ = stream_id; | |
35 video_stream_ = video; | |
36 return true; | |
37 } | |
38 | |
39 bool MockPeerConnectionImpl::RemoveStream(const std::string& stream_id) { | |
40 stream_id_.clear(); | |
41 video_stream_ = false; | |
42 return true; | |
43 } | |
44 | |
45 bool MockPeerConnectionImpl::Connect() { | |
46 connected_ = true; | |
47 return true; | |
48 } | |
49 | |
50 bool MockPeerConnectionImpl::Close() { | |
51 observer_ = NULL; | |
52 signaling_message_.clear(); | |
53 stream_id_.clear(); | |
54 video_stream_ = false; | |
55 connected_ = false; | |
56 video_capture_set_ = false; | |
57 return true; | |
58 } | |
59 | |
60 bool MockPeerConnectionImpl::SetAudioDevice( | |
61 const std::string& wave_in_device, | |
62 const std::string& wave_out_device, | |
63 int opts) { | |
64 NOTIMPLEMENTED(); | 22 NOTIMPLEMENTED(); |
65 return false; | 23 return false; |
66 } | 24 } |
67 | 25 |
68 bool MockPeerConnectionImpl::SetLocalVideoRenderer( | 26 talk_base::scoped_refptr<StreamCollectionInterface> local_streams() { |
69 cricket::VideoRenderer* renderer) { | |
70 NOTIMPLEMENTED(); | 27 NOTIMPLEMENTED(); |
71 return false; | 28 return NULL; |
72 } | 29 } |
73 | 30 |
74 bool MockPeerConnectionImpl::SetVideoRenderer( | 31 talk_base::scoped_refptr<StreamCollectionInterface> remote_streams() { |
75 const std::string& stream_id, | 32 NOTIMPLEMENTED(); |
76 cricket::VideoRenderer* renderer) { | 33 return NULL; |
77 video_renderer_stream_id_ = stream_id; | |
78 return true; | |
79 } | 34 } |
80 | 35 |
81 bool MockPeerConnectionImpl::SetVideoCapture(const std::string& cam_device) { | 36 void MockPeerConnectionImpl::AddStream(LocalMediaStreamInterface* stream) { |
82 video_capture_set_ = true; | 37 stream_label_ = stream->label(); |
83 return true; | |
84 } | 38 } |
85 | 39 |
86 MockPeerConnectionImpl::ReadyState MockPeerConnectionImpl::GetReadyState() { | 40 void MockPeerConnectionImpl::RemoveStream(LocalMediaStreamInterface* stream) { |
| 41 stream_label_.clear(); |
| 42 } |
| 43 |
| 44 void MockPeerConnectionImpl::CommitStreamChanges() { |
| 45 stream_changes_committed_ = true; |
| 46 } |
| 47 |
| 48 void MockPeerConnectionImpl::Close() { |
| 49 signaling_message_.clear(); |
| 50 stream_label_.clear(); |
| 51 stream_changes_committed_ = false; |
| 52 } |
| 53 |
| 54 MockPeerConnectionImpl::ReadyState MockPeerConnectionImpl::ready_state() { |
87 NOTIMPLEMENTED(); | 55 NOTIMPLEMENTED(); |
88 return NEW; | 56 return kNew; |
| 57 } |
| 58 |
| 59 MockPeerConnectionImpl::SdpState MockPeerConnectionImpl::sdp_state() { |
| 60 NOTIMPLEMENTED(); |
| 61 return kSdpNew; |
89 } | 62 } |
90 | 63 |
91 } // namespace webrtc | 64 } // namespace webrtc |
OLD | NEW |