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 "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void MockWebRTCPeerConnectionHandler::PostRequestFailure( | 93 void MockWebRTCPeerConnectionHandler::PostRequestFailure( |
94 const WebRTCVoidRequest& request) { | 94 const WebRTCVoidRequest& request) { |
95 interfaces_->GetDelegate()->PostTask(new WebCallbackTask(base::Bind( | 95 interfaces_->GetDelegate()->PostTask(new WebCallbackTask(base::Bind( |
96 &WebRTCVoidRequest::requestFailed, | 96 &WebRTCVoidRequest::requestFailed, |
97 base::Owned(new WebRTCVoidRequest(request)), WebString("TEST_ERROR")))); | 97 base::Owned(new WebRTCVoidRequest(request)), WebString("TEST_ERROR")))); |
98 } | 98 } |
99 | 99 |
100 void MockWebRTCPeerConnectionHandler::createOffer( | 100 void MockWebRTCPeerConnectionHandler::createOffer( |
101 const WebRTCSessionDescriptionRequest& request, | 101 const WebRTCSessionDescriptionRequest& request, |
102 const blink::WebRTCOfferOptions& options) { | 102 const blink::WebRTCOfferOptions& options) { |
103 if (options.iceRestart() && options.voiceActivityDetection()) { | 103 if (options.iceRestart() && options.voiceActivityDetection() && |
| 104 options.offerToReceiveAudio() > 0 && options.offerToReceiveVideo() > 0) { |
104 WebRTCSessionDescription session_description; | 105 WebRTCSessionDescription session_description; |
105 session_description.initialize("offer", "local"); | 106 session_description.initialize("offer", "local"); |
106 PostRequestResult(request, session_description); | 107 PostRequestResult(request, session_description); |
107 } else { | 108 } else { |
108 PostRequestFailure(request); | 109 PostRequestFailure(request); |
109 } | 110 } |
110 } | 111 } |
111 | 112 |
112 void MockWebRTCPeerConnectionHandler::createAnswer( | 113 void MockWebRTCPeerConnectionHandler::createAnswer( |
113 const WebRTCSessionDescriptionRequest& request, | 114 const WebRTCSessionDescriptionRequest& request, |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 const WebMediaStreamTrack& track) { | 333 const WebMediaStreamTrack& track) { |
333 return new MockWebRTCDTMFSenderHandler(track, interfaces_->GetDelegate()); | 334 return new MockWebRTCDTMFSenderHandler(track, interfaces_->GetDelegate()); |
334 } | 335 } |
335 | 336 |
336 void MockWebRTCPeerConnectionHandler::stop() { | 337 void MockWebRTCPeerConnectionHandler::stop() { |
337 stopped_ = true; | 338 stopped_ = true; |
338 weak_factory_.InvalidateWeakPtrs(); | 339 weak_factory_.InvalidateWeakPtrs(); |
339 } | 340 } |
340 | 341 |
341 } // namespace test_runner | 342 } // namespace test_runner |
OLD | NEW |