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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
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/macros.h" | 13 #include "base/macros.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
15 #include "third_party/webrtc/api/peerconnectioninterface.h" | 15 #include "third_party/webrtc/api/peerconnectioninterface.h" |
| 16 #include "third_party/webrtc/api/stats/rtcstatsreport.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 class MockPeerConnectionDependencyFactory; | 20 class MockPeerConnectionDependencyFactory; |
20 class MockStreamCollection; | 21 class MockStreamCollection; |
21 | 22 |
22 class MockPeerConnectionImpl : public webrtc::PeerConnectionInterface { | 23 class MockPeerConnectionImpl : public webrtc::PeerConnectionInterface { |
23 public: | 24 public: |
24 explicit MockPeerConnectionImpl(MockPeerConnectionDependencyFactory* factory, | 25 explicit MockPeerConnectionImpl(MockPeerConnectionDependencyFactory* factory, |
25 webrtc::PeerConnectionObserver* observer); | 26 webrtc::PeerConnectionObserver* observer); |
26 | 27 |
27 // PeerConnectionInterface implementation. | 28 // PeerConnectionInterface implementation. |
28 rtc::scoped_refptr<webrtc::StreamCollectionInterface> | 29 rtc::scoped_refptr<webrtc::StreamCollectionInterface> |
29 local_streams() override; | 30 local_streams() override; |
30 rtc::scoped_refptr<webrtc::StreamCollectionInterface> | 31 rtc::scoped_refptr<webrtc::StreamCollectionInterface> |
31 remote_streams() override; | 32 remote_streams() override; |
32 bool AddStream( | 33 bool AddStream( |
33 webrtc::MediaStreamInterface* local_stream) override; | 34 webrtc::MediaStreamInterface* local_stream) override; |
34 void RemoveStream( | 35 void RemoveStream( |
35 webrtc::MediaStreamInterface* local_stream) override; | 36 webrtc::MediaStreamInterface* local_stream) override; |
36 rtc::scoped_refptr<webrtc::DtmfSenderInterface> | 37 rtc::scoped_refptr<webrtc::DtmfSenderInterface> |
37 CreateDtmfSender(webrtc::AudioTrackInterface* track) override; | 38 CreateDtmfSender(webrtc::AudioTrackInterface* track) override; |
38 rtc::scoped_refptr<webrtc::DataChannelInterface> | 39 rtc::scoped_refptr<webrtc::DataChannelInterface> |
39 CreateDataChannel(const std::string& label, | 40 CreateDataChannel(const std::string& label, |
40 const webrtc::DataChannelInit* config) override; | 41 const webrtc::DataChannelInit* config) override; |
41 bool GetStats(webrtc::StatsObserver* observer, | 42 bool GetStats(webrtc::StatsObserver* observer, |
42 webrtc::MediaStreamTrackInterface* track, | 43 webrtc::MediaStreamTrackInterface* track, |
43 StatsOutputLevel level) override; | 44 StatsOutputLevel level) override; |
| 45 void GetStats(webrtc::RTCStatsCollectorCallback* callback) override; |
44 | 46 |
45 // Set Call this function to make sure next call to GetStats fail. | 47 // Call this function to make sure next call to legacy GetStats fail. |
46 void SetGetStatsResult(bool result) { getstats_result_ = result; } | 48 void SetGetStatsResult(bool result) { getstats_result_ = result; } |
| 49 // Set the report that |GetStats(RTCStatsCollectorCallback*)| returns. |
| 50 void SetGetStatsReport(webrtc::RTCStatsReport* report); |
47 | 51 |
48 SignalingState signaling_state() override { | 52 SignalingState signaling_state() override { |
49 NOTIMPLEMENTED(); | 53 NOTIMPLEMENTED(); |
50 return PeerConnectionInterface::kStable; | 54 return PeerConnectionInterface::kStable; |
51 } | 55 } |
52 IceConnectionState ice_connection_state() override { | 56 IceConnectionState ice_connection_state() override { |
53 NOTIMPLEMENTED(); | 57 NOTIMPLEMENTED(); |
54 return PeerConnectionInterface::kIceConnectionNew; | 58 return PeerConnectionInterface::kIceConnectionNew; |
55 } | 59 } |
56 IceGatheringState ice_gathering_state() override { | 60 IceGatheringState ice_gathering_state() override { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 std::unique_ptr<webrtc::SessionDescriptionInterface> | 129 std::unique_ptr<webrtc::SessionDescriptionInterface> |
126 created_sessiondescription_; | 130 created_sessiondescription_; |
127 bool hint_audio_; | 131 bool hint_audio_; |
128 bool hint_video_; | 132 bool hint_video_; |
129 bool getstats_result_; | 133 bool getstats_result_; |
130 std::string description_sdp_; | 134 std::string description_sdp_; |
131 std::string sdp_mid_; | 135 std::string sdp_mid_; |
132 int sdp_mline_index_; | 136 int sdp_mline_index_; |
133 std::string ice_sdp_; | 137 std::string ice_sdp_; |
134 webrtc::PeerConnectionObserver* observer_; | 138 webrtc::PeerConnectionObserver* observer_; |
| 139 rtc::scoped_refptr<webrtc::RTCStatsReport> stats_report_; |
135 | 140 |
136 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl); | 141 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl); |
137 }; | 142 }; |
138 | 143 |
139 } // namespace content | 144 } // namespace content |
140 | 145 |
141 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ | 146 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ |
OLD | NEW |