X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2Flibjingle%2Fsource%2Ftalk%2Fapp%2Fwebrtc%2Fwebrtcsession_unittest.cc;h=d9ce644aa917385803db640ab22f2ac2ce8caf9d;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=6d3a58131e13e558525795f5f57dcbc05f0f6d44;hpb=7338fba38ba696536d1cc9d389afd716a6ab2fe6;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/libjingle/source/talk/app/webrtc/webrtcsession_unittest.cc b/src/third_party/libjingle/source/talk/app/webrtc/webrtcsession_unittest.cc index 6d3a581..d9ce644 100644 --- a/src/third_party/libjingle/source/talk/app/webrtc/webrtcsession_unittest.cc +++ b/src/third_party/libjingle/source/talk/app/webrtc/webrtcsession_unittest.cc @@ -808,13 +808,15 @@ class WebRtcSessionTest : public testing::Test { // The method sets up a call from the session to itself, in a loopback // arrangement. It also uses a firewall rule to create a temporary - // disconnection. This code is placed as a method so that it can be invoked + // disconnection, and then a permanent disconnection. + // This code is placed in a method so that it can be invoked // by multiple tests with different allocators (e.g. with and without BUNDLE). // While running the call, this method also checks if the session goes through // the correct sequence of ICE states when a connection is established, // broken, and re-established. // The Connection state should go: - // New -> Checking -> Connected -> Disconnected -> Connected. + // New -> Checking -> (Connected) -> Completed -> Disconnected -> Completed + // -> Failed. // The Gathering state should go: New -> Gathering -> Completed. void TestLoopbackCall() { AddInterface(talk_base::SocketAddress(kClientAddrHost1, kClientAddrPort)); @@ -845,10 +847,10 @@ class WebRtcSessionTest : public testing::Test { EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionChecking, observer_.ice_connection_state_, kIceCandidatesTimeout); - EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected, + // The ice connection state is "Connected" too briefly to catch in a test. + EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted, observer_.ice_connection_state_, kIceCandidatesTimeout); - // TODO(bemasc): EXPECT(Completed) once the details are standardized. // Adding firewall rule to block ping requests, which should cause // transport channel failure. @@ -865,10 +867,21 @@ class WebRtcSessionTest : public testing::Test { // Session is automatically calling OnSignalingReady after creation of // new portallocator session which will allocate new set of candidates. - // TODO(bemasc): Change this to Completed once the details are standardized. - EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected, + EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted, observer_.ice_connection_state_, kIceCandidatesTimeout); + + // Now we block ping requests and wait until the ICE connection transitions + // to the Failed state. This will take at least 30 seconds because it must + // wait for the Port to timeout. + int port_timeout = 30000; + fss_->AddRule(false, + talk_base::FP_ANY, + talk_base::FD_ANY, + talk_base::SocketAddress(kClientAddrHost1, kClientAddrPort)); + EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionFailed, + observer_.ice_connection_state_, + kIceCandidatesTimeout + port_timeout); } void VerifyTransportType(const std::string& content_name, @@ -1421,10 +1434,12 @@ TEST_F(WebRtcSessionTest, TestAddRemoteCandidate) { EXPECT_EQ(1, candidates->at(0)->candidate().component()); EXPECT_EQ(2, candidates->at(1)->candidate().component()); + // |ice_candidate3| is identical to |ice_candidate2|. It can be added + // successfully, but the total count of candidates will not increase. candidate.set_component(2); JsepIceCandidate ice_candidate3(kMediaContentName0, 0, candidate); EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate3)); - ASSERT_EQ(3u, candidates->count()); + ASSERT_EQ(2u, candidates->count()); JsepIceCandidate bad_ice_candidate("bad content name", 99, candidate); EXPECT_FALSE(session_->ProcessIceMessage(&bad_ice_candidate)); @@ -2599,6 +2614,14 @@ TEST_F(WebRtcSessionTest, TestIceStatesBasic) { TestLoopbackCall(); } +// Runs the loopback call test with BUNDLE, STUN, and TCP enabled. +TEST_F(WebRtcSessionTest, TestIceStatesBundle) { + allocator_.set_flags(cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG | + cricket::PORTALLOCATOR_ENABLE_BUNDLE | + cricket::PORTALLOCATOR_DISABLE_RELAY); + TestLoopbackCall(); +} + TEST_F(WebRtcSessionTest, SetSdpFailedOnSessionError) { Init(NULL); cricket::MediaSessionOptions options;