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

Side by Side Diff: webrtc/api/webrtcsession_unittest.cc

Issue 2606123002: Remove the dependency of TransportChannel and TransportChannelImpl. (Closed)
Patch Set: Fix the memory leak. Created 3 years, 11 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
« no previous file with comments | « webrtc/api/webrtcsession.cc ('k') | webrtc/media/sctp/sctptransport.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 28 matching lines...) Expand all
39 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 39 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
40 #include "webrtc/media/base/fakemediaengine.h" 40 #include "webrtc/media/base/fakemediaengine.h"
41 #include "webrtc/media/base/fakevideorenderer.h" 41 #include "webrtc/media/base/fakevideorenderer.h"
42 #include "webrtc/media/base/mediachannel.h" 42 #include "webrtc/media/base/mediachannel.h"
43 #include "webrtc/media/engine/fakewebrtccall.h" 43 #include "webrtc/media/engine/fakewebrtccall.h"
44 #include "webrtc/media/sctp/sctptransportinternal.h" 44 #include "webrtc/media/sctp/sctptransportinternal.h"
45 #include "webrtc/p2p/base/packettransportinterface.h" 45 #include "webrtc/p2p/base/packettransportinterface.h"
46 #include "webrtc/p2p/base/stunserver.h" 46 #include "webrtc/p2p/base/stunserver.h"
47 #include "webrtc/p2p/base/teststunserver.h" 47 #include "webrtc/p2p/base/teststunserver.h"
48 #include "webrtc/p2p/base/testturnserver.h" 48 #include "webrtc/p2p/base/testturnserver.h"
49 #include "webrtc/p2p/base/transportchannel.h"
50 #include "webrtc/p2p/client/basicportallocator.h" 49 #include "webrtc/p2p/client/basicportallocator.h"
51 #include "webrtc/pc/channelmanager.h" 50 #include "webrtc/pc/channelmanager.h"
52 #include "webrtc/pc/mediasession.h" 51 #include "webrtc/pc/mediasession.h"
53 52
54 #define MAYBE_SKIP_TEST(feature) \ 53 #define MAYBE_SKIP_TEST(feature) \
55 if (!(feature())) { \ 54 if (!(feature())) { \
56 LOG(LS_INFO) << "Feature disabled... skipping"; \ 55 LOG(LS_INFO) << "Feature disabled... skipping"; \
57 return; \ 56 return; \
58 } 57 }
59 58
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 std::vector<PeerConnectionInterface::IceConnectionState> 211 std::vector<PeerConnectionInterface::IceConnectionState>
213 ice_connection_state_history_; 212 ice_connection_state_history_;
214 size_t num_candidates_removed_ = 0; 213 size_t num_candidates_removed_ = 0;
215 }; 214 };
216 215
217 // Used for tests in this file to verify that WebRtcSession responds to signals 216 // Used for tests in this file to verify that WebRtcSession responds to signals
218 // from the SctpTransport correctly, and calls Start with the correct 217 // from the SctpTransport correctly, and calls Start with the correct
219 // local/remote ports. 218 // local/remote ports.
220 class FakeSctpTransport : public cricket::SctpTransportInternal { 219 class FakeSctpTransport : public cricket::SctpTransportInternal {
221 public: 220 public:
222 void SetTransportChannel(cricket::TransportChannel* channel) override {} 221 void SetTransportChannel(rtc::PacketTransportInterface* channel) override {}
223 bool Start(int local_port, int remote_port) override { 222 bool Start(int local_port, int remote_port) override {
224 local_port_ = local_port; 223 local_port_ = local_port;
225 remote_port_ = remote_port; 224 remote_port_ = remote_port;
226 return true; 225 return true;
227 } 226 }
228 bool OpenStream(int sid) override { return true; } 227 bool OpenStream(int sid) override { return true; }
229 bool ResetStream(int sid) override { return true; } 228 bool ResetStream(int sid) override { return true; }
230 bool SendData(const cricket::SendDataParams& params, 229 bool SendData(const cricket::SendDataParams& params,
231 const rtc::CopyOnWriteBuffer& payload, 230 const rtc::CopyOnWriteBuffer& payload,
232 cricket::SendDataResult* result = nullptr) override { 231 cricket::SendDataResult* result = nullptr) override {
233 return true; 232 return true;
234 } 233 }
235 bool ReadyToSendData() override { return true; } 234 bool ReadyToSendData() override { return true; }
236 void set_debug_name_for_testing(const char* debug_name) override {} 235 void set_debug_name_for_testing(const char* debug_name) override {}
237 236
238 int local_port() const { return local_port_; } 237 int local_port() const { return local_port_; }
239 int remote_port() const { return remote_port_; } 238 int remote_port() const { return remote_port_; }
240 239
241 private: 240 private:
242 int local_port_ = -1; 241 int local_port_ = -1;
243 int remote_port_ = -1; 242 int remote_port_ = -1;
244 }; 243 };
245 244
246 class FakeSctpTransportFactory : public cricket::SctpTransportInternalFactory { 245 class FakeSctpTransportFactory : public cricket::SctpTransportInternalFactory {
247 public: 246 public:
248 std::unique_ptr<cricket::SctpTransportInternal> CreateSctpTransport( 247 std::unique_ptr<cricket::SctpTransportInternal> CreateSctpTransport(
249 cricket::TransportChannel*) override { 248 rtc::PacketTransportInterface*) override {
250 last_fake_sctp_transport_ = new FakeSctpTransport(); 249 last_fake_sctp_transport_ = new FakeSctpTransport();
251 return std::unique_ptr<cricket::SctpTransportInternal>( 250 return std::unique_ptr<cricket::SctpTransportInternal>(
252 last_fake_sctp_transport_); 251 last_fake_sctp_transport_);
253 } 252 }
254 253
255 FakeSctpTransport* last_fake_sctp_transport() { 254 FakeSctpTransport* last_fake_sctp_transport() {
256 return last_fake_sctp_transport_; 255 return last_fake_sctp_transport_;
257 } 256 }
258 257
259 private: 258 private:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 rtc::PacketTransportInterface* video_rtcp_transport_channel() { 298 rtc::PacketTransportInterface* video_rtcp_transport_channel() {
300 return rtcp_transport_channel(video_channel()); 299 return rtcp_transport_channel(video_channel());
301 } 300 }
302 301
303 private: 302 private:
304 rtc::PacketTransportInterface* rtp_transport_channel( 303 rtc::PacketTransportInterface* rtp_transport_channel(
305 cricket::BaseChannel* ch) { 304 cricket::BaseChannel* ch) {
306 if (!ch) { 305 if (!ch) {
307 return nullptr; 306 return nullptr;
308 } 307 }
309 return ch->rtp_transport(); 308 return ch->rtp_dtls_transport();
310 } 309 }
311 310
312 rtc::PacketTransportInterface* rtcp_transport_channel( 311 rtc::PacketTransportInterface* rtcp_transport_channel(
313 cricket::BaseChannel* ch) { 312 cricket::BaseChannel* ch) {
314 if (!ch) { 313 if (!ch) {
315 return nullptr; 314 return nullptr;
316 } 315 }
317 return ch->rtcp_transport(); 316 return ch->rtcp_dtls_transport();
318 } 317 }
319 }; 318 };
320 319
321 class WebRtcSessionCreateSDPObserverForTest 320 class WebRtcSessionCreateSDPObserverForTest
322 : public rtc::RefCountedObject<CreateSessionDescriptionObserver> { 321 : public rtc::RefCountedObject<CreateSessionDescriptionObserver> {
323 public: 322 public:
324 enum State { 323 enum State {
325 kInit, 324 kInit,
326 kFailed, 325 kFailed,
327 kSucceeded, 326 kSucceeded,
(...skipping 4115 matching lines...) Expand 10 before | Expand all | Expand 10 after
4443 } 4442 }
4444 4443
4445 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4444 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4446 // currently fails because upon disconnection and reconnection OnIceComplete is 4445 // currently fails because upon disconnection and reconnection OnIceComplete is
4447 // called more than once without returning to IceGatheringGathering. 4446 // called more than once without returning to IceGatheringGathering.
4448 4447
4449 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4448 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4450 WebRtcSessionTest, 4449 WebRtcSessionTest,
4451 testing::Values(ALREADY_GENERATED, 4450 testing::Values(ALREADY_GENERATED,
4452 DTLS_IDENTITY_STORE)); 4451 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsession.cc ('k') | webrtc/media/sctp/sctptransport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698