Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: content/renderer/media/mock_peer_connection_impl.cc

Issue 10008077: Adding JSEP PeerConnection glue - attempt 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "content/renderer/media/mock_media_stream_dependency_factory.h"
5 #include "content/renderer/media/mock_peer_connection_impl.h" 6 #include "content/renderer/media/mock_peer_connection_impl.h"
6 7
7 #include <vector> 8 #include <vector>
8 9
9 #include "base/logging.h" 10 #include "base/logging.h"
10 11
11 namespace webrtc { 12 namespace webrtc {
12 13
13 class MockStreamCollection : public StreamCollectionInterface { 14 class MockStreamCollection : public StreamCollectionInterface {
14 public: 15 public:
(...skipping 14 matching lines...) Expand all
29 streams_.push_back(stream); 30 streams_.push_back(stream);
30 } 31 }
31 32
32 protected: 33 protected:
33 virtual ~MockStreamCollection() {} 34 virtual ~MockStreamCollection() {}
34 35
35 private: 36 private:
36 std::vector<talk_base::scoped_refptr<MediaStreamInterface> > streams_; 37 std::vector<talk_base::scoped_refptr<MediaStreamInterface> > streams_;
37 }; 38 };
38 39
39 MockPeerConnectionImpl::MockPeerConnectionImpl() 40 const char MockPeerConnectionImpl::kDummyOffer[] = "dummy offer";
40 : stream_changes_committed_(false), 41
42 MockPeerConnectionImpl::MockPeerConnectionImpl(
43 MockMediaStreamDependencyFactory* factory)
44 : dependency_factory_(factory),
45 stream_changes_committed_(false),
41 local_streams_(new talk_base::RefCountedObject<MockStreamCollection>), 46 local_streams_(new talk_base::RefCountedObject<MockStreamCollection>),
42 remote_streams_(new talk_base::RefCountedObject<MockStreamCollection>) { 47 remote_streams_(new talk_base::RefCountedObject<MockStreamCollection>),
48 hint_audio_(false),
49 hint_video_(false),
50 action_(kAnswer),
51 ice_options_(kOnlyRelay),
52 ready_state_(kNew) {
43 } 53 }
44 54
45 MockPeerConnectionImpl::~MockPeerConnectionImpl() {} 55 MockPeerConnectionImpl::~MockPeerConnectionImpl() {}
46 56
47 void MockPeerConnectionImpl::ProcessSignalingMessage(const std::string& msg) { 57 void MockPeerConnectionImpl::ProcessSignalingMessage(const std::string& msg) {
48 signaling_message_ = msg; 58 signaling_message_ = msg;
49 } 59 }
50 60
51 bool MockPeerConnectionImpl::Send(const std::string& msg) { 61 bool MockPeerConnectionImpl::Send(const std::string& msg) {
52 NOTIMPLEMENTED(); 62 NOTIMPLEMENTED();
(...skipping 25 matching lines...) Expand all
78 stream_changes_committed_ = true; 88 stream_changes_committed_ = true;
79 } 89 }
80 90
81 void MockPeerConnectionImpl::Close() { 91 void MockPeerConnectionImpl::Close() {
82 signaling_message_.clear(); 92 signaling_message_.clear();
83 stream_label_.clear(); 93 stream_label_.clear();
84 stream_changes_committed_ = false; 94 stream_changes_committed_ = false;
85 } 95 }
86 96
87 MockPeerConnectionImpl::ReadyState MockPeerConnectionImpl::ready_state() { 97 MockPeerConnectionImpl::ReadyState MockPeerConnectionImpl::ready_state() {
88 NOTIMPLEMENTED(); 98 return ready_state_;
89 return kNew;
90 } 99 }
91 100
92 MockPeerConnectionImpl::SdpState MockPeerConnectionImpl::sdp_state() { 101 MockPeerConnectionImpl::SdpState MockPeerConnectionImpl::sdp_state() {
93 NOTIMPLEMENTED(); 102 NOTIMPLEMENTED();
94 return kSdpNew; 103 return kSdpNew;
95 } 104 }
96 105
97 bool MockPeerConnectionImpl::StartIce(IceOptions options) { 106 bool MockPeerConnectionImpl::StartIce(IceOptions options) {
98 NOTIMPLEMENTED(); 107 ice_options_ = options;
99 return false; 108 return true;
100 } 109 }
101 110
102 webrtc::SessionDescriptionInterface* MockPeerConnectionImpl::CreateOffer( 111 webrtc::SessionDescriptionInterface* MockPeerConnectionImpl::CreateOffer(
103 const webrtc::MediaHints& hints) { 112 const webrtc::MediaHints& hints) {
104 NOTIMPLEMENTED(); 113 hint_audio_ = hints.has_audio();
105 return NULL; 114 hint_video_ = hints.has_video();
115 return dependency_factory_->CreateSessionDescription(kDummyOffer);
106 } 116 }
107 117
108 webrtc::SessionDescriptionInterface* MockPeerConnectionImpl::CreateAnswer( 118 webrtc::SessionDescriptionInterface* MockPeerConnectionImpl::CreateAnswer(
109 const webrtc::MediaHints& hints, 119 const webrtc::MediaHints& hints,
110 const webrtc::SessionDescriptionInterface* offer) { 120 const webrtc::SessionDescriptionInterface* offer) {
111 NOTIMPLEMENTED(); 121 hint_audio_ = hints.has_audio();
112 return NULL; 122 hint_video_ = hints.has_video();
123 offer->ToString(&description_sdp_);
124 return dependency_factory_->CreateSessionDescription(description_sdp_);
113 } 125 }
114 126
115 bool MockPeerConnectionImpl::SetLocalDescription( 127 bool MockPeerConnectionImpl::SetLocalDescription(
116 Action action, 128 Action action,
117 webrtc::SessionDescriptionInterface* desc) { 129 webrtc::SessionDescriptionInterface* desc) {
118 NOTIMPLEMENTED(); 130 action_ = action;
119 return false; 131 local_desc_.reset(desc);
132 return desc->ToString(&description_sdp_);
120 } 133 }
121 134
122 bool MockPeerConnectionImpl::SetRemoteDescription( 135 bool MockPeerConnectionImpl::SetRemoteDescription(
123 Action action, 136 Action action,
124 webrtc::SessionDescriptionInterface* desc) { 137 webrtc::SessionDescriptionInterface* desc) {
125 NOTIMPLEMENTED(); 138 action_ = action;
126 return false; 139 remote_desc_.reset(desc);
140 return desc->ToString(&description_sdp_);
127 } 141 }
128 142
129 bool MockPeerConnectionImpl::ProcessIceMessage( 143 bool MockPeerConnectionImpl::ProcessIceMessage(
130 const webrtc::IceCandidateInterface* ice_candidate) { 144 const webrtc::IceCandidateInterface* ice_candidate) {
131 NOTIMPLEMENTED(); 145 ice_label_ = ice_candidate->label();
132 return false; 146 return ice_candidate->ToString(&ice_sdp_);
133 } 147 }
134 148
135 const webrtc::SessionDescriptionInterface* 149 const webrtc::SessionDescriptionInterface*
136 MockPeerConnectionImpl::local_description() const { 150 MockPeerConnectionImpl::local_description() const {
137 NOTIMPLEMENTED(); 151 return local_desc_.get();
138 return NULL;
139 } 152 }
140 153
141 const webrtc::SessionDescriptionInterface* 154 const webrtc::SessionDescriptionInterface*
142 MockPeerConnectionImpl::remote_description() const { 155 MockPeerConnectionImpl::remote_description() const {
143 NOTIMPLEMENTED(); 156 return remote_desc_.get();
144 return NULL;
145 } 157 }
146 158
147 void MockPeerConnectionImpl::AddRemoteStream(MediaStreamInterface* stream) { 159 void MockPeerConnectionImpl::AddRemoteStream(MediaStreamInterface* stream) {
148 remote_streams_->AddStream(stream); 160 remote_streams_->AddStream(stream);
149 } 161 }
150 162
151 } // namespace webrtc 163 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698