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