OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2009 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 if (remote_type != expected.remote_type2) { | 497 if (remote_type != expected.remote_type2) { |
498 EXPECT_TRUE(expected.remote_type2 == cricket::LOCAL_PORT_TYPE || | 498 EXPECT_TRUE(expected.remote_type2 == cricket::LOCAL_PORT_TYPE || |
499 expected.remote_type2 == cricket::STUN_PORT_TYPE); | 499 expected.remote_type2 == cricket::STUN_PORT_TYPE); |
500 EXPECT_TRUE(remote_type == cricket::LOCAL_PORT_TYPE || | 500 EXPECT_TRUE(remote_type == cricket::LOCAL_PORT_TYPE || |
501 remote_type == cricket::STUN_PORT_TYPE || | 501 remote_type == cricket::STUN_PORT_TYPE || |
502 remote_type == cricket::PRFLX_PORT_TYPE); | 502 remote_type == cricket::PRFLX_PORT_TYPE); |
503 } | 503 } |
504 } | 504 } |
505 | 505 |
506 void Test(const Result& expected) { | 506 void Test(const Result& expected) { |
507 int64_t connect_start = rtc::Time64(); | 507 int64_t connect_start = rtc::TimeMillis(); |
508 int64_t connect_time; | 508 int64_t connect_time; |
509 | 509 |
510 // Create the channels and wait for them to connect. | 510 // Create the channels and wait for them to connect. |
511 CreateChannels(1); | 511 CreateChannels(1); |
512 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1() != NULL && | 512 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1() != NULL && |
513 ep2_ch1() != NULL && | 513 ep2_ch1() != NULL && |
514 ep1_ch1()->receiving() && | 514 ep1_ch1()->receiving() && |
515 ep1_ch1()->writable() && | 515 ep1_ch1()->writable() && |
516 ep2_ch1()->receiving() && | 516 ep2_ch1()->receiving() && |
517 ep2_ch1()->writable(), | 517 ep2_ch1()->writable(), |
518 expected.connect_wait, | 518 expected.connect_wait, |
519 1000); | 519 1000); |
520 connect_time = rtc::Time64() - connect_start; | 520 connect_time = rtc::TimeMillis() - connect_start; |
521 if (connect_time < expected.connect_wait) { | 521 if (connect_time < expected.connect_wait) { |
522 LOG(LS_INFO) << "Connect time: " << connect_time << " ms"; | 522 LOG(LS_INFO) << "Connect time: " << connect_time << " ms"; |
523 } else { | 523 } else { |
524 LOG(LS_INFO) << "Connect time: " << "TIMEOUT (" | 524 LOG(LS_INFO) << "Connect time: " << "TIMEOUT (" |
525 << expected.connect_wait << " ms)"; | 525 << expected.connect_wait << " ms)"; |
526 } | 526 } |
527 | 527 |
528 // Allow a few turns of the crank for the best connections to emerge. | 528 // Allow a few turns of the crank for the best connections to emerge. |
529 // This may take up to 2 seconds. | 529 // This may take up to 2 seconds. |
530 if (ep1_ch1()->best_connection() && | 530 if (ep1_ch1()->best_connection() && |
531 ep2_ch1()->best_connection()) { | 531 ep2_ch1()->best_connection()) { |
532 int64_t converge_start = rtc::Time64(); | 532 int64_t converge_start = rtc::TimeMillis(); |
533 int64_t converge_time; | 533 int64_t converge_time; |
534 int64_t converge_wait = 2000; | 534 int64_t converge_wait = 2000; |
535 EXPECT_TRUE_WAIT_MARGIN(CheckCandidate1(expected), converge_wait, | 535 EXPECT_TRUE_WAIT_MARGIN(CheckCandidate1(expected), converge_wait, |
536 converge_wait); | 536 converge_wait); |
537 // Also do EXPECT_EQ on each part so that failures are more verbose. | 537 // Also do EXPECT_EQ on each part so that failures are more verbose. |
538 ExpectCandidate1(expected); | 538 ExpectCandidate1(expected); |
539 | 539 |
540 // Verifying remote channel best connection information. This is done | 540 // Verifying remote channel best connection information. This is done |
541 // only for the RFC 5245 as controlled agent will use USE-CANDIDATE | 541 // only for the RFC 5245 as controlled agent will use USE-CANDIDATE |
542 // from controlling (ep1) agent. We can easily predict from EP1 result | 542 // from controlling (ep1) agent. We can easily predict from EP1 result |
543 // matrix. | 543 // matrix. |
544 | 544 |
545 // Checking for best connection candidates information at remote. | 545 // Checking for best connection candidates information at remote. |
546 EXPECT_TRUE_WAIT(CheckCandidate2(expected), kDefaultTimeout); | 546 EXPECT_TRUE_WAIT(CheckCandidate2(expected), kDefaultTimeout); |
547 // For verbose | 547 // For verbose |
548 ExpectCandidate2(expected); | 548 ExpectCandidate2(expected); |
549 | 549 |
550 converge_time = rtc::Time64() - converge_start; | 550 converge_time = rtc::TimeMillis() - converge_start; |
551 if (converge_time < converge_wait) { | 551 if (converge_time < converge_wait) { |
552 LOG(LS_INFO) << "Converge time: " << converge_time << " ms"; | 552 LOG(LS_INFO) << "Converge time: " << converge_time << " ms"; |
553 } else { | 553 } else { |
554 LOG(LS_INFO) << "Converge time: " << "TIMEOUT (" | 554 LOG(LS_INFO) << "Converge time: " << "TIMEOUT (" |
555 << converge_wait << " ms)"; | 555 << converge_wait << " ms)"; |
556 } | 556 } |
557 } | 557 } |
558 // Try sending some data to other end. | 558 // Try sending some data to other end. |
559 TestSendRecv(1); | 559 TestSendRecv(1); |
560 | 560 |
(...skipping 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2795 | 2795 |
2796 // TCP Relay/Relay is the next. | 2796 // TCP Relay/Relay is the next. |
2797 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE, | 2797 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE, |
2798 cricket::RELAY_PORT_TYPE, | 2798 cricket::RELAY_PORT_TYPE, |
2799 cricket::TCP_PROTOCOL_NAME); | 2799 cricket::TCP_PROTOCOL_NAME); |
2800 | 2800 |
2801 // Finally, Local/Relay will be pinged. | 2801 // Finally, Local/Relay will be pinged. |
2802 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE, | 2802 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE, |
2803 cricket::RELAY_PORT_TYPE); | 2803 cricket::RELAY_PORT_TYPE); |
2804 } | 2804 } |
OLD | NEW |