OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2014 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 |
11 #include <stdio.h> | 11 #include <stdio.h> |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
| 14 #include <memory> |
14 | 15 |
15 #include "webrtc/api/statscollector.h" | 16 #include "webrtc/api/statscollector.h" |
16 | 17 |
17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "webrtc/api/mediastream.h" | 20 #include "webrtc/api/mediastream.h" |
20 #include "webrtc/api/mediastreaminterface.h" | 21 #include "webrtc/api/mediastreaminterface.h" |
21 #include "webrtc/api/mediastreamtrack.h" | 22 #include "webrtc/api/mediastreamtrack.h" |
22 #include "webrtc/api/peerconnection.h" | 23 #include "webrtc/api/peerconnection.h" |
23 #include "webrtc/api/peerconnectionfactory.h" | 24 #include "webrtc/api/peerconnectionfactory.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Libjingle uses "local" for a outgoing track, and "remote" for a incoming | 78 // Libjingle uses "local" for a outgoing track, and "remote" for a incoming |
78 // track. | 79 // track. |
79 MOCK_METHOD2(GetLocalTrackIdBySsrc, bool(uint32_t, std::string*)); | 80 MOCK_METHOD2(GetLocalTrackIdBySsrc, bool(uint32_t, std::string*)); |
80 MOCK_METHOD2(GetRemoteTrackIdBySsrc, bool(uint32_t, std::string*)); | 81 MOCK_METHOD2(GetRemoteTrackIdBySsrc, bool(uint32_t, std::string*)); |
81 MOCK_METHOD1(GetTransportStats, bool(SessionStats*)); | 82 MOCK_METHOD1(GetTransportStats, bool(SessionStats*)); |
82 MOCK_METHOD2(GetLocalCertificate, | 83 MOCK_METHOD2(GetLocalCertificate, |
83 bool(const std::string& transport_name, | 84 bool(const std::string& transport_name, |
84 rtc::scoped_refptr<rtc::RTCCertificate>* certificate)); | 85 rtc::scoped_refptr<rtc::RTCCertificate>* certificate)); |
85 | 86 |
86 // Workaround for gmock's inability to cope with move-only return values. | 87 // Workaround for gmock's inability to cope with move-only return values. |
87 rtc::scoped_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate( | 88 std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate( |
88 const std::string& transport_name) override { | 89 const std::string& transport_name) override { |
89 return rtc::scoped_ptr<rtc::SSLCertificate>( | 90 return std::unique_ptr<rtc::SSLCertificate>( |
90 GetRemoteSSLCertificate_ReturnsRawPointer(transport_name)); | 91 GetRemoteSSLCertificate_ReturnsRawPointer(transport_name)); |
91 } | 92 } |
92 MOCK_METHOD1(GetRemoteSSLCertificate_ReturnsRawPointer, | 93 MOCK_METHOD1(GetRemoteSSLCertificate_ReturnsRawPointer, |
93 rtc::SSLCertificate*(const std::string& transport_name)); | 94 rtc::SSLCertificate*(const std::string& transport_name)); |
94 }; | 95 }; |
95 | 96 |
96 // The factory isn't really used; it just satisfies the base PeerConnection. | 97 // The factory isn't really used; it just satisfies the base PeerConnection. |
97 class FakePeerConnectionFactory | 98 class FakePeerConnectionFactory |
98 : public rtc::RefCountedObject<PeerConnectionFactory> {}; | 99 : public rtc::RefCountedObject<PeerConnectionFactory> {}; |
99 | 100 |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 cricket::TransportStats transport_stats; | 688 cricket::TransportStats transport_stats; |
688 transport_stats.transport_name = "audio"; | 689 transport_stats.transport_name = "audio"; |
689 transport_stats.channel_stats.push_back(channel_stats); | 690 transport_stats.channel_stats.push_back(channel_stats); |
690 | 691 |
691 SessionStats session_stats; | 692 SessionStats session_stats; |
692 session_stats.transport_stats[transport_stats.transport_name] = | 693 session_stats.transport_stats[transport_stats.transport_name] = |
693 transport_stats; | 694 transport_stats; |
694 | 695 |
695 // Fake certificate to report | 696 // Fake certificate to report |
696 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate( | 697 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate( |
697 rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::FakeSSLIdentity>( | 698 rtc::RTCCertificate::Create(std::unique_ptr<rtc::FakeSSLIdentity>( |
698 new rtc::FakeSSLIdentity(local_cert)))); | 699 new rtc::FakeSSLIdentity(local_cert)))); |
699 | 700 |
700 // Configure MockWebRtcSession | 701 // Configure MockWebRtcSession |
701 EXPECT_CALL(session_, | 702 EXPECT_CALL(session_, |
702 GetLocalCertificate(transport_stats.transport_name, _)) | 703 GetLocalCertificate(transport_stats.transport_name, _)) |
703 .WillOnce(DoAll(SetArgPointee<1>(local_certificate), Return(true))); | 704 .WillOnce(DoAll(SetArgPointee<1>(local_certificate), Return(true))); |
704 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer( | 705 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer( |
705 transport_stats.transport_name)) | 706 transport_stats.transport_name)) |
706 .WillOnce(Return(remote_cert.release())); | 707 .WillOnce(Return(remote_cert.release())); |
707 EXPECT_CALL(session_, GetTransportStats(_)) | 708 EXPECT_CALL(session_, GetTransportStats(_)) |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 cricket::VoiceSenderInfo new_voice_sender_info; | 1747 cricket::VoiceSenderInfo new_voice_sender_info; |
1747 InitVoiceSenderInfo(&new_voice_sender_info); | 1748 InitVoiceSenderInfo(&new_voice_sender_info); |
1748 cricket::VoiceMediaInfo new_stats_read; | 1749 cricket::VoiceMediaInfo new_stats_read; |
1749 reports.clear(); | 1750 reports.clear(); |
1750 SetupAndVerifyAudioTrackStats( | 1751 SetupAndVerifyAudioTrackStats( |
1751 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, | 1752 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, |
1752 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); | 1753 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); |
1753 } | 1754 } |
1754 | 1755 |
1755 } // namespace webrtc | 1756 } // namespace webrtc |
OLD | NEW |