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

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

Issue 2019423006: Adding more detail to MessageQueue::Dispatch logging. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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
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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 656
657 // We pass the candidates directly to the other side. 657 // We pass the candidates directly to the other side.
658 void OnCandidateGathered(cricket::TransportChannelImpl* ch, 658 void OnCandidateGathered(cricket::TransportChannelImpl* ch,
659 const cricket::Candidate& c) { 659 const cricket::Candidate& c) {
660 if (force_relay_ && c.type() != cricket::RELAY_PORT_TYPE) 660 if (force_relay_ && c.type() != cricket::RELAY_PORT_TYPE)
661 return; 661 return;
662 662
663 if (GetEndpoint(ch)->save_candidates_) { 663 if (GetEndpoint(ch)->save_candidates_) {
664 GetEndpoint(ch)->saved_candidates_.push_back(new CandidatesData(ch, c)); 664 GetEndpoint(ch)->saved_candidates_.push_back(new CandidatesData(ch, c));
665 } else { 665 } else {
666 main_->Post(this, MSG_ADD_CANDIDATES, new CandidatesData(ch, c)); 666 main_->Post(FROM_HERE, this, MSG_ADD_CANDIDATES,
667 new CandidatesData(ch, c));
667 } 668 }
668 } 669 }
669 670
670 void PauseCandidates(int endpoint) { 671 void PauseCandidates(int endpoint) {
671 GetEndpoint(endpoint)->save_candidates_ = true; 672 GetEndpoint(endpoint)->save_candidates_ = true;
672 } 673 }
673 674
674 void OnCandidatesRemoved(cricket::TransportChannelImpl* ch, 675 void OnCandidatesRemoved(cricket::TransportChannelImpl* ch,
675 const std::vector<cricket::Candidate>& candidates) { 676 const std::vector<cricket::Candidate>& candidates) {
676 // Candidate removals are not paused. 677 // Candidate removals are not paused.
677 CandidatesData* candidates_data = new CandidatesData(ch, candidates); 678 CandidatesData* candidates_data = new CandidatesData(ch, candidates);
678 main_->Post(this, MSG_REMOVE_CANDIDATES, candidates_data); 679 main_->Post(FROM_HERE, this, MSG_REMOVE_CANDIDATES, candidates_data);
679 } 680 }
680 681
681 // Tcp candidate verification has to be done when they are generated. 682 // Tcp candidate verification has to be done when they are generated.
682 void VerifySavedTcpCandidates(int endpoint, const std::string& tcptype) { 683 void VerifySavedTcpCandidates(int endpoint, const std::string& tcptype) {
683 for (auto& data : GetEndpoint(endpoint)->saved_candidates_) { 684 for (auto& data : GetEndpoint(endpoint)->saved_candidates_) {
684 for (auto& candidate : data->candidates) { 685 for (auto& candidate : data->candidates) {
685 EXPECT_EQ(candidate.protocol(), cricket::TCP_PROTOCOL_NAME); 686 EXPECT_EQ(candidate.protocol(), cricket::TCP_PROTOCOL_NAME);
686 EXPECT_EQ(candidate.tcptype(), tcptype); 687 EXPECT_EQ(candidate.tcptype(), tcptype);
687 if (candidate.tcptype() == cricket::TCPTYPE_ACTIVE_STR) { 688 if (candidate.tcptype() == cricket::TCPTYPE_ACTIVE_STR) {
688 EXPECT_EQ(candidate.address().port(), cricket::DISCARD_PORT); 689 EXPECT_EQ(candidate.address().port(), cricket::DISCARD_PORT);
689 } else if (candidate.tcptype() == cricket::TCPTYPE_PASSIVE_STR) { 690 } else if (candidate.tcptype() == cricket::TCPTYPE_PASSIVE_STR) {
690 EXPECT_NE(candidate.address().port(), cricket::DISCARD_PORT); 691 EXPECT_NE(candidate.address().port(), cricket::DISCARD_PORT);
691 } else { 692 } else {
692 FAIL() << "Unknown tcptype: " << candidate.tcptype(); 693 FAIL() << "Unknown tcptype: " << candidate.tcptype();
693 } 694 }
694 } 695 }
695 } 696 }
696 } 697 }
697 698
698 void ResumeCandidates(int endpoint) { 699 void ResumeCandidates(int endpoint) {
699 Endpoint* ed = GetEndpoint(endpoint); 700 Endpoint* ed = GetEndpoint(endpoint);
700 std::vector<CandidatesData*>::iterator it = ed->saved_candidates_.begin(); 701 std::vector<CandidatesData*>::iterator it = ed->saved_candidates_.begin();
701 for (; it != ed->saved_candidates_.end(); ++it) { 702 for (; it != ed->saved_candidates_.end(); ++it) {
702 main_->Post(this, MSG_ADD_CANDIDATES, *it); 703 main_->Post(FROM_HERE, this, MSG_ADD_CANDIDATES, *it);
703 } 704 }
704 ed->saved_candidates_.clear(); 705 ed->saved_candidates_.clear();
705 ed->save_candidates_ = false; 706 ed->save_candidates_ = false;
706 } 707 }
707 708
708 void OnMessage(rtc::Message* msg) { 709 void OnMessage(rtc::Message* msg) {
709 switch (msg->message_id) { 710 switch (msg->message_id) {
710 case MSG_ADD_CANDIDATES: { 711 case MSG_ADD_CANDIDATES: {
711 std::unique_ptr<CandidatesData> data( 712 std::unique_ptr<CandidatesData> data(
712 static_cast<CandidatesData*>(msg->pdata)); 713 static_cast<CandidatesData*>(msg->pdata));
(...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2894 2895
2895 // TCP Relay/Relay is the next. 2896 // TCP Relay/Relay is the next.
2896 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE, 2897 VerifyNextPingableConnection(cricket::RELAY_PORT_TYPE,
2897 cricket::RELAY_PORT_TYPE, 2898 cricket::RELAY_PORT_TYPE,
2898 cricket::TCP_PROTOCOL_NAME); 2899 cricket::TCP_PROTOCOL_NAME);
2899 2900
2900 // Finally, Local/Relay will be pinged. 2901 // Finally, Local/Relay will be pinged.
2901 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE, 2902 VerifyNextPingableConnection(cricket::LOCAL_PORT_TYPE,
2902 cricket::RELAY_PORT_TYPE); 2903 cricket::RELAY_PORT_TYPE);
2903 } 2904 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698