| OLD | NEW |
| 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 Loading... |
| 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" |
| 49 #include "webrtc/p2p/client/basicportallocator.h" | 50 #include "webrtc/p2p/client/basicportallocator.h" |
| 50 #include "webrtc/pc/channelmanager.h" | 51 #include "webrtc/pc/channelmanager.h" |
| 51 #include "webrtc/pc/mediasession.h" | 52 #include "webrtc/pc/mediasession.h" |
| 52 | 53 |
| 53 #define MAYBE_SKIP_TEST(feature) \ | 54 #define MAYBE_SKIP_TEST(feature) \ |
| 54 if (!(feature())) { \ | 55 if (!(feature())) { \ |
| 55 LOG(LS_INFO) << "Feature disabled... skipping"; \ | 56 LOG(LS_INFO) << "Feature disabled... skipping"; \ |
| 56 return; \ | 57 return; \ |
| 57 } | 58 } |
| 58 | 59 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 std::vector<PeerConnectionInterface::IceConnectionState> | 212 std::vector<PeerConnectionInterface::IceConnectionState> |
| 212 ice_connection_state_history_; | 213 ice_connection_state_history_; |
| 213 size_t num_candidates_removed_ = 0; | 214 size_t num_candidates_removed_ = 0; |
| 214 }; | 215 }; |
| 215 | 216 |
| 216 // Used for tests in this file to verify that WebRtcSession responds to signals | 217 // Used for tests in this file to verify that WebRtcSession responds to signals |
| 217 // from the SctpTransport correctly, and calls Start with the correct | 218 // from the SctpTransport correctly, and calls Start with the correct |
| 218 // local/remote ports. | 219 // local/remote ports. |
| 219 class FakeSctpTransport : public cricket::SctpTransportInternal { | 220 class FakeSctpTransport : public cricket::SctpTransportInternal { |
| 220 public: | 221 public: |
| 221 void SetTransportChannel(rtc::PacketTransportInterface* channel) override {} | 222 void SetTransportChannel(cricket::TransportChannel* channel) override {} |
| 222 bool Start(int local_port, int remote_port) override { | 223 bool Start(int local_port, int remote_port) override { |
| 223 local_port_ = local_port; | 224 local_port_ = local_port; |
| 224 remote_port_ = remote_port; | 225 remote_port_ = remote_port; |
| 225 return true; | 226 return true; |
| 226 } | 227 } |
| 227 bool OpenStream(int sid) override { return true; } | 228 bool OpenStream(int sid) override { return true; } |
| 228 bool ResetStream(int sid) override { return true; } | 229 bool ResetStream(int sid) override { return true; } |
| 229 bool SendData(const cricket::SendDataParams& params, | 230 bool SendData(const cricket::SendDataParams& params, |
| 230 const rtc::CopyOnWriteBuffer& payload, | 231 const rtc::CopyOnWriteBuffer& payload, |
| 231 cricket::SendDataResult* result = nullptr) override { | 232 cricket::SendDataResult* result = nullptr) override { |
| 232 return true; | 233 return true; |
| 233 } | 234 } |
| 234 bool ReadyToSendData() override { return true; } | 235 bool ReadyToSendData() override { return true; } |
| 235 void set_debug_name_for_testing(const char* debug_name) override {} | 236 void set_debug_name_for_testing(const char* debug_name) override {} |
| 236 | 237 |
| 237 int local_port() const { return local_port_; } | 238 int local_port() const { return local_port_; } |
| 238 int remote_port() const { return remote_port_; } | 239 int remote_port() const { return remote_port_; } |
| 239 | 240 |
| 240 private: | 241 private: |
| 241 int local_port_ = -1; | 242 int local_port_ = -1; |
| 242 int remote_port_ = -1; | 243 int remote_port_ = -1; |
| 243 }; | 244 }; |
| 244 | 245 |
| 245 class FakeSctpTransportFactory : public cricket::SctpTransportInternalFactory { | 246 class FakeSctpTransportFactory : public cricket::SctpTransportInternalFactory { |
| 246 public: | 247 public: |
| 247 std::unique_ptr<cricket::SctpTransportInternal> CreateSctpTransport( | 248 std::unique_ptr<cricket::SctpTransportInternal> CreateSctpTransport( |
| 248 rtc::PacketTransportInterface*) override { | 249 cricket::TransportChannel*) override { |
| 249 last_fake_sctp_transport_ = new FakeSctpTransport(); | 250 last_fake_sctp_transport_ = new FakeSctpTransport(); |
| 250 return std::unique_ptr<cricket::SctpTransportInternal>( | 251 return std::unique_ptr<cricket::SctpTransportInternal>( |
| 251 last_fake_sctp_transport_); | 252 last_fake_sctp_transport_); |
| 252 } | 253 } |
| 253 | 254 |
| 254 FakeSctpTransport* last_fake_sctp_transport() { | 255 FakeSctpTransport* last_fake_sctp_transport() { |
| 255 return last_fake_sctp_transport_; | 256 return last_fake_sctp_transport_; |
| 256 } | 257 } |
| 257 | 258 |
| 258 private: | 259 private: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 rtc::PacketTransportInterface* video_rtcp_transport_channel() { | 299 rtc::PacketTransportInterface* video_rtcp_transport_channel() { |
| 299 return rtcp_transport_channel(video_channel()); | 300 return rtcp_transport_channel(video_channel()); |
| 300 } | 301 } |
| 301 | 302 |
| 302 private: | 303 private: |
| 303 rtc::PacketTransportInterface* rtp_transport_channel( | 304 rtc::PacketTransportInterface* rtp_transport_channel( |
| 304 cricket::BaseChannel* ch) { | 305 cricket::BaseChannel* ch) { |
| 305 if (!ch) { | 306 if (!ch) { |
| 306 return nullptr; | 307 return nullptr; |
| 307 } | 308 } |
| 308 return ch->rtp_dtls_transport(); | 309 return ch->rtp_transport(); |
| 309 } | 310 } |
| 310 | 311 |
| 311 rtc::PacketTransportInterface* rtcp_transport_channel( | 312 rtc::PacketTransportInterface* rtcp_transport_channel( |
| 312 cricket::BaseChannel* ch) { | 313 cricket::BaseChannel* ch) { |
| 313 if (!ch) { | 314 if (!ch) { |
| 314 return nullptr; | 315 return nullptr; |
| 315 } | 316 } |
| 316 return ch->rtcp_dtls_transport(); | 317 return ch->rtcp_transport(); |
| 317 } | 318 } |
| 318 }; | 319 }; |
| 319 | 320 |
| 320 class WebRtcSessionCreateSDPObserverForTest | 321 class WebRtcSessionCreateSDPObserverForTest |
| 321 : public rtc::RefCountedObject<CreateSessionDescriptionObserver> { | 322 : public rtc::RefCountedObject<CreateSessionDescriptionObserver> { |
| 322 public: | 323 public: |
| 323 enum State { | 324 enum State { |
| 324 kInit, | 325 kInit, |
| 325 kFailed, | 326 kFailed, |
| 326 kSucceeded, | 327 kSucceeded, |
| (...skipping 4115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4442 } | 4443 } |
| 4443 | 4444 |
| 4444 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4445 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
| 4445 // currently fails because upon disconnection and reconnection OnIceComplete is | 4446 // currently fails because upon disconnection and reconnection OnIceComplete is |
| 4446 // called more than once without returning to IceGatheringGathering. | 4447 // called more than once without returning to IceGatheringGathering. |
| 4447 | 4448 |
| 4448 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4449 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
| 4449 WebRtcSessionTest, | 4450 WebRtcSessionTest, |
| 4450 testing::Values(ALREADY_GENERATED, | 4451 testing::Values(ALREADY_GENERATED, |
| 4451 DTLS_IDENTITY_STORE)); | 4452 DTLS_IDENTITY_STORE)); |
| OLD | NEW |