Fix build break
[chromium-blink-merge.git] / content / renderer / media / mock_peer_connection_impl.h
blob5adf930d269391003348ad0699f045ca78b23688
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.
5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_
6 #define CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h"
16 namespace content {
18 class MockMediaStreamDependencyFactory;
19 class MockStreamCollection;
21 class MockPeerConnectionImpl : public webrtc::PeerConnectionInterface {
22 public:
23 explicit MockPeerConnectionImpl(MockMediaStreamDependencyFactory* factory);
25 // PeerConnectionInterface implementation.
26 virtual talk_base::scoped_refptr<webrtc::StreamCollectionInterface>
27 local_streams() OVERRIDE;
28 virtual talk_base::scoped_refptr<webrtc::StreamCollectionInterface>
29 remote_streams() OVERRIDE;
30 virtual bool AddStream(
31 webrtc::MediaStreamInterface* local_stream,
32 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE;
33 virtual void RemoveStream(
34 webrtc::MediaStreamInterface* local_stream) OVERRIDE;
35 virtual talk_base::scoped_refptr<webrtc::DtmfSenderInterface>
36 CreateDtmfSender(webrtc::AudioTrackInterface* track) OVERRIDE;
37 virtual talk_base::scoped_refptr<webrtc::DataChannelInterface>
38 CreateDataChannel(const std::string& label,
39 const webrtc::DataChannelInit* config) OVERRIDE;
41 virtual bool GetStats(webrtc::StatsObserver* observer,
42 webrtc::MediaStreamTrackInterface* track) OVERRIDE;
43 // Set Call this function to make sure next call to GetStats fail.
44 void SetGetStatsResult(bool result) { getstats_result_ = result; }
46 virtual SignalingState signaling_state() OVERRIDE {
47 NOTIMPLEMENTED();
48 return PeerConnectionInterface::kStable;
50 virtual IceState ice_state() OVERRIDE {
51 NOTIMPLEMENTED();
52 return PeerConnectionInterface::kIceNew;
54 virtual IceConnectionState ice_connection_state() OVERRIDE {
55 NOTIMPLEMENTED();
56 return PeerConnectionInterface::kIceConnectionNew;
58 virtual IceGatheringState ice_gathering_state() OVERRIDE {
59 NOTIMPLEMENTED();
60 return PeerConnectionInterface::kIceGatheringNew;
62 virtual void Close() OVERRIDE {
63 NOTIMPLEMENTED();
66 virtual const webrtc::SessionDescriptionInterface* local_description()
67 const OVERRIDE;
68 virtual const webrtc::SessionDescriptionInterface* remote_description()
69 const OVERRIDE;
71 // JSEP01 APIs
72 virtual void CreateOffer(
73 webrtc::CreateSessionDescriptionObserver* observer,
74 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE;
75 virtual void CreateAnswer(
76 webrtc::CreateSessionDescriptionObserver* observer,
77 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE;
78 MOCK_METHOD2(SetLocalDescription,
79 void(webrtc::SetSessionDescriptionObserver* observer,
80 webrtc::SessionDescriptionInterface* desc));
81 void SetLocalDescriptionWorker(
82 webrtc::SetSessionDescriptionObserver* observer,
83 webrtc::SessionDescriptionInterface* desc) ;
84 MOCK_METHOD2(SetRemoteDescription,
85 void(webrtc::SetSessionDescriptionObserver* observer,
86 webrtc::SessionDescriptionInterface* desc));
87 void SetRemoteDescriptionWorker(
88 webrtc::SetSessionDescriptionObserver* observer,
89 webrtc::SessionDescriptionInterface* desc);
90 virtual bool UpdateIce(
91 const IceServers& configuration,
92 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE;
93 virtual bool AddIceCandidate(
94 const webrtc::IceCandidateInterface* candidate) OVERRIDE;
96 void AddRemoteStream(webrtc::MediaStreamInterface* stream);
98 const std::string& stream_label() const { return stream_label_; }
99 bool hint_audio() const { return hint_audio_; }
100 bool hint_video() const { return hint_video_; }
101 const std::string& description_sdp() const { return description_sdp_; }
102 const std::string& sdp_mid() const { return sdp_mid_; }
103 int sdp_mline_index() const { return sdp_mline_index_; }
104 const std::string& ice_sdp() const { return ice_sdp_; }
105 webrtc::SessionDescriptionInterface* created_session_description() const {
106 return created_sessiondescription_.get();
108 static const char kDummyOffer[];
109 static const char kDummyAnswer[];
111 protected:
112 virtual ~MockPeerConnectionImpl();
114 private:
115 // Used for creating MockSessionDescription.
116 MockMediaStreamDependencyFactory* dependency_factory_;
118 std::string stream_label_;
119 talk_base::scoped_refptr<MockStreamCollection> local_streams_;
120 talk_base::scoped_refptr<MockStreamCollection> remote_streams_;
121 scoped_ptr<webrtc::SessionDescriptionInterface> local_desc_;
122 scoped_ptr<webrtc::SessionDescriptionInterface> remote_desc_;
123 scoped_ptr<webrtc::SessionDescriptionInterface> created_sessiondescription_;
124 bool hint_audio_;
125 bool hint_video_;
126 bool getstats_result_;
127 std::string description_sdp_;
128 std::string sdp_mid_;
129 int sdp_mline_index_;
130 std::string ice_sdp_;
132 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl);
135 } // namespace content
137 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_