blob: 2a8737a8ee674e5a65d99c5fe5a15c39d9b3f297 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_
#define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "content/renderer/media/media_stream_dependency_factory.h"
namespace webrtc {
class MockLocalVideoTrack : public LocalVideoTrackInterface {
public:
explicit MockLocalVideoTrack(std::string label)
: enabled_(false),
label_(label),
renderer_(NULL) {
}
virtual cricket::VideoCapturer* GetVideoCapture() OVERRIDE;
virtual void SetRenderer(VideoRendererWrapperInterface* renderer) OVERRIDE;
virtual VideoRendererWrapperInterface* GetRenderer() OVERRIDE;
virtual std::string kind() const OVERRIDE;
virtual std::string label() const OVERRIDE;
virtual bool enabled() const OVERRIDE;
virtual TrackState state() const OVERRIDE;
virtual bool set_enabled(bool enable) OVERRIDE;
virtual bool set_state(TrackState new_state) OVERRIDE;
virtual void RegisterObserver(ObserverInterface* observer) OVERRIDE;
virtual void UnregisterObserver(ObserverInterface* observer) OVERRIDE;
VideoRendererWrapperInterface* renderer() const { return renderer_; }
protected:
virtual ~MockLocalVideoTrack() {}
private:
bool enabled_;
std::string label_;
VideoRendererWrapperInterface* renderer_;
};
} // namespace webrtc
// A mock factory for creating different objects for MediaStreamImpl.
class MockMediaStreamDependencyFactory : public MediaStreamDependencyFactory {
public:
MockMediaStreamDependencyFactory();
virtual ~MockMediaStreamDependencyFactory();
virtual bool CreatePeerConnectionFactory(
talk_base::Thread* worker_thread,
talk_base::Thread* signaling_thread,
content::P2PSocketDispatcher* socket_dispatcher,
talk_base::NetworkManager* network_manager,
talk_base::PacketSocketFactory* socket_factory) OVERRIDE;
virtual void ReleasePeerConnectionFactory() OVERRIDE;
virtual bool PeerConnectionFactoryCreated() OVERRIDE;
virtual talk_base::scoped_refptr<webrtc::PeerConnectionInterface>
CreatePeerConnection(
const std::string& config,
webrtc::PeerConnectionObserver* observer) OVERRIDE;
virtual talk_base::scoped_refptr<webrtc::PeerConnectionInterface>
CreateRoapPeerConnection(
const std::string& config,
webrtc::PeerConnectionObserver* observer) OVERRIDE;
virtual talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface>
CreateLocalMediaStream(const std::string& label) OVERRIDE;
virtual talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface>
CreateLocalVideoTrack(
const std::string& label,
cricket::VideoCapturer* video_device) OVERRIDE;
virtual talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface>
CreateLocalAudioTrack(
const std::string& label,
webrtc::AudioDeviceModule* audio_device) OVERRIDE;
virtual webrtc::SessionDescriptionInterface* CreateSessionDescription(
const std::string& sdp) OVERRIDE;
virtual webrtc::IceCandidateInterface* CreateIceCandidate(
const std::string& label,
const std::string& sdp) OVERRIDE;
private:
bool mock_pc_factory_created_;
DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory);
};
#endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_
|