Make USB permissions work in the new permission message system
[chromium-blink-merge.git] / content / renderer / media / mock_web_rtc_peer_connection_handler_client.cc
blob825a212f42bf24953f8db4628f24da3ef1716eec
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"
6 #include "base/logging.h"
7 #include "base/strings/utf_string_conversions.h"
8 #include "third_party/WebKit/public/platform/WebMediaStream.h"
9 #include "third_party/WebKit/public/platform/WebString.h"
11 using testing::_;
13 namespace content {
15 MockWebRTCPeerConnectionHandlerClient::
16 MockWebRTCPeerConnectionHandlerClient()
17 : candidate_mline_index_(-1) {
18 ON_CALL(*this, didGenerateICECandidate(_)).WillByDefault(testing::Invoke(
19 this,
20 &MockWebRTCPeerConnectionHandlerClient::didGenerateICECandidateWorker));
21 ON_CALL(*this, didAddRemoteStream(_)).WillByDefault(testing::Invoke(
22 this,
23 &MockWebRTCPeerConnectionHandlerClient::didAddRemoteStreamWorker));
24 ON_CALL(*this, didRemoveRemoteStream(_)).WillByDefault(testing::Invoke(
25 this,
26 &MockWebRTCPeerConnectionHandlerClient::didRemoveRemoteStreamWorker));
29 MockWebRTCPeerConnectionHandlerClient::
30 ~MockWebRTCPeerConnectionHandlerClient() {}
32 void MockWebRTCPeerConnectionHandlerClient::didGenerateICECandidateWorker(
33 const blink::WebRTCICECandidate& candidate) {
34 if (!candidate.isNull()) {
35 candidate_sdp_ =
36 base::UTF16ToUTF8(base::StringPiece16(candidate.candidate()));
37 candidate_mline_index_ = candidate.sdpMLineIndex();
38 candidate_mid_ = base::UTF16ToUTF8(base::StringPiece16(candidate.sdpMid()));
39 } else {
40 candidate_sdp_ = "";
41 candidate_mline_index_ = -1;
42 candidate_mid_ = "";
46 void MockWebRTCPeerConnectionHandlerClient::didAddRemoteStreamWorker(
47 const blink::WebMediaStream& stream_descriptor) {
48 remote_steam_ = stream_descriptor;
51 void MockWebRTCPeerConnectionHandlerClient::didRemoveRemoteStreamWorker(
52 const blink::WebMediaStream& stream_descriptor) {
53 remote_steam_.reset();
56 } // namespace content