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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Error return values | 59 // Error return values |
60 const char kNotFound[] = "NOT FOUND"; | 60 const char kNotFound[] = "NOT FOUND"; |
61 | 61 |
62 // Constant names for track identification. | 62 // Constant names for track identification. |
63 const char kLocalTrackId[] = "local_track_id"; | 63 const char kLocalTrackId[] = "local_track_id"; |
64 const char kRemoteTrackId[] = "remote_track_id"; | 64 const char kRemoteTrackId[] = "remote_track_id"; |
65 const uint32_t kSsrcOfTrack = 1234; | 65 const uint32_t kSsrcOfTrack = 1234; |
66 | 66 |
67 class MockWebRtcSession : public webrtc::WebRtcSession { | 67 class MockWebRtcSession : public webrtc::WebRtcSession { |
68 public: | 68 public: |
69 explicit MockWebRtcSession(webrtc::MediaControllerInterface* media_controller) | 69 explicit MockWebRtcSession() |
70 : WebRtcSession(media_controller, | 70 : WebRtcSession(rtc::Thread::Current(), |
71 rtc::Thread::Current(), | |
72 rtc::Thread::Current(), | 71 rtc::Thread::Current(), |
73 nullptr) {} | 72 nullptr) {} |
74 MOCK_METHOD0(voice_channel, cricket::VoiceChannel*()); | 73 MOCK_METHOD0(voice_channel, cricket::VoiceChannel*()); |
75 MOCK_METHOD0(video_channel, cricket::VideoChannel*()); | 74 MOCK_METHOD0(video_channel, cricket::VideoChannel*()); |
76 // Libjingle uses "local" for a outgoing track, and "remote" for a incoming | 75 // Libjingle uses "local" for a outgoing track, and "remote" for a incoming |
77 // track. | 76 // track. |
78 MOCK_METHOD2(GetLocalTrackIdBySsrc, bool(uint32_t, std::string*)); | 77 MOCK_METHOD2(GetLocalTrackIdBySsrc, bool(uint32_t, std::string*)); |
79 MOCK_METHOD2(GetRemoteTrackIdBySsrc, bool(uint32_t, std::string*)); | 78 MOCK_METHOD2(GetRemoteTrackIdBySsrc, bool(uint32_t, std::string*)); |
80 MOCK_METHOD1(GetTransportStats, bool(SessionStats*)); | 79 MOCK_METHOD1(GetTransportStats, bool(SessionStats*)); |
81 MOCK_METHOD2(GetLocalCertificate, | 80 MOCK_METHOD2(GetLocalCertificate, |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 } | 478 } |
480 | 479 |
481 private: | 480 private: |
482 double time_now_; | 481 double time_now_; |
483 }; | 482 }; |
484 | 483 |
485 class StatsCollectorTest : public testing::Test { | 484 class StatsCollectorTest : public testing::Test { |
486 protected: | 485 protected: |
487 StatsCollectorTest() | 486 StatsCollectorTest() |
488 : media_engine_(new cricket::FakeMediaEngine()), | 487 : media_engine_(new cricket::FakeMediaEngine()), |
489 channel_manager_( | 488 session_() { |
490 new cricket::ChannelManager(media_engine_, rtc::Thread::Current())), | |
491 media_controller_( | |
492 webrtc::MediaControllerInterface::Create(cricket::MediaConfig(), | |
493 rtc::Thread::Current(), | |
494 channel_manager_.get())), | |
495 session_(media_controller_.get()) { | |
496 // By default, we ignore session GetStats calls. | 489 // By default, we ignore session GetStats calls. |
497 EXPECT_CALL(session_, GetTransportStats(_)).WillRepeatedly(Return(false)); | 490 EXPECT_CALL(session_, GetTransportStats(_)).WillRepeatedly(Return(false)); |
498 // Add default returns for mock classes. | 491 // Add default returns for mock classes. |
499 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); | 492 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); |
500 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); | 493 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); |
501 EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_)); | 494 EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_)); |
502 EXPECT_CALL(pc_, sctp_data_channels()) | 495 EXPECT_CALL(pc_, sctp_data_channels()) |
503 .WillRepeatedly(ReturnRef(data_channels_)); | 496 .WillRepeatedly(ReturnRef(data_channels_)); |
504 } | 497 } |
505 | 498 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA), | 733 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA), |
741 dtls_cipher_suite); | 734 dtls_cipher_suite); |
742 std::string srtp_crypto_suite = | 735 std::string srtp_crypto_suite = |
743 ExtractStatsValue(StatsReport::kStatsReportTypeComponent, reports, | 736 ExtractStatsValue(StatsReport::kStatsReportTypeComponent, reports, |
744 StatsReport::kStatsValueNameSrtpCipher); | 737 StatsReport::kStatsValueNameSrtpCipher); |
745 EXPECT_EQ(rtc::SrtpCryptoSuiteToName(rtc::SRTP_AES128_CM_SHA1_80), | 738 EXPECT_EQ(rtc::SrtpCryptoSuiteToName(rtc::SRTP_AES128_CM_SHA1_80), |
746 srtp_crypto_suite); | 739 srtp_crypto_suite); |
747 } | 740 } |
748 | 741 |
749 cricket::FakeMediaEngine* media_engine_; | 742 cricket::FakeMediaEngine* media_engine_; |
750 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_; | |
751 rtc::scoped_ptr<webrtc::MediaControllerInterface> media_controller_; | |
752 MockWebRtcSession session_; | 743 MockWebRtcSession session_; |
753 MockPeerConnection pc_; | 744 MockPeerConnection pc_; |
754 FakeDataChannelProvider data_channel_provider_; | 745 FakeDataChannelProvider data_channel_provider_; |
755 SessionStats session_stats_; | 746 SessionStats session_stats_; |
756 rtc::scoped_refptr<webrtc::MediaStream> stream_; | 747 rtc::scoped_refptr<webrtc::MediaStream> stream_; |
757 rtc::scoped_refptr<webrtc::VideoTrack> track_; | 748 rtc::scoped_refptr<webrtc::VideoTrack> track_; |
758 rtc::scoped_refptr<FakeAudioTrack> audio_track_; | 749 rtc::scoped_refptr<FakeAudioTrack> audio_track_; |
759 std::vector<rtc::scoped_refptr<DataChannel>> data_channels_; | 750 std::vector<rtc::scoped_refptr<DataChannel>> data_channels_; |
760 }; | 751 }; |
761 | 752 |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 cricket::VoiceSenderInfo new_voice_sender_info; | 1722 cricket::VoiceSenderInfo new_voice_sender_info; |
1732 InitVoiceSenderInfo(&new_voice_sender_info); | 1723 InitVoiceSenderInfo(&new_voice_sender_info); |
1733 cricket::VoiceMediaInfo new_stats_read; | 1724 cricket::VoiceMediaInfo new_stats_read; |
1734 reports.clear(); | 1725 reports.clear(); |
1735 SetupAndVerifyAudioTrackStats( | 1726 SetupAndVerifyAudioTrackStats( |
1736 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, | 1727 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, |
1737 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); | 1728 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); |
1738 } | 1729 } |
1739 | 1730 |
1740 } // namespace webrtc | 1731 } // namespace webrtc |
OLD | NEW |