| 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 #include "content/renderer/media/mock_web_rtc_peer_connection_handler_client.h" | 4 #include "content/renderer/media/mock_web_rtc_peer_connection_handler_client.h" |
| 5 | 5 |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" | 8 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" |
| 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 MockWebRTCPeerConnectionHandlerClient:: | 13 MockWebRTCPeerConnectionHandlerClient:: |
| 14 MockWebRTCPeerConnectionHandlerClient() | 14 MockWebRTCPeerConnectionHandlerClient() |
| 15 : renegotiate_(false), | 15 : renegotiate_(false), |
| 16 signaling_state_(SignalingStateStable), | 16 signaling_state_(SignalingStateStable), |
| 17 ice_state_(ICEStateNew), | 17 ice_connection_state_(ICEConnectionStateStarting), |
| 18 ice_gathering_state_(ICEGatheringStateNew), |
| 18 candidate_mline_index_(-1) { | 19 candidate_mline_index_(-1) { |
| 19 } | 20 } |
| 20 | 21 |
| 21 MockWebRTCPeerConnectionHandlerClient:: | 22 MockWebRTCPeerConnectionHandlerClient:: |
| 22 ~MockWebRTCPeerConnectionHandlerClient() {} | 23 ~MockWebRTCPeerConnectionHandlerClient() {} |
| 23 | 24 |
| 24 void MockWebRTCPeerConnectionHandlerClient::negotiationNeeded() { | 25 void MockWebRTCPeerConnectionHandlerClient::negotiationNeeded() { |
| 25 renegotiate_ = true; | 26 renegotiate_ = true; |
| 26 } | 27 } |
| 27 | 28 |
| 28 void MockWebRTCPeerConnectionHandlerClient::didGenerateICECandidate( | 29 void MockWebRTCPeerConnectionHandlerClient::didGenerateICECandidate( |
| 29 const WebKit::WebRTCICECandidate& candidate) { | 30 const WebKit::WebRTCICECandidate& candidate) { |
| 30 if (!candidate.isNull()) { | 31 if (!candidate.isNull()) { |
| 31 candidate_sdp_ = UTF16ToUTF8(candidate.candidate()); | 32 candidate_sdp_ = UTF16ToUTF8(candidate.candidate()); |
| 32 candidate_mline_index_ = candidate.sdpMLineIndex(); | 33 candidate_mline_index_ = candidate.sdpMLineIndex(); |
| 33 candidate_mid_ = UTF16ToUTF8(candidate.sdpMid()); | 34 candidate_mid_ = UTF16ToUTF8(candidate.sdpMid()); |
| 34 } else { | 35 } else { |
| 35 candidate_sdp_ = ""; | 36 candidate_sdp_ = ""; |
| 36 candidate_mline_index_ = -1; | 37 candidate_mline_index_ = -1; |
| 37 candidate_mid_ = ""; | 38 candidate_mid_ = ""; |
| 38 } | 39 } |
| 39 } | 40 } |
| 40 | 41 |
| 41 void MockWebRTCPeerConnectionHandlerClient::didChangeSignalingState( | 42 void MockWebRTCPeerConnectionHandlerClient::didChangeSignalingState( |
| 42 SignalingState state) { | 43 SignalingState state) { |
| 43 signaling_state_ = state; | 44 signaling_state_ = state; |
| 44 } | 45 } |
| 45 | 46 |
| 46 void MockWebRTCPeerConnectionHandlerClient::didChangeICEState(ICEState state) { | 47 |
| 47 ice_state_ = state; | 48 void MockWebRTCPeerConnectionHandlerClient::didChangeICEConnectionState( |
| 49 ICEConnectionState state) { |
| 50 ice_connection_state_ = state; |
| 51 } |
| 52 |
| 53 void MockWebRTCPeerConnectionHandlerClient::didChangeICEGatheringState( |
| 54 ICEGatheringState state) { |
| 55 ice_gathering_state_ = state; |
| 48 } | 56 } |
| 49 | 57 |
| 50 void MockWebRTCPeerConnectionHandlerClient::didAddRemoteStream( | 58 void MockWebRTCPeerConnectionHandlerClient::didAddRemoteStream( |
| 51 const WebKit::WebMediaStream& stream_descriptor) { | 59 const WebKit::WebMediaStream& stream_descriptor) { |
| 52 stream_label_ = UTF16ToUTF8(stream_descriptor.label()); | 60 stream_label_ = UTF16ToUTF8(stream_descriptor.label()); |
| 53 } | 61 } |
| 54 | 62 |
| 55 void MockWebRTCPeerConnectionHandlerClient::didRemoveRemoteStream( | 63 void MockWebRTCPeerConnectionHandlerClient::didRemoveRemoteStream( |
| 56 const WebKit::WebMediaStream& stream_descriptor) { | 64 const WebKit::WebMediaStream& stream_descriptor) { |
| 57 DCHECK(stream_label_ == UTF16ToUTF8(stream_descriptor.label())); | 65 DCHECK(stream_label_ == UTF16ToUTF8(stream_descriptor.label())); |
| 58 stream_label_.clear(); | 66 stream_label_.clear(); |
| 59 } | 67 } |
| 60 | 68 |
| 61 } // namespace content | 69 } // namespace content |
| OLD | NEW |