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

Side by Side Diff: webrtc/p2p/base/p2ptransportchannel_unittest.cc

Issue 1793553002: Using 64-bit timestamp in webrtc/p2p (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel.cc ('k') | webrtc/p2p/base/port.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 int32_t connect_start = rtc::Time(), connect_time; 507 int64_t connect_start = rtc::Time64();
508 int64_t connect_time;
508 509
509 // Create the channels and wait for them to connect. 510 // Create the channels and wait for them to connect.
510 CreateChannels(1); 511 CreateChannels(1);
511 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1() != NULL && 512 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1() != NULL &&
512 ep2_ch1() != NULL && 513 ep2_ch1() != NULL &&
513 ep1_ch1()->receiving() && 514 ep1_ch1()->receiving() &&
514 ep1_ch1()->writable() && 515 ep1_ch1()->writable() &&
515 ep2_ch1()->receiving() && 516 ep2_ch1()->receiving() &&
516 ep2_ch1()->writable(), 517 ep2_ch1()->writable(),
517 expected.connect_wait, 518 expected.connect_wait,
518 1000); 519 1000);
519 connect_time = rtc::TimeSince(connect_start); 520 connect_time = rtc::Time64() - connect_start;
520 if (connect_time < expected.connect_wait) { 521 if (connect_time < expected.connect_wait) {
521 LOG(LS_INFO) << "Connect time: " << connect_time << " ms"; 522 LOG(LS_INFO) << "Connect time: " << connect_time << " ms";
522 } else { 523 } else {
523 LOG(LS_INFO) << "Connect time: " << "TIMEOUT (" 524 LOG(LS_INFO) << "Connect time: " << "TIMEOUT ("
524 << expected.connect_wait << " ms)"; 525 << expected.connect_wait << " ms)";
525 } 526 }
526 527
527 // 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.
528 // This may take up to 2 seconds. 529 // This may take up to 2 seconds.
529 if (ep1_ch1()->best_connection() && 530 if (ep1_ch1()->best_connection() &&
530 ep2_ch1()->best_connection()) { 531 ep2_ch1()->best_connection()) {
531 int32_t converge_start = rtc::Time(), converge_time; 532 int64_t converge_start = rtc::Time64();
532 int converge_wait = 2000; 533 int64_t converge_time;
534 int64_t converge_wait = 2000;
533 EXPECT_TRUE_WAIT_MARGIN(CheckCandidate1(expected), converge_wait, 535 EXPECT_TRUE_WAIT_MARGIN(CheckCandidate1(expected), converge_wait,
534 converge_wait); 536 converge_wait);
535 // 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.
536 ExpectCandidate1(expected); 538 ExpectCandidate1(expected);
537 539
538 // Verifying remote channel best connection information. This is done 540 // Verifying remote channel best connection information. This is done
539 // 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
540 // from controlling (ep1) agent. We can easily predict from EP1 result 542 // from controlling (ep1) agent. We can easily predict from EP1 result
541 // matrix. 543 // matrix.
542 544
543 // Checking for best connection candidates information at remote. 545 // Checking for best connection candidates information at remote.
544 EXPECT_TRUE_WAIT(CheckCandidate2(expected), kDefaultTimeout); 546 EXPECT_TRUE_WAIT(CheckCandidate2(expected), kDefaultTimeout);
545 // For verbose 547 // For verbose
546 ExpectCandidate2(expected); 548 ExpectCandidate2(expected);
547 549
548 converge_time = rtc::TimeSince(converge_start); 550 converge_time = rtc::Time64() - converge_start;
549 if (converge_time < converge_wait) { 551 if (converge_time < converge_wait) {
550 LOG(LS_INFO) << "Converge time: " << converge_time << " ms"; 552 LOG(LS_INFO) << "Converge time: " << converge_time << " ms";
551 } else { 553 } else {
552 LOG(LS_INFO) << "Converge time: " << "TIMEOUT (" 554 LOG(LS_INFO) << "Converge time: " << "TIMEOUT ("
553 << converge_wait << " ms)"; 555 << converge_wait << " ms)";
554 } 556 }
555 } 557 }
556 // Try sending some data to other end. 558 // Try sending some data to other end.
557 TestSendRecv(1); 559 TestSendRecv(1);
558 560
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 int backup_ping_interval = 2000; 1766 int backup_ping_interval = 2000;
1765 ep2_ch1()->SetIceConfig(CreateIceConfig(2000, false, backup_ping_interval)); 1767 ep2_ch1()->SetIceConfig(CreateIceConfig(2000, false, backup_ping_interval));
1766 // After the state becomes COMPLETED, the backup connection will be pinged 1768 // After the state becomes COMPLETED, the backup connection will be pinged
1767 // once every |backup_ping_interval| milliseconds. 1769 // once every |backup_ping_interval| milliseconds.
1768 ASSERT_TRUE_WAIT(ep2_ch1()->GetState() == cricket::STATE_COMPLETED, 1000); 1770 ASSERT_TRUE_WAIT(ep2_ch1()->GetState() == cricket::STATE_COMPLETED, 1000);
1769 const std::vector<cricket::Connection*>& connections = 1771 const std::vector<cricket::Connection*>& connections =
1770 ep2_ch1()->connections(); 1772 ep2_ch1()->connections();
1771 ASSERT_EQ(2U, connections.size()); 1773 ASSERT_EQ(2U, connections.size());
1772 cricket::Connection* backup_conn = connections[1]; 1774 cricket::Connection* backup_conn = connections[1];
1773 EXPECT_TRUE_WAIT(backup_conn->writable(), 3000); 1775 EXPECT_TRUE_WAIT(backup_conn->writable(), 3000);
1774 uint32_t last_ping_response_ms = backup_conn->last_ping_response_received(); 1776 int64_t last_ping_response_ms = backup_conn->last_ping_response_received();
1775 EXPECT_TRUE_WAIT( 1777 EXPECT_TRUE_WAIT(
1776 last_ping_response_ms < backup_conn->last_ping_response_received(), 5000); 1778 last_ping_response_ms < backup_conn->last_ping_response_received(), 5000);
1777 int time_elapsed = 1779 int time_elapsed =
1778 backup_conn->last_ping_response_received() - last_ping_response_ms; 1780 backup_conn->last_ping_response_received() - last_ping_response_ms;
1779 LOG(LS_INFO) << "Time elapsed: " << time_elapsed; 1781 LOG(LS_INFO) << "Time elapsed: " << time_elapsed;
1780 EXPECT_GE(time_elapsed, backup_ping_interval); 1782 EXPECT_GE(time_elapsed, backup_ping_interval);
1781 } 1783 }
1782 1784
1783 TEST_F(P2PTransportChannelMultihomedTest, TestGetState) { 1785 TEST_F(P2PTransportChannelMultihomedTest, TestGetState) {
1784 AddAddress(0, kAlternateAddrs[0]); 1786 AddAddress(0, kAlternateAddrs[0]);
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
2719 2721
2720 // TCP Relay/Relay is the next. 2722 // TCP Relay/Relay is the next.
2721 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE, 2723 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE,
2722 cricket::RELAY_PORT_TYPE, 2724 cricket::RELAY_PORT_TYPE,
2723 cricket::TCP_PROTOCOL_NAME); 2725 cricket::TCP_PROTOCOL_NAME);
2724 2726
2725 // Finally, Local/Relay will be pinged. 2727 // Finally, Local/Relay will be pinged.
2726 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE, 2728 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE,
2727 cricket::RELAY_PORT_TYPE); 2729 cricket::RELAY_PORT_TYPE);
2728 } 2730 }
OLDNEW
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel.cc ('k') | webrtc/p2p/base/port.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698