OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/test_runner/mock_webrtc_peer_connection_handler.h" | 5 #include "components/test_runner/mock_webrtc_peer_connection_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "components/test_runner/mock_constraints.h" | |
10 #include "components/test_runner/mock_webrtc_data_channel_handler.h" | 9 #include "components/test_runner/mock_webrtc_data_channel_handler.h" |
11 #include "components/test_runner/mock_webrtc_dtmf_sender_handler.h" | 10 #include "components/test_runner/mock_webrtc_dtmf_sender_handler.h" |
12 #include "components/test_runner/test_interfaces.h" | 11 #include "components/test_runner/test_interfaces.h" |
13 #include "components/test_runner/web_test_delegate.h" | 12 #include "components/test_runner/web_test_delegate.h" |
14 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 13 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
15 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 14 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
16 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
17 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h" | 16 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h" |
18 #include "third_party/WebKit/public/platform/WebRTCOfferOptions.h" | 17 #include "third_party/WebKit/public/platform/WebRTCOfferOptions.h" |
19 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandlerClient.h
" | 18 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandlerClient.h
" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 TestInterfaces* interfaces) | 157 TestInterfaces* interfaces) |
159 : client_(client), | 158 : client_(client), |
160 stopped_(false), | 159 stopped_(false), |
161 stream_count_(0), | 160 stream_count_(0), |
162 interfaces_(interfaces) { | 161 interfaces_(interfaces) { |
163 } | 162 } |
164 | 163 |
165 bool MockWebRTCPeerConnectionHandler::initialize( | 164 bool MockWebRTCPeerConnectionHandler::initialize( |
166 const WebRTCConfiguration& configuration, | 165 const WebRTCConfiguration& configuration, |
167 const WebMediaConstraints& constraints) { | 166 const WebMediaConstraints& constraints) { |
168 if (MockConstraints::VerifyConstraints(constraints)) { | 167 interfaces_->GetDelegate()->PostTask(new RTCPeerConnectionStateTask( |
169 interfaces_->GetDelegate()->PostTask(new RTCPeerConnectionStateTask( | 168 this, |
170 this, | 169 client_, |
171 client_, | 170 WebRTCPeerConnectionHandlerClient::ICEConnectionStateCompleted, |
172 WebRTCPeerConnectionHandlerClient::ICEConnectionStateCompleted, | 171 WebRTCPeerConnectionHandlerClient::ICEGatheringStateComplete)); |
173 WebRTCPeerConnectionHandlerClient::ICEGatheringStateComplete)); | 172 return true; |
174 return true; | |
175 } | |
176 | |
177 return false; | |
178 } | 173 } |
179 | 174 |
180 void MockWebRTCPeerConnectionHandler::createOffer( | 175 void MockWebRTCPeerConnectionHandler::createOffer( |
181 const WebRTCSessionDescriptionRequest& request, | 176 const WebRTCSessionDescriptionRequest& request, |
182 const WebMediaConstraints& constraints) { | 177 const WebMediaConstraints& constraints) { |
183 interfaces_->GetDelegate()->PostTask( | 178 interfaces_->GetDelegate()->PostTask( |
184 new RTCSessionDescriptionRequestFailedTask(this, request)); | 179 new RTCSessionDescriptionRequestFailedTask(this, request)); |
185 } | 180 } |
186 | 181 |
187 void MockWebRTCPeerConnectionHandler::createOffer( | 182 void MockWebRTCPeerConnectionHandler::createOffer( |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 const WebMediaStreamTrack& track) { | 398 const WebMediaStreamTrack& track) { |
404 return new MockWebRTCDTMFSenderHandler(track, interfaces_->GetDelegate()); | 399 return new MockWebRTCDTMFSenderHandler(track, interfaces_->GetDelegate()); |
405 } | 400 } |
406 | 401 |
407 void MockWebRTCPeerConnectionHandler::stop() { | 402 void MockWebRTCPeerConnectionHandler::stop() { |
408 stopped_ = true; | 403 stopped_ = true; |
409 task_list_.RevokeAll(); | 404 task_list_.RevokeAll(); |
410 } | 405 } |
411 | 406 |
412 } // namespace test_runner | 407 } // namespace test_runner |
OLD | NEW |