#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h"
namespace content {
-class MockMediaStreamDependencyFactory;
+class MockPeerConnectionDependencyFactory;
class MockStreamCollection;
class MockPeerConnectionImpl : public webrtc::PeerConnectionInterface {
public:
- explicit MockPeerConnectionImpl(MockMediaStreamDependencyFactory* factory);
+ explicit MockPeerConnectionImpl(MockPeerConnectionDependencyFactory* factory,
+ webrtc::PeerConnectionObserver* observer);
// PeerConnectionInterface implementation.
- virtual talk_base::scoped_refptr<webrtc::StreamCollectionInterface>
- local_streams() OVERRIDE;
- virtual talk_base::scoped_refptr<webrtc::StreamCollectionInterface>
- remote_streams() OVERRIDE;
+ virtual rtc::scoped_refptr<webrtc::StreamCollectionInterface>
+ local_streams() override;
+ virtual rtc::scoped_refptr<webrtc::StreamCollectionInterface>
+ remote_streams() override;
virtual bool AddStream(
- webrtc::MediaStreamInterface* local_stream,
- const webrtc::MediaConstraintsInterface* constraints) OVERRIDE;
+ webrtc::MediaStreamInterface* local_stream) override;
virtual void RemoveStream(
- webrtc::MediaStreamInterface* local_stream) OVERRIDE;
- virtual talk_base::scoped_refptr<webrtc::DtmfSenderInterface>
- CreateDtmfSender(webrtc::AudioTrackInterface* track) OVERRIDE;
- virtual talk_base::scoped_refptr<webrtc::DataChannelInterface>
+ webrtc::MediaStreamInterface* local_stream) override;
+ virtual rtc::scoped_refptr<webrtc::DtmfSenderInterface>
+ CreateDtmfSender(webrtc::AudioTrackInterface* track) override;
+ virtual rtc::scoped_refptr<webrtc::DataChannelInterface>
CreateDataChannel(const std::string& label,
- const webrtc::DataChannelInit* config) OVERRIDE;
+ const webrtc::DataChannelInit* config) override;
virtual bool GetStats(webrtc::StatsObserver* observer,
- webrtc::MediaStreamTrackInterface* track) OVERRIDE;
+ webrtc::MediaStreamTrackInterface* track) {
+ return false;
+ }
+ virtual bool GetStats(webrtc::StatsObserver* observer,
+ webrtc::MediaStreamTrackInterface* track,
+ StatsOutputLevel level) override;
+
// Set Call this function to make sure next call to GetStats fail.
void SetGetStatsResult(bool result) { getstats_result_ = result; }
- virtual SignalingState signaling_state() OVERRIDE {
+ virtual SignalingState signaling_state() override {
NOTIMPLEMENTED();
return PeerConnectionInterface::kStable;
}
- virtual IceState ice_state() OVERRIDE {
+ virtual IceState ice_state() override {
NOTIMPLEMENTED();
return PeerConnectionInterface::kIceNew;
}
- virtual IceConnectionState ice_connection_state() OVERRIDE {
+ virtual IceConnectionState ice_connection_state() override {
NOTIMPLEMENTED();
return PeerConnectionInterface::kIceConnectionNew;
}
- virtual IceGatheringState ice_gathering_state() OVERRIDE {
+ virtual IceGatheringState ice_gathering_state() override {
NOTIMPLEMENTED();
return PeerConnectionInterface::kIceGatheringNew;
}
- virtual void Close() OVERRIDE {
+ virtual void Close() override {
NOTIMPLEMENTED();
}
virtual const webrtc::SessionDescriptionInterface* local_description()
- const OVERRIDE;
+ const override;
virtual const webrtc::SessionDescriptionInterface* remote_description()
- const OVERRIDE;
+ const override;
// JSEP01 APIs
virtual void CreateOffer(
webrtc::CreateSessionDescriptionObserver* observer,
- const webrtc::MediaConstraintsInterface* constraints) OVERRIDE;
+ const webrtc::MediaConstraintsInterface* constraints) override;
virtual void CreateAnswer(
webrtc::CreateSessionDescriptionObserver* observer,
- const webrtc::MediaConstraintsInterface* constraints) OVERRIDE;
+ const webrtc::MediaConstraintsInterface* constraints) override;
MOCK_METHOD2(SetLocalDescription,
void(webrtc::SetSessionDescriptionObserver* observer,
webrtc::SessionDescriptionInterface* desc));
webrtc::SessionDescriptionInterface* desc);
virtual bool UpdateIce(
const IceServers& configuration,
- const webrtc::MediaConstraintsInterface* constraints) OVERRIDE;
+ const webrtc::MediaConstraintsInterface* constraints) override;
virtual bool AddIceCandidate(
- const webrtc::IceCandidateInterface* candidate) OVERRIDE;
+ const webrtc::IceCandidateInterface* candidate) override;
+ virtual void RegisterUMAObserver(webrtc::UMAObserver* observer) override;
void AddRemoteStream(webrtc::MediaStreamInterface* stream);
webrtc::SessionDescriptionInterface* created_session_description() const {
return created_sessiondescription_.get();
}
+ webrtc::PeerConnectionObserver* observer() {
+ return observer_;
+ }
static const char kDummyOffer[];
static const char kDummyAnswer[];
private:
// Used for creating MockSessionDescription.
- MockMediaStreamDependencyFactory* dependency_factory_;
+ MockPeerConnectionDependencyFactory* dependency_factory_;
std::string stream_label_;
- talk_base::scoped_refptr<MockStreamCollection> local_streams_;
- talk_base::scoped_refptr<MockStreamCollection> remote_streams_;
+ rtc::scoped_refptr<MockStreamCollection> local_streams_;
+ rtc::scoped_refptr<MockStreamCollection> remote_streams_;
scoped_ptr<webrtc::SessionDescriptionInterface> local_desc_;
scoped_ptr<webrtc::SessionDescriptionInterface> remote_desc_;
scoped_ptr<webrtc::SessionDescriptionInterface> created_sessiondescription_;
std::string sdp_mid_;
int sdp_mline_index_;
std::string ice_sdp_;
+ webrtc::PeerConnectionObserver* observer_;
DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl);
};