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 | 4 |
5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
15 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" | 15 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class MockPeerConnectionDependencyFactory; | 19 class MockPeerConnectionDependencyFactory; |
20 class MockStreamCollection; | 20 class MockStreamCollection; |
21 | 21 |
22 class MockPeerConnectionImpl : public webrtc::PeerConnectionInterface { | 22 class MockPeerConnectionImpl : public webrtc::PeerConnectionInterface { |
23 public: | 23 public: |
24 explicit MockPeerConnectionImpl(MockPeerConnectionDependencyFactory* factory, | 24 explicit MockPeerConnectionImpl(MockPeerConnectionDependencyFactory* factory, |
25 webrtc::PeerConnectionObserver* observer); | 25 webrtc::PeerConnectionObserver* observer); |
26 | 26 |
27 // PeerConnectionInterface implementation. | 27 // PeerConnectionInterface implementation. |
28 virtual rtc::scoped_refptr<webrtc::StreamCollectionInterface> | 28 rtc::scoped_refptr<webrtc::StreamCollectionInterface> |
29 local_streams() override; | 29 local_streams() override; |
30 virtual rtc::scoped_refptr<webrtc::StreamCollectionInterface> | 30 rtc::scoped_refptr<webrtc::StreamCollectionInterface> |
31 remote_streams() override; | 31 remote_streams() override; |
32 virtual bool AddStream( | 32 bool AddStream( |
33 webrtc::MediaStreamInterface* local_stream) override; | 33 webrtc::MediaStreamInterface* local_stream) override; |
34 virtual void RemoveStream( | 34 void RemoveStream( |
35 webrtc::MediaStreamInterface* local_stream) override; | 35 webrtc::MediaStreamInterface* local_stream) override; |
36 virtual rtc::scoped_refptr<webrtc::DtmfSenderInterface> | 36 rtc::scoped_refptr<webrtc::DtmfSenderInterface> |
37 CreateDtmfSender(webrtc::AudioTrackInterface* track) override; | 37 CreateDtmfSender(webrtc::AudioTrackInterface* track) override; |
38 virtual rtc::scoped_refptr<webrtc::DataChannelInterface> | 38 rtc::scoped_refptr<webrtc::DataChannelInterface> |
39 CreateDataChannel(const std::string& label, | 39 CreateDataChannel(const std::string& label, |
40 const webrtc::DataChannelInit* config) override; | 40 const webrtc::DataChannelInit* config) override; |
41 | 41 bool GetStats(webrtc::StatsObserver* observer, |
42 virtual bool GetStats(webrtc::StatsObserver* observer, | 42 webrtc::MediaStreamTrackInterface* track, |
43 webrtc::MediaStreamTrackInterface* track) { | 43 StatsOutputLevel level) override; |
44 return false; | |
45 } | |
46 virtual bool GetStats(webrtc::StatsObserver* observer, | |
47 webrtc::MediaStreamTrackInterface* track, | |
48 StatsOutputLevel level) override; | |
49 | 44 |
50 // Set Call this function to make sure next call to GetStats fail. | 45 // Set Call this function to make sure next call to GetStats fail. |
51 void SetGetStatsResult(bool result) { getstats_result_ = result; } | 46 void SetGetStatsResult(bool result) { getstats_result_ = result; } |
52 | 47 |
53 virtual SignalingState signaling_state() override { | 48 SignalingState signaling_state() override { |
54 NOTIMPLEMENTED(); | 49 NOTIMPLEMENTED(); |
55 return PeerConnectionInterface::kStable; | 50 return PeerConnectionInterface::kStable; |
56 } | 51 } |
57 virtual IceState ice_state() override { | 52 IceState ice_state() override { |
58 NOTIMPLEMENTED(); | 53 NOTIMPLEMENTED(); |
59 return PeerConnectionInterface::kIceNew; | 54 return PeerConnectionInterface::kIceNew; |
60 } | 55 } |
61 virtual IceConnectionState ice_connection_state() override { | 56 IceConnectionState ice_connection_state() override { |
62 NOTIMPLEMENTED(); | 57 NOTIMPLEMENTED(); |
63 return PeerConnectionInterface::kIceConnectionNew; | 58 return PeerConnectionInterface::kIceConnectionNew; |
64 } | 59 } |
65 virtual IceGatheringState ice_gathering_state() override { | 60 IceGatheringState ice_gathering_state() override { |
66 NOTIMPLEMENTED(); | 61 NOTIMPLEMENTED(); |
67 return PeerConnectionInterface::kIceGatheringNew; | 62 return PeerConnectionInterface::kIceGatheringNew; |
68 } | 63 } |
69 virtual void Close() override { | 64 void Close() override { |
70 NOTIMPLEMENTED(); | 65 NOTIMPLEMENTED(); |
71 } | 66 } |
72 | 67 |
73 virtual const webrtc::SessionDescriptionInterface* local_description() | 68 const webrtc::SessionDescriptionInterface* local_description() const override; |
74 const override; | 69 const webrtc::SessionDescriptionInterface* remote_description() |
75 virtual const webrtc::SessionDescriptionInterface* remote_description() | |
76 const override; | 70 const override; |
77 | 71 |
78 // JSEP01 APIs | 72 // JSEP01 APIs |
79 virtual void CreateOffer( | 73 void CreateOffer( |
80 webrtc::CreateSessionDescriptionObserver* observer, | 74 webrtc::CreateSessionDescriptionObserver* observer, |
81 const webrtc::MediaConstraintsInterface* constraints) override; | 75 const webrtc::MediaConstraintsInterface* constraints) override; |
82 virtual void CreateAnswer( | 76 void CreateAnswer( |
83 webrtc::CreateSessionDescriptionObserver* observer, | 77 webrtc::CreateSessionDescriptionObserver* observer, |
84 const webrtc::MediaConstraintsInterface* constraints) override; | 78 const webrtc::MediaConstraintsInterface* constraints) override; |
85 MOCK_METHOD2(SetLocalDescription, | 79 MOCK_METHOD2(SetLocalDescription, |
86 void(webrtc::SetSessionDescriptionObserver* observer, | 80 void(webrtc::SetSessionDescriptionObserver* observer, |
87 webrtc::SessionDescriptionInterface* desc)); | 81 webrtc::SessionDescriptionInterface* desc)); |
88 void SetLocalDescriptionWorker( | 82 void SetLocalDescriptionWorker( |
89 webrtc::SetSessionDescriptionObserver* observer, | 83 webrtc::SetSessionDescriptionObserver* observer, |
90 webrtc::SessionDescriptionInterface* desc) ; | 84 webrtc::SessionDescriptionInterface* desc) ; |
91 MOCK_METHOD2(SetRemoteDescription, | 85 MOCK_METHOD2(SetRemoteDescription, |
92 void(webrtc::SetSessionDescriptionObserver* observer, | 86 void(webrtc::SetSessionDescriptionObserver* observer, |
93 webrtc::SessionDescriptionInterface* desc)); | 87 webrtc::SessionDescriptionInterface* desc)); |
94 void SetRemoteDescriptionWorker( | 88 void SetRemoteDescriptionWorker( |
95 webrtc::SetSessionDescriptionObserver* observer, | 89 webrtc::SetSessionDescriptionObserver* observer, |
96 webrtc::SessionDescriptionInterface* desc); | 90 webrtc::SessionDescriptionInterface* desc); |
97 virtual bool UpdateIce( | 91 bool UpdateIce(const IceServers& configuration, |
98 const IceServers& configuration, | 92 const webrtc::MediaConstraintsInterface* constraints) override; |
99 const webrtc::MediaConstraintsInterface* constraints) override; | 93 bool AddIceCandidate(const webrtc::IceCandidateInterface* candidate) override; |
100 virtual bool AddIceCandidate( | 94 void RegisterUMAObserver(webrtc::UMAObserver* observer) override; |
101 const webrtc::IceCandidateInterface* candidate) override; | |
102 virtual void RegisterUMAObserver(webrtc::UMAObserver* observer) override; | |
103 | 95 |
104 void AddRemoteStream(webrtc::MediaStreamInterface* stream); | 96 void AddRemoteStream(webrtc::MediaStreamInterface* stream); |
105 | 97 |
106 const std::string& stream_label() const { return stream_label_; } | 98 const std::string& stream_label() const { return stream_label_; } |
107 bool hint_audio() const { return hint_audio_; } | 99 bool hint_audio() const { return hint_audio_; } |
108 bool hint_video() const { return hint_video_; } | 100 bool hint_video() const { return hint_video_; } |
109 const std::string& description_sdp() const { return description_sdp_; } | 101 const std::string& description_sdp() const { return description_sdp_; } |
110 const std::string& sdp_mid() const { return sdp_mid_; } | 102 const std::string& sdp_mid() const { return sdp_mid_; } |
111 int sdp_mline_index() const { return sdp_mline_index_; } | 103 int sdp_mline_index() const { return sdp_mline_index_; } |
112 const std::string& ice_sdp() const { return ice_sdp_; } | 104 const std::string& ice_sdp() const { return ice_sdp_; } |
(...skipping 27 matching lines...) Expand all Loading... |
140 int sdp_mline_index_; | 132 int sdp_mline_index_; |
141 std::string ice_sdp_; | 133 std::string ice_sdp_; |
142 webrtc::PeerConnectionObserver* observer_; | 134 webrtc::PeerConnectionObserver* observer_; |
143 | 135 |
144 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl); | 136 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl); |
145 }; | 137 }; |
146 | 138 |
147 } // namespace content | 139 } // namespace content |
148 | 140 |
149 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ | 141 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ |
OLD | NEW |