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 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "webrtc/api/peerconnectionfactory.h" | 24 #include "webrtc/api/peerconnectionfactory.h" |
25 #include "webrtc/api/test/fakedatachannelprovider.h" | 25 #include "webrtc/api/test/fakedatachannelprovider.h" |
26 #include "webrtc/api/test/fakevideotracksource.h" | 26 #include "webrtc/api/test/fakevideotracksource.h" |
27 #include "webrtc/api/test/mock_peerconnection.h" | 27 #include "webrtc/api/test/mock_peerconnection.h" |
28 #include "webrtc/api/test/mock_webrtcsession.h" | 28 #include "webrtc/api/test/mock_webrtcsession.h" |
29 #include "webrtc/api/videotrack.h" | 29 #include "webrtc/api/videotrack.h" |
30 #include "webrtc/base/base64.h" | 30 #include "webrtc/base/base64.h" |
31 #include "webrtc/base/fakesslidentity.h" | 31 #include "webrtc/base/fakesslidentity.h" |
32 #include "webrtc/base/gunit.h" | 32 #include "webrtc/base/gunit.h" |
33 #include "webrtc/base/network.h" | 33 #include "webrtc/base/network.h" |
| 34 #include "webrtc/call/rtc_event_log.h" |
34 #include "webrtc/media/base/fakemediaengine.h" | 35 #include "webrtc/media/base/fakemediaengine.h" |
35 #include "webrtc/media/base/test/mock_mediachannel.h" | 36 #include "webrtc/media/base/test/mock_mediachannel.h" |
36 #include "webrtc/p2p/base/faketransportcontroller.h" | 37 #include "webrtc/p2p/base/faketransportcontroller.h" |
37 #include "webrtc/pc/channelmanager.h" | 38 #include "webrtc/pc/channelmanager.h" |
| 39 #include "webrtc/system_wrappers/include/clock.h" |
38 | 40 |
39 using testing::_; | 41 using testing::_; |
40 using testing::DoAll; | 42 using testing::DoAll; |
41 using testing::Field; | 43 using testing::Field; |
42 using testing::Return; | 44 using testing::Return; |
43 using testing::ReturnNull; | 45 using testing::ReturnNull; |
44 using testing::ReturnRef; | 46 using testing::ReturnRef; |
45 using testing::SetArgPointee; | 47 using testing::SetArgPointee; |
46 using webrtc::PeerConnectionInterface; | 48 using webrtc::PeerConnectionInterface; |
47 using webrtc::StatsReport; | 49 using webrtc::StatsReport; |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 | 481 |
480 private: | 482 private: |
481 double time_now_; | 483 double time_now_; |
482 }; | 484 }; |
483 | 485 |
484 class StatsCollectorTest : public testing::Test { | 486 class StatsCollectorTest : public testing::Test { |
485 protected: | 487 protected: |
486 StatsCollectorTest() | 488 StatsCollectorTest() |
487 : worker_thread_(rtc::Thread::Current()), | 489 : worker_thread_(rtc::Thread::Current()), |
488 network_thread_(rtc::Thread::Current()), | 490 network_thread_(rtc::Thread::Current()), |
| 491 event_log_(RtcEventLog::Create(webrtc::Clock::GetRealTimeClock())), |
489 media_engine_(new cricket::FakeMediaEngine()), | 492 media_engine_(new cricket::FakeMediaEngine()), |
490 channel_manager_(new cricket::ChannelManager(media_engine_, | 493 channel_manager_(new cricket::ChannelManager(media_engine_, |
491 worker_thread_, | 494 worker_thread_, |
492 network_thread_)), | 495 network_thread_)), |
493 media_controller_( | 496 media_controller_( |
494 webrtc::MediaControllerInterface::Create(cricket::MediaConfig(), | 497 webrtc::MediaControllerInterface::Create(cricket::MediaConfig(), |
495 worker_thread_, | 498 worker_thread_, |
496 channel_manager_.get())), | 499 channel_manager_.get(), |
| 500 event_log_.get())), |
497 session_(media_controller_.get()) { | 501 session_(media_controller_.get()) { |
498 // By default, we ignore session GetStats calls. | 502 // By default, we ignore session GetStats calls. |
499 EXPECT_CALL(session_, GetTransportStats(_)).WillRepeatedly(Return(false)); | 503 EXPECT_CALL(session_, GetTransportStats(_)).WillRepeatedly(Return(false)); |
500 // Add default returns for mock classes. | 504 // Add default returns for mock classes. |
501 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); | 505 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); |
502 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); | 506 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); |
503 EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_)); | 507 EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_)); |
504 EXPECT_CALL(pc_, sctp_data_channels()) | 508 EXPECT_CALL(pc_, sctp_data_channels()) |
505 .WillRepeatedly(ReturnRef(data_channels_)); | 509 .WillRepeatedly(ReturnRef(data_channels_)); |
506 } | 510 } |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 dtls_cipher_suite); | 750 dtls_cipher_suite); |
747 std::string srtp_crypto_suite = | 751 std::string srtp_crypto_suite = |
748 ExtractStatsValue(StatsReport::kStatsReportTypeComponent, reports, | 752 ExtractStatsValue(StatsReport::kStatsReportTypeComponent, reports, |
749 StatsReport::kStatsValueNameSrtpCipher); | 753 StatsReport::kStatsValueNameSrtpCipher); |
750 EXPECT_EQ(rtc::SrtpCryptoSuiteToName(rtc::SRTP_AES128_CM_SHA1_80), | 754 EXPECT_EQ(rtc::SrtpCryptoSuiteToName(rtc::SRTP_AES128_CM_SHA1_80), |
751 srtp_crypto_suite); | 755 srtp_crypto_suite); |
752 } | 756 } |
753 | 757 |
754 rtc::Thread* const worker_thread_; | 758 rtc::Thread* const worker_thread_; |
755 rtc::Thread* const network_thread_; | 759 rtc::Thread* const network_thread_; |
| 760 std::unique_ptr<webrtc::RtcEventLog> event_log_; |
756 cricket::FakeMediaEngine* media_engine_; | 761 cricket::FakeMediaEngine* media_engine_; |
757 std::unique_ptr<cricket::ChannelManager> channel_manager_; | 762 std::unique_ptr<cricket::ChannelManager> channel_manager_; |
758 std::unique_ptr<webrtc::MediaControllerInterface> media_controller_; | 763 std::unique_ptr<webrtc::MediaControllerInterface> media_controller_; |
759 MockWebRtcSession session_; | 764 MockWebRtcSession session_; |
760 MockPeerConnection pc_; | 765 MockPeerConnection pc_; |
761 FakeDataChannelProvider data_channel_provider_; | 766 FakeDataChannelProvider data_channel_provider_; |
762 SessionStats session_stats_; | 767 SessionStats session_stats_; |
763 rtc::scoped_refptr<webrtc::MediaStream> stream_; | 768 rtc::scoped_refptr<webrtc::MediaStream> stream_; |
764 rtc::scoped_refptr<webrtc::VideoTrack> track_; | 769 rtc::scoped_refptr<webrtc::VideoTrack> track_; |
765 rtc::scoped_refptr<FakeAudioTrack> audio_track_; | 770 rtc::scoped_refptr<FakeAudioTrack> audio_track_; |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 cricket::VoiceSenderInfo new_voice_sender_info; | 1887 cricket::VoiceSenderInfo new_voice_sender_info; |
1883 InitVoiceSenderInfo(&new_voice_sender_info); | 1888 InitVoiceSenderInfo(&new_voice_sender_info); |
1884 cricket::VoiceMediaInfo new_stats_read; | 1889 cricket::VoiceMediaInfo new_stats_read; |
1885 reports.clear(); | 1890 reports.clear(); |
1886 SetupAndVerifyAudioTrackStats( | 1891 SetupAndVerifyAudioTrackStats( |
1887 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, | 1892 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, |
1888 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); | 1893 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); |
1889 } | 1894 } |
1890 | 1895 |
1891 } // namespace webrtc | 1896 } // namespace webrtc |
OLD | NEW |