| 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 | 25 |
| 26 // PeerConnectionInterface implementation. | 26 // PeerConnectionInterface implementation. |
| 27 virtual rtc::scoped_refptr<webrtc::StreamCollectionInterface> | 27 virtual rtc::scoped_refptr<webrtc::StreamCollectionInterface> |
| 28 local_streams() OVERRIDE; | 28 local_streams() override; |
| 29 virtual rtc::scoped_refptr<webrtc::StreamCollectionInterface> | 29 virtual rtc::scoped_refptr<webrtc::StreamCollectionInterface> |
| 30 remote_streams() OVERRIDE; | 30 remote_streams() override; |
| 31 virtual bool AddStream( | 31 virtual bool AddStream( |
| 32 webrtc::MediaStreamInterface* local_stream, | 32 webrtc::MediaStreamInterface* local_stream, |
| 33 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE; | 33 const webrtc::MediaConstraintsInterface* constraints) override; |
| 34 virtual void RemoveStream( | 34 virtual void RemoveStream( |
| 35 webrtc::MediaStreamInterface* local_stream) OVERRIDE; | 35 webrtc::MediaStreamInterface* local_stream) override; |
| 36 virtual rtc::scoped_refptr<webrtc::DtmfSenderInterface> | 36 virtual 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 virtual 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 |
| 42 virtual bool GetStats(webrtc::StatsObserver* observer, | 42 virtual bool GetStats(webrtc::StatsObserver* observer, |
| 43 webrtc::MediaStreamTrackInterface* track) { | 43 webrtc::MediaStreamTrackInterface* track) { |
| 44 return false; | 44 return false; |
| 45 } | 45 } |
| 46 virtual bool GetStats(webrtc::StatsObserver* observer, | 46 virtual bool GetStats(webrtc::StatsObserver* observer, |
| 47 webrtc::MediaStreamTrackInterface* track, | 47 webrtc::MediaStreamTrackInterface* track, |
| 48 StatsOutputLevel level) OVERRIDE; | 48 StatsOutputLevel level) override; |
| 49 | 49 |
| 50 // Set Call this function to make sure next call to GetStats fail. | 50 // Set Call this function to make sure next call to GetStats fail. |
| 51 void SetGetStatsResult(bool result) { getstats_result_ = result; } | 51 void SetGetStatsResult(bool result) { getstats_result_ = result; } |
| 52 | 52 |
| 53 virtual SignalingState signaling_state() OVERRIDE { | 53 virtual SignalingState signaling_state() override { |
| 54 NOTIMPLEMENTED(); | 54 NOTIMPLEMENTED(); |
| 55 return PeerConnectionInterface::kStable; | 55 return PeerConnectionInterface::kStable; |
| 56 } | 56 } |
| 57 virtual IceState ice_state() OVERRIDE { | 57 virtual IceState ice_state() override { |
| 58 NOTIMPLEMENTED(); | 58 NOTIMPLEMENTED(); |
| 59 return PeerConnectionInterface::kIceNew; | 59 return PeerConnectionInterface::kIceNew; |
| 60 } | 60 } |
| 61 virtual IceConnectionState ice_connection_state() OVERRIDE { | 61 virtual IceConnectionState ice_connection_state() override { |
| 62 NOTIMPLEMENTED(); | 62 NOTIMPLEMENTED(); |
| 63 return PeerConnectionInterface::kIceConnectionNew; | 63 return PeerConnectionInterface::kIceConnectionNew; |
| 64 } | 64 } |
| 65 virtual IceGatheringState ice_gathering_state() OVERRIDE { | 65 virtual IceGatheringState ice_gathering_state() override { |
| 66 NOTIMPLEMENTED(); | 66 NOTIMPLEMENTED(); |
| 67 return PeerConnectionInterface::kIceGatheringNew; | 67 return PeerConnectionInterface::kIceGatheringNew; |
| 68 } | 68 } |
| 69 virtual void Close() OVERRIDE { | 69 virtual void Close() override { |
| 70 NOTIMPLEMENTED(); | 70 NOTIMPLEMENTED(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 virtual const webrtc::SessionDescriptionInterface* local_description() | 73 virtual const webrtc::SessionDescriptionInterface* local_description() |
| 74 const OVERRIDE; | 74 const override; |
| 75 virtual const webrtc::SessionDescriptionInterface* remote_description() | 75 virtual const webrtc::SessionDescriptionInterface* remote_description() |
| 76 const OVERRIDE; | 76 const override; |
| 77 | 77 |
| 78 // JSEP01 APIs | 78 // JSEP01 APIs |
| 79 virtual void CreateOffer( | 79 virtual void CreateOffer( |
| 80 webrtc::CreateSessionDescriptionObserver* observer, | 80 webrtc::CreateSessionDescriptionObserver* observer, |
| 81 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE; | 81 const webrtc::MediaConstraintsInterface* constraints) override; |
| 82 virtual void CreateAnswer( | 82 virtual void CreateAnswer( |
| 83 webrtc::CreateSessionDescriptionObserver* observer, | 83 webrtc::CreateSessionDescriptionObserver* observer, |
| 84 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE; | 84 const webrtc::MediaConstraintsInterface* constraints) override; |
| 85 MOCK_METHOD2(SetLocalDescription, | 85 MOCK_METHOD2(SetLocalDescription, |
| 86 void(webrtc::SetSessionDescriptionObserver* observer, | 86 void(webrtc::SetSessionDescriptionObserver* observer, |
| 87 webrtc::SessionDescriptionInterface* desc)); | 87 webrtc::SessionDescriptionInterface* desc)); |
| 88 void SetLocalDescriptionWorker( | 88 void SetLocalDescriptionWorker( |
| 89 webrtc::SetSessionDescriptionObserver* observer, | 89 webrtc::SetSessionDescriptionObserver* observer, |
| 90 webrtc::SessionDescriptionInterface* desc) ; | 90 webrtc::SessionDescriptionInterface* desc) ; |
| 91 MOCK_METHOD2(SetRemoteDescription, | 91 MOCK_METHOD2(SetRemoteDescription, |
| 92 void(webrtc::SetSessionDescriptionObserver* observer, | 92 void(webrtc::SetSessionDescriptionObserver* observer, |
| 93 webrtc::SessionDescriptionInterface* desc)); | 93 webrtc::SessionDescriptionInterface* desc)); |
| 94 void SetRemoteDescriptionWorker( | 94 void SetRemoteDescriptionWorker( |
| 95 webrtc::SetSessionDescriptionObserver* observer, | 95 webrtc::SetSessionDescriptionObserver* observer, |
| 96 webrtc::SessionDescriptionInterface* desc); | 96 webrtc::SessionDescriptionInterface* desc); |
| 97 virtual bool UpdateIce( | 97 virtual bool UpdateIce( |
| 98 const IceServers& configuration, | 98 const IceServers& configuration, |
| 99 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE; | 99 const webrtc::MediaConstraintsInterface* constraints) override; |
| 100 virtual bool AddIceCandidate( | 100 virtual bool AddIceCandidate( |
| 101 const webrtc::IceCandidateInterface* candidate) OVERRIDE; | 101 const webrtc::IceCandidateInterface* candidate) override; |
| 102 virtual void RegisterUMAObserver(webrtc::UMAObserver* observer) OVERRIDE; | 102 virtual void RegisterUMAObserver(webrtc::UMAObserver* observer) override; |
| 103 | 103 |
| 104 void AddRemoteStream(webrtc::MediaStreamInterface* stream); | 104 void AddRemoteStream(webrtc::MediaStreamInterface* stream); |
| 105 | 105 |
| 106 const std::string& stream_label() const { return stream_label_; } | 106 const std::string& stream_label() const { return stream_label_; } |
| 107 bool hint_audio() const { return hint_audio_; } | 107 bool hint_audio() const { return hint_audio_; } |
| 108 bool hint_video() const { return hint_video_; } | 108 bool hint_video() const { return hint_video_; } |
| 109 const std::string& description_sdp() const { return description_sdp_; } | 109 const std::string& description_sdp() const { return description_sdp_; } |
| 110 const std::string& sdp_mid() const { return sdp_mid_; } | 110 const std::string& sdp_mid() const { return sdp_mid_; } |
| 111 int sdp_mline_index() const { return sdp_mline_index_; } | 111 int sdp_mline_index() const { return sdp_mline_index_; } |
| 112 const std::string& ice_sdp() const { return ice_sdp_; } | 112 const std::string& ice_sdp() const { return ice_sdp_; } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 136 std::string sdp_mid_; | 136 std::string sdp_mid_; |
| 137 int sdp_mline_index_; | 137 int sdp_mline_index_; |
| 138 std::string ice_sdp_; | 138 std::string ice_sdp_; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl); | 140 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 } // namespace content | 143 } // namespace content |
| 144 | 144 |
| 145 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ | 145 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ |
| OLD | NEW |