| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 3557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3568 | 3568 |
| 3569 ASSERT_EQ(1UL, ch->recv_codecs().size()); | 3569 ASSERT_EQ(1UL, ch->recv_codecs().size()); |
| 3570 EXPECT_EQ(cricket::kGoogleSctpDataCodecId, ch->recv_codecs()[0].id); | 3570 EXPECT_EQ(cricket::kGoogleSctpDataCodecId, ch->recv_codecs()[0].id); |
| 3571 EXPECT_EQ(0, strcmp(cricket::kGoogleSctpDataCodecName, | 3571 EXPECT_EQ(0, strcmp(cricket::kGoogleSctpDataCodecName, |
| 3572 ch->recv_codecs()[0].name.c_str())); | 3572 ch->recv_codecs()[0].name.c_str())); |
| 3573 EXPECT_TRUE(ch->recv_codecs()[0].GetParam(cricket::kCodecParamPort, | 3573 EXPECT_TRUE(ch->recv_codecs()[0].GetParam(cricket::kCodecParamPort, |
| 3574 &portnum)); | 3574 &portnum)); |
| 3575 EXPECT_EQ(new_recv_port, portnum); | 3575 EXPECT_EQ(new_recv_port, portnum); |
| 3576 } | 3576 } |
| 3577 | 3577 |
| 3578 // TODO(hbos): Add the following test once RTCCertificate is passed around | 3578 TEST_F(WebRtcSessionTest, TestUsesProvidedCertificate) { |
| 3579 // outside of WebRtcSessionDescriptionFactory code and there exists a | 3579 rtc::scoped_refptr<rtc::RTCCertificate> certificate = |
| 3580 // WebRtcSession::certificate(). | 3580 FakeDtlsIdentityStore::GenerateCertificate(); |
| 3581 //TEST_F(WebRtcSessionTest, TestUsesProvidedCertificate) { | 3581 |
| 3582 // rtc::scoped_refptr<rtc::RTCCertificate> certificate = | 3582 PeerConnectionInterface::RTCConfiguration configuration; |
| 3583 // FakeDtlsIdentityStore::GenerateCertificate(); | 3583 configuration.certificates.push_back(certificate); |
| 3584 // | 3584 Init(nullptr, configuration); |
| 3585 // PeerConnectionInterface::RTCConfiguration configuration; | 3585 EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000); |
| 3586 // configuration.certificates.push_back(certificate); | 3586 |
| 3587 // Init(nullptr, configuration); | 3587 EXPECT_EQ(session_->certificate(), certificate); |
| 3588 // EXPECT_TRUE_WAIT(!session_->waiting_for_identity_for_testing(), 1000); | 3588 } |
| 3589 // | |
| 3590 // EXPECT_EQ(session_->certificate(), certificate); | |
| 3591 //} | |
| 3592 | 3589 |
| 3593 // Verifies that CreateOffer succeeds when CreateOffer is called before async | 3590 // Verifies that CreateOffer succeeds when CreateOffer is called before async |
| 3594 // identity generation is finished (even if a certificate is provided this is | 3591 // identity generation is finished (even if a certificate is provided this is |
| 3595 // an async op). | 3592 // an async op). |
| 3596 TEST_P(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) { | 3593 TEST_P(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) { |
| 3597 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3594 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3598 InitWithDtls(GetParam()); | 3595 InitWithDtls(GetParam()); |
| 3599 | 3596 |
| 3600 EXPECT_TRUE(session_->waiting_for_identity_for_testing()); | 3597 EXPECT_TRUE(session_->waiting_for_certificate_for_testing()); |
| 3601 mediastream_signaling_.SendAudioVideoStream1(); | 3598 mediastream_signaling_.SendAudioVideoStream1(); |
| 3602 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3599 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
| 3603 | 3600 |
| 3604 EXPECT_TRUE(offer != NULL); | 3601 EXPECT_TRUE(offer != NULL); |
| 3605 VerifyNoCryptoParams(offer->description(), true); | 3602 VerifyNoCryptoParams(offer->description(), true); |
| 3606 VerifyFingerprintStatus(offer->description(), true); | 3603 VerifyFingerprintStatus(offer->description(), true); |
| 3607 } | 3604 } |
| 3608 | 3605 |
| 3609 // Verifies that CreateAnswer succeeds when CreateOffer is called before async | 3606 // Verifies that CreateAnswer succeeds when CreateOffer is called before async |
| 3610 // identity generation is finished (even if a certificate is provided this is | 3607 // identity generation is finished (even if a certificate is provided this is |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3627 VerifyFingerprintStatus(answer->description(), true); | 3624 VerifyFingerprintStatus(answer->description(), true); |
| 3628 } | 3625 } |
| 3629 | 3626 |
| 3630 // Verifies that CreateOffer succeeds when CreateOffer is called after async | 3627 // Verifies that CreateOffer succeeds when CreateOffer is called after async |
| 3631 // identity generation is finished (even if a certificate is provided this is | 3628 // identity generation is finished (even if a certificate is provided this is |
| 3632 // an async op). | 3629 // an async op). |
| 3633 TEST_P(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnSuccess) { | 3630 TEST_P(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnSuccess) { |
| 3634 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3631 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3635 InitWithDtls(GetParam()); | 3632 InitWithDtls(GetParam()); |
| 3636 | 3633 |
| 3637 EXPECT_TRUE_WAIT(!session_->waiting_for_identity_for_testing(), 1000); | 3634 EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000); |
| 3638 | 3635 |
| 3639 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3636 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
| 3640 EXPECT_TRUE(offer != NULL); | 3637 EXPECT_TRUE(offer != NULL); |
| 3641 } | 3638 } |
| 3642 | 3639 |
| 3643 // Verifies that CreateOffer fails when CreateOffer is called after async | 3640 // Verifies that CreateOffer fails when CreateOffer is called after async |
| 3644 // identity generation fails. | 3641 // identity generation fails. |
| 3645 TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnFailure) { | 3642 TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnFailure) { |
| 3646 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3643 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 3647 InitWithDtlsIdentityGenFail(); | 3644 InitWithDtlsIdentityGenFail(); |
| 3648 | 3645 |
| 3649 EXPECT_TRUE_WAIT(!session_->waiting_for_identity_for_testing(), 1000); | 3646 EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000); |
| 3650 | 3647 |
| 3651 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); | 3648 rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer()); |
| 3652 EXPECT_TRUE(offer == NULL); | 3649 EXPECT_TRUE(offer == NULL); |
| 3653 } | 3650 } |
| 3654 | 3651 |
| 3655 // Verifies that CreateOffer succeeds when Multiple CreateOffer calls are made | 3652 // Verifies that CreateOffer succeeds when Multiple CreateOffer calls are made |
| 3656 // before async identity generation is finished. | 3653 // before async identity generation is finished. |
| 3657 TEST_P(WebRtcSessionTest, | 3654 TEST_P(WebRtcSessionTest, |
| 3658 TestMultipleCreateOfferBeforeIdentityRequestReturnSuccess) { | 3655 TestMultipleCreateOfferBeforeIdentityRequestReturnSuccess) { |
| 3659 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 3656 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3941 } | 3938 } |
| 3942 } | 3939 } |
| 3943 | 3940 |
| 3944 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 3941 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
| 3945 // currently fails because upon disconnection and reconnection OnIceComplete is | 3942 // currently fails because upon disconnection and reconnection OnIceComplete is |
| 3946 // called more than once without returning to IceGatheringGathering. | 3943 // called more than once without returning to IceGatheringGathering. |
| 3947 | 3944 |
| 3948 INSTANTIATE_TEST_CASE_P( | 3945 INSTANTIATE_TEST_CASE_P( |
| 3949 WebRtcSessionTests, WebRtcSessionTest, | 3946 WebRtcSessionTests, WebRtcSessionTest, |
| 3950 testing::Values(ALREADY_GENERATED, DTLS_IDENTITY_STORE)); | 3947 testing::Values(ALREADY_GENERATED, DTLS_IDENTITY_STORE)); |
| OLD | NEW |