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

Side by Side Diff: talk/app/webrtc/peerconnectionendtoend_unittest.cc

Issue 1553033002: Roll chromium_revision d66326c..4df108a (367167:367307) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Added references to bugs. Created 4 years, 11 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 * libjingle 2 * libjingle
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 using webrtc::DataChannelInterface; 43 using webrtc::DataChannelInterface;
44 using webrtc::FakeConstraints; 44 using webrtc::FakeConstraints;
45 using webrtc::MediaConstraintsInterface; 45 using webrtc::MediaConstraintsInterface;
46 using webrtc::MediaStreamInterface; 46 using webrtc::MediaStreamInterface;
47 using webrtc::PeerConnectionInterface; 47 using webrtc::PeerConnectionInterface;
48 48
49 namespace { 49 namespace {
50 50
51 const size_t kMaxWait = 10000; 51 const size_t kMaxWait = 10000;
52 52
53 void RemoveLinesFromSdp(const std::string& line_start,
54 std::string* sdp) {
55 const char kSdpLineEnd[] = "\r\n";
56 size_t ssrc_pos = 0;
57 while ((ssrc_pos = sdp->find(line_start, ssrc_pos)) !=
58 std::string::npos) {
59 size_t end_ssrc = sdp->find(kSdpLineEnd, ssrc_pos);
60 sdp->erase(ssrc_pos, end_ssrc - ssrc_pos + strlen(kSdpLineEnd));
61 }
62 }
63
64 // Add |newlines| to the |message| after |line|.
65 void InjectAfter(const std::string& line,
66 const std::string& newlines,
67 std::string* message) {
68 const std::string tmp = line + newlines;
69 rtc::replace_substrs(line.c_str(), line.length(),
70 tmp.c_str(), tmp.length(), message);
71 }
72
73 void Replace(const std::string& line,
74 const std::string& newlines,
75 std::string* message) {
76 rtc::replace_substrs(line.c_str(), line.length(),
77 newlines.c_str(), newlines.length(), message);
78 }
79
80 void UseExternalSdes(std::string* sdp) {
81 // Remove current crypto specification.
82 RemoveLinesFromSdp("a=crypto", sdp);
83 RemoveLinesFromSdp("a=fingerprint", sdp);
84 // Add external crypto.
85 const char kAudioSdes[] =
86 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
87 "inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR\r\n";
88 const char kVideoSdes[] =
89 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
90 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj\r\n";
91 const char kDataSdes[] =
92 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
93 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj\r\n";
94 InjectAfter("a=mid:audio\r\n", kAudioSdes, sdp);
95 InjectAfter("a=mid:video\r\n", kVideoSdes, sdp);
96 InjectAfter("a=mid:data\r\n", kDataSdes, sdp);
97 }
98
99 void RemoveBundle(std::string* sdp) {
100 RemoveLinesFromSdp("a=group:BUNDLE", sdp);
101 }
102
103 } // namespace 53 } // namespace
104 54
105 class PeerConnectionEndToEndTest 55 class PeerConnectionEndToEndTest
106 : public sigslot::has_slots<>, 56 : public sigslot::has_slots<>,
107 public testing::Test { 57 public testing::Test {
108 public: 58 public:
109 typedef std::vector<rtc::scoped_refptr<DataChannelInterface> > 59 typedef std::vector<rtc::scoped_refptr<DataChannelInterface> >
110 DataChannelList; 60 DataChannelList;
111 61
112 PeerConnectionEndToEndTest() 62 PeerConnectionEndToEndTest()
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 0); 371 WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 0);
422 // This removes the reference to the remote data channel that we hold. 372 // This removes the reference to the remote data channel that we hold.
423 callee_signaled_data_channels_.clear(); 373 callee_signaled_data_channels_.clear();
424 caller_dc->Close(); 374 caller_dc->Close();
425 EXPECT_EQ_WAIT(DataChannelInterface::kClosed, caller_dc->state(), kMaxWait); 375 EXPECT_EQ_WAIT(DataChannelInterface::kClosed, caller_dc->state(), kMaxWait);
426 376
427 // Wait for a bit longer so the remote data channel will receive the 377 // Wait for a bit longer so the remote data channel will receive the
428 // close message and be destroyed. 378 // close message and be destroyed.
429 rtc::Thread::Current()->ProcessMessages(100); 379 rtc::Thread::Current()->ProcessMessages(100);
430 } 380 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/objc/avfoundationvideocapturer.h ('k') | talk/app/webrtc/webrtcsession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698