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

Side by Side Diff: webrtc/pc/peerconnection_unittest.cc

Issue 2770233003: Implemented the GetSources() in native code. (Closed)
Patch Set: Merge and add the tests. Created 3 years, 8 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 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 2620 matching lines...) Expand 10 before | Expand all | Expand 10 after
2631 webrtc::PeerConnectionInterface::kIceConnectionConnected || 2631 webrtc::PeerConnectionInterface::kIceConnectionConnected ||
2632 initializing_client()->ice_connection_state() == 2632 initializing_client()->ice_connection_state() ==
2633 webrtc::PeerConnectionInterface::kIceConnectionCompleted), 2633 webrtc::PeerConnectionInterface::kIceConnectionCompleted),
2634 total_connection_time_ms, fake_clock); 2634 total_connection_time_ms, fake_clock);
2635 // Need to free the clients here since they're using things we created on 2635 // Need to free the clients here since they're using things we created on
2636 // the stack. 2636 // the stack.
2637 delete set_initializing_client(nullptr); 2637 delete set_initializing_client(nullptr);
2638 delete set_receiving_client(nullptr); 2638 delete set_receiving_client(nullptr);
2639 } 2639 }
2640 2640
2641 // The end to end test of the method GetContributingSources(). Tests the
2642 // function calling chain from API layer down to the rtp_rtcp module.
2643 TEST_F(P2PTestConductor, TestGetContributingSources) {
Taylor Brandstetter 2017/03/30 22:55:38 I recently refactored the tests in this file, FYI.
Zhi Huang 2017/03/31 06:44:05 Acknowledged.
2644 ASSERT_TRUE(CreateTestClients());
2645 LocalP2PTest();
2646
2647 ASSERT_GT(receiving_client()->pc()->GetReceivers().size(), 0);
2648 auto receiver = receiving_client()->pc()->GetReceivers()[0];
2649 ASSERT_EQ(receiver->media_type(), cricket::MEDIA_TYPE_AUDIO);
2650
2651 auto contributing_sources = receiver->GetContributingSources();
2652 ASSERT_GT(receiver->GetParameters().encodings.size(), 0);
2653 EXPECT_EQ(receiver->GetParameters().encodings[0].ssrc,
2654 contributing_sources[0]->source());
2655 }
2656
2641 class IceServerParsingTest : public testing::Test { 2657 class IceServerParsingTest : public testing::Test {
2642 public: 2658 public:
2643 // Convenience for parsing a single URL. 2659 // Convenience for parsing a single URL.
2644 bool ParseUrl(const std::string& url) { 2660 bool ParseUrl(const std::string& url) {
2645 return ParseUrl(url, std::string(), std::string()); 2661 return ParseUrl(url, std::string(), std::string());
2646 } 2662 }
2647 2663
2648 bool ParseTurnUrl(const std::string& url) { 2664 bool ParseTurnUrl(const std::string& url) {
2649 return ParseUrl(url, "username", "password"); 2665 return ParseUrl(url, "username", "password");
2650 } 2666 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2860 servers.push_back(server); 2876 servers.push_back(server);
2861 EXPECT_EQ(webrtc::RTCErrorType::NONE, 2877 EXPECT_EQ(webrtc::RTCErrorType::NONE,
2862 webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); 2878 webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_));
2863 EXPECT_EQ(2U, turn_servers_.size()); 2879 EXPECT_EQ(2U, turn_servers_.size());
2864 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); 2880 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority);
2865 } 2881 }
2866 2882
2867 #endif // if !defined(THREAD_SANITIZER) 2883 #endif // if !defined(THREAD_SANITIZER)
2868 2884
2869 } // namespace 2885 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698