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_dependency_factory.h" | |
6 #include "content/renderer/media/mock_peer_connection_impl.h" | 5 #include "content/renderer/media/mock_peer_connection_impl.h" |
7 | 6 |
8 #include <vector> | 7 #include <vector> |
9 | 8 |
10 #include "base/logging.h" | 9 #include "base/logging.h" |
11 | 10 |
12 namespace webrtc { | 11 namespace webrtc { |
13 | 12 |
14 class MockStreamCollection : public StreamCollectionInterface { | 13 class MockStreamCollection : public StreamCollectionInterface { |
15 public: | 14 public: |
(...skipping 14 matching lines...) Expand all Loading... |
30 streams_.push_back(stream); | 29 streams_.push_back(stream); |
31 } | 30 } |
32 | 31 |
33 protected: | 32 protected: |
34 virtual ~MockStreamCollection() {} | 33 virtual ~MockStreamCollection() {} |
35 | 34 |
36 private: | 35 private: |
37 std::vector<talk_base::scoped_refptr<MediaStreamInterface> > streams_; | 36 std::vector<talk_base::scoped_refptr<MediaStreamInterface> > streams_; |
38 }; | 37 }; |
39 | 38 |
40 const char MockPeerConnectionImpl::kDummyOffer[] = "dummy offer"; | 39 MockPeerConnectionImpl::MockPeerConnectionImpl() |
41 | 40 : stream_changes_committed_(false), |
42 MockPeerConnectionImpl::MockPeerConnectionImpl( | |
43 MockMediaStreamDependencyFactory* factory) | |
44 : dependency_factory_(factory), | |
45 stream_changes_committed_(false), | |
46 local_streams_(new talk_base::RefCountedObject<MockStreamCollection>), | 41 local_streams_(new talk_base::RefCountedObject<MockStreamCollection>), |
47 remote_streams_(new talk_base::RefCountedObject<MockStreamCollection>), | 42 remote_streams_(new talk_base::RefCountedObject<MockStreamCollection>) { |
48 hint_audio_(false), | |
49 hint_video_(false), | |
50 action_(kAnswer), | |
51 ice_options_(kOnlyRelay), | |
52 ready_state_(kNew) { | |
53 } | 43 } |
54 | 44 |
55 MockPeerConnectionImpl::~MockPeerConnectionImpl() {} | 45 MockPeerConnectionImpl::~MockPeerConnectionImpl() {} |
56 | 46 |
57 void MockPeerConnectionImpl::ProcessSignalingMessage(const std::string& msg) { | 47 void MockPeerConnectionImpl::ProcessSignalingMessage(const std::string& msg) { |
58 signaling_message_ = msg; | 48 signaling_message_ = msg; |
59 } | 49 } |
60 | 50 |
61 bool MockPeerConnectionImpl::Send(const std::string& msg) { | 51 bool MockPeerConnectionImpl::Send(const std::string& msg) { |
62 NOTIMPLEMENTED(); | 52 NOTIMPLEMENTED(); |
(...skipping 25 matching lines...) Expand all Loading... |
88 stream_changes_committed_ = true; | 78 stream_changes_committed_ = true; |
89 } | 79 } |
90 | 80 |
91 void MockPeerConnectionImpl::Close() { | 81 void MockPeerConnectionImpl::Close() { |
92 signaling_message_.clear(); | 82 signaling_message_.clear(); |
93 stream_label_.clear(); | 83 stream_label_.clear(); |
94 stream_changes_committed_ = false; | 84 stream_changes_committed_ = false; |
95 } | 85 } |
96 | 86 |
97 MockPeerConnectionImpl::ReadyState MockPeerConnectionImpl::ready_state() { | 87 MockPeerConnectionImpl::ReadyState MockPeerConnectionImpl::ready_state() { |
98 return ready_state_; | 88 NOTIMPLEMENTED(); |
| 89 return kNew; |
99 } | 90 } |
100 | 91 |
101 MockPeerConnectionImpl::SdpState MockPeerConnectionImpl::sdp_state() { | 92 MockPeerConnectionImpl::SdpState MockPeerConnectionImpl::sdp_state() { |
102 NOTIMPLEMENTED(); | 93 NOTIMPLEMENTED(); |
103 return kSdpNew; | 94 return kSdpNew; |
104 } | 95 } |
105 | 96 |
106 bool MockPeerConnectionImpl::StartIce(IceOptions options) { | 97 bool MockPeerConnectionImpl::StartIce(IceOptions options) { |
107 ice_options_ = options; | 98 NOTIMPLEMENTED(); |
108 return true; | 99 return false; |
109 } | 100 } |
110 | 101 |
111 webrtc::SessionDescriptionInterface* MockPeerConnectionImpl::CreateOffer( | 102 webrtc::SessionDescriptionInterface* MockPeerConnectionImpl::CreateOffer( |
112 const webrtc::MediaHints& hints) { | 103 const webrtc::MediaHints& hints) { |
113 hint_audio_ = hints.has_audio(); | 104 NOTIMPLEMENTED(); |
114 hint_video_ = hints.has_video(); | 105 return NULL; |
115 return dependency_factory_->CreateSessionDescription(kDummyOffer); | |
116 } | 106 } |
117 | 107 |
118 webrtc::SessionDescriptionInterface* MockPeerConnectionImpl::CreateAnswer( | 108 webrtc::SessionDescriptionInterface* MockPeerConnectionImpl::CreateAnswer( |
119 const webrtc::MediaHints& hints, | 109 const webrtc::MediaHints& hints, |
120 const webrtc::SessionDescriptionInterface* offer) { | 110 const webrtc::SessionDescriptionInterface* offer) { |
121 hint_audio_ = hints.has_audio(); | 111 NOTIMPLEMENTED(); |
122 hint_video_ = hints.has_video(); | 112 return NULL; |
123 offer->ToString(&description_sdp_); | |
124 return dependency_factory_->CreateSessionDescription(description_sdp_); | |
125 } | 113 } |
126 | 114 |
127 bool MockPeerConnectionImpl::SetLocalDescription( | 115 bool MockPeerConnectionImpl::SetLocalDescription( |
128 Action action, | 116 Action action, |
129 webrtc::SessionDescriptionInterface* desc) { | 117 webrtc::SessionDescriptionInterface* desc) { |
130 action_ = action; | 118 NOTIMPLEMENTED(); |
131 return desc->ToString(&description_sdp_); | 119 return false; |
132 } | 120 } |
133 | 121 |
134 bool MockPeerConnectionImpl::SetRemoteDescription( | 122 bool MockPeerConnectionImpl::SetRemoteDescription( |
135 Action action, | 123 Action action, |
136 webrtc::SessionDescriptionInterface* desc) { | 124 webrtc::SessionDescriptionInterface* desc) { |
137 action_ = action; | 125 NOTIMPLEMENTED(); |
138 return desc->ToString(&description_sdp_); | 126 return false; |
139 } | 127 } |
140 | 128 |
141 bool MockPeerConnectionImpl::ProcessIceMessage( | 129 bool MockPeerConnectionImpl::ProcessIceMessage( |
142 const webrtc::IceCandidateInterface* ice_candidate) { | 130 const webrtc::IceCandidateInterface* ice_candidate) { |
143 ice_label_ = ice_candidate->label(); | 131 NOTIMPLEMENTED(); |
144 return ice_candidate->ToString(&ice_sdp_); | 132 return false; |
145 } | 133 } |
146 | 134 |
147 const webrtc::SessionDescriptionInterface* | 135 const webrtc::SessionDescriptionInterface* |
148 MockPeerConnectionImpl::local_description() const { | 136 MockPeerConnectionImpl::local_description() const { |
149 return dependency_factory_->CreateSessionDescription(description_sdp_); | 137 NOTIMPLEMENTED(); |
| 138 return NULL; |
150 } | 139 } |
151 | 140 |
152 const webrtc::SessionDescriptionInterface* | 141 const webrtc::SessionDescriptionInterface* |
153 MockPeerConnectionImpl::remote_description() const { | 142 MockPeerConnectionImpl::remote_description() const { |
154 return dependency_factory_->CreateSessionDescription(description_sdp_); | 143 NOTIMPLEMENTED(); |
| 144 return NULL; |
155 } | 145 } |
156 | 146 |
157 void MockPeerConnectionImpl::AddRemoteStream(MediaStreamInterface* stream) { | 147 void MockPeerConnectionImpl::AddRemoteStream(MediaStreamInterface* stream) { |
158 remote_streams_->AddStream(stream); | 148 remote_streams_->AddStream(stream); |
159 } | 149 } |
160 | 150 |
161 } // namespace webrtc | 151 } // namespace webrtc |
OLD | NEW |