OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 #include "content/renderer/media/mock_web_rtc_peer_connection_handler_client.h" | |
5 | |
6 #include "base/logging.h" | |
7 #include "base/utf_string_conversions.h" | |
8 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICECandid ateDescriptor.h" | |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h" | |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | |
11 | |
12 namespace WebKit { | |
13 | |
14 MockWebRTCPeerConnectionHandlerClient:: | |
15 MockWebRTCPeerConnectionHandlerClient() | |
16 : renegotiate_(false), | |
17 ready_state_(ReadyStateNew), | |
18 ice_state_(ICEStateNew), | |
19 candidate_mline_index_(-1) { | |
20 } | |
21 | |
22 MockWebRTCPeerConnectionHandlerClient:: | |
23 ~MockWebRTCPeerConnectionHandlerClient() {} | |
24 | |
25 void MockWebRTCPeerConnectionHandlerClient::doRenegotiate() { | |
26 renegotiate_ = true; | |
27 } | |
28 | |
29 void MockWebRTCPeerConnectionHandlerClient::didGenerateICECandidate( | |
30 const WebRTCICECandidateDescriptor& candidate) { | |
31 if (!candidate.isNull()) { | |
32 candidate_sdp_ = UTF16ToUTF8(candidate.candidate()); | |
33 candidate_mline_index_ = candidate.sdpMLineIndex(); | |
34 candidate_mid_ = UTF16ToUTF8(candidate.sdpMid()); | |
35 } else { | |
36 candidate_sdp_ = ""; | |
37 candidate_mline_index_ = 0; | |
Ronghua Wu (Left Chromium)
2012/08/14 00:59:03
-1? 0 is a valid value.
perkj_chrome
2012/08/14 09:15:40
Done.
| |
38 candidate_mid_ = ""; | |
39 } | |
40 } | |
41 | |
42 void MockWebRTCPeerConnectionHandlerClient::didChangeReadyState( | |
43 ReadyState state) { | |
44 ready_state_ = state; | |
45 } | |
46 | |
47 void MockWebRTCPeerConnectionHandlerClient::didChangeICEState(ICEState state) { | |
48 ice_state_ = state; | |
49 } | |
50 | |
51 void MockWebRTCPeerConnectionHandlerClient::didAddRemoteStream( | |
52 const WebMediaStreamDescriptor& stream_descriptor) { | |
53 stream_label_ = UTF16ToUTF8(stream_descriptor.label()); | |
54 } | |
55 | |
56 void MockWebRTCPeerConnectionHandlerClient::didRemoveRemoteStream( | |
57 const WebMediaStreamDescriptor& stream_descriptor) { | |
58 DCHECK(stream_label_ == UTF16ToUTF8(stream_descriptor.label())); | |
59 stream_label_.clear(); | |
60 } | |
61 | |
62 } // namespace WebKit | |
OLD | NEW |