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

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

Issue 2606123002: Remove the dependency of TransportChannel and TransportChannelImpl. (Closed)
Patch Set: Merge 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
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 27 matching lines...) Expand all
38 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 38 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
39 #include "webrtc/media/base/fakemediaengine.h" 39 #include "webrtc/media/base/fakemediaengine.h"
40 #include "webrtc/media/base/fakevideorenderer.h" 40 #include "webrtc/media/base/fakevideorenderer.h"
41 #include "webrtc/media/base/mediachannel.h" 41 #include "webrtc/media/base/mediachannel.h"
42 #include "webrtc/media/engine/fakewebrtccall.h" 42 #include "webrtc/media/engine/fakewebrtccall.h"
43 #include "webrtc/media/sctp/sctptransportinternal.h" 43 #include "webrtc/media/sctp/sctptransportinternal.h"
44 #include "webrtc/p2p/base/packettransportinterface.h" 44 #include "webrtc/p2p/base/packettransportinterface.h"
45 #include "webrtc/p2p/base/stunserver.h" 45 #include "webrtc/p2p/base/stunserver.h"
46 #include "webrtc/p2p/base/teststunserver.h" 46 #include "webrtc/p2p/base/teststunserver.h"
47 #include "webrtc/p2p/base/testturnserver.h" 47 #include "webrtc/p2p/base/testturnserver.h"
48 #include "webrtc/p2p/base/transportchannel.h"
49 #include "webrtc/p2p/client/basicportallocator.h" 48 #include "webrtc/p2p/client/basicportallocator.h"
50 #include "webrtc/pc/channelmanager.h" 49 #include "webrtc/pc/channelmanager.h"
51 #include "webrtc/pc/mediasession.h" 50 #include "webrtc/pc/mediasession.h"
52 51
53 #define MAYBE_SKIP_TEST(feature) \ 52 #define MAYBE_SKIP_TEST(feature) \
54 if (!(feature())) { \ 53 if (!(feature())) { \
55 LOG(LS_INFO) << "Feature disabled... skipping"; \ 54 LOG(LS_INFO) << "Feature disabled... skipping"; \
56 return; \ 55 return; \
57 } 56 }
58 57
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 std::vector<PeerConnectionInterface::IceConnectionState> 210 std::vector<PeerConnectionInterface::IceConnectionState>
212 ice_connection_state_history_; 211 ice_connection_state_history_;
213 size_t num_candidates_removed_ = 0; 212 size_t num_candidates_removed_ = 0;
214 }; 213 };
215 214
216 // Used for tests in this file to verify that WebRtcSession responds to signals 215 // Used for tests in this file to verify that WebRtcSession responds to signals
217 // from the SctpTransport correctly, and calls Start with the correct 216 // from the SctpTransport correctly, and calls Start with the correct
218 // local/remote ports. 217 // local/remote ports.
219 class FakeSctpTransport : public cricket::SctpTransportInternal { 218 class FakeSctpTransport : public cricket::SctpTransportInternal {
220 public: 219 public:
221 void SetTransportChannel(cricket::TransportChannel* channel) override {} 220 void SetTransportChannel(cricket::DtlsTransportInternal* channel) override {}
222 bool Start(int local_port, int remote_port) override { 221 bool Start(int local_port, int remote_port) override {
223 local_port_ = local_port; 222 local_port_ = local_port;
224 remote_port_ = remote_port; 223 remote_port_ = remote_port;
225 return true; 224 return true;
226 } 225 }
227 bool OpenStream(int sid) override { return true; } 226 bool OpenStream(int sid) override { return true; }
228 bool ResetStream(int sid) override { return true; } 227 bool ResetStream(int sid) override { return true; }
229 bool SendData(const cricket::SendDataParams& params, 228 bool SendData(const cricket::SendDataParams& params,
230 const rtc::CopyOnWriteBuffer& payload, 229 const rtc::CopyOnWriteBuffer& payload,
231 cricket::SendDataResult* result = nullptr) override { 230 cricket::SendDataResult* result = nullptr) override {
232 return true; 231 return true;
233 } 232 }
234 bool ReadyToSendData() override { return true; } 233 bool ReadyToSendData() override { return true; }
235 void set_debug_name_for_testing(const char* debug_name) override {} 234 void set_debug_name_for_testing(const char* debug_name) override {}
236 235
237 int local_port() const { return local_port_; } 236 int local_port() const { return local_port_; }
238 int remote_port() const { return remote_port_; } 237 int remote_port() const { return remote_port_; }
239 238
240 private: 239 private:
241 int local_port_ = -1; 240 int local_port_ = -1;
242 int remote_port_ = -1; 241 int remote_port_ = -1;
243 }; 242 };
244 243
245 class FakeSctpTransportFactory : public cricket::SctpTransportInternalFactory { 244 class FakeSctpTransportFactory : public cricket::SctpTransportInternalFactory {
246 public: 245 public:
247 std::unique_ptr<cricket::SctpTransportInternal> CreateSctpTransport( 246 std::unique_ptr<cricket::SctpTransportInternal> CreateSctpTransport(
248 cricket::TransportChannel*) override { 247 cricket::DtlsTransportInternal*) override {
249 last_fake_sctp_transport_ = new FakeSctpTransport(); 248 last_fake_sctp_transport_ = new FakeSctpTransport();
250 return std::unique_ptr<cricket::SctpTransportInternal>( 249 return std::unique_ptr<cricket::SctpTransportInternal>(
251 last_fake_sctp_transport_); 250 last_fake_sctp_transport_);
252 } 251 }
253 252
254 FakeSctpTransport* last_fake_sctp_transport() { 253 FakeSctpTransport* last_fake_sctp_transport() {
255 return last_fake_sctp_transport_; 254 return last_fake_sctp_transport_;
256 } 255 }
257 256
258 private: 257 private:
(...skipping 4183 matching lines...) Expand 10 before | Expand all | Expand 10 after
4442 } 4441 }
4443 4442
4444 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4443 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4445 // currently fails because upon disconnection and reconnection OnIceComplete is 4444 // currently fails because upon disconnection and reconnection OnIceComplete is
4446 // called more than once without returning to IceGatheringGathering. 4445 // called more than once without returning to IceGatheringGathering.
4447 4446
4448 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4447 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4449 WebRtcSessionTest, 4448 WebRtcSessionTest,
4450 testing::Values(ALREADY_GENERATED, 4449 testing::Values(ALREADY_GENERATED,
4451 DTLS_IDENTITY_STORE)); 4450 DTLS_IDENTITY_STORE));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698