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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 private: | 497 private: |
498 double time_now_; | 498 double time_now_; |
499 }; | 499 }; |
500 | 500 |
501 class StatsCollectorTest : public testing::Test { | 501 class StatsCollectorTest : public testing::Test { |
502 protected: | 502 protected: |
503 StatsCollectorTest() | 503 StatsCollectorTest() |
504 : worker_thread_(rtc::Thread::Current()), | 504 : worker_thread_(rtc::Thread::Current()), |
505 network_thread_(rtc::Thread::Current()), | 505 network_thread_(rtc::Thread::Current()), |
506 media_engine_(new cricket::FakeMediaEngine()), | 506 media_engine_(new cricket::FakeMediaEngine()), |
507 channel_manager_(new cricket::ChannelManager(media_engine_, | 507 channel_manager_(new cricket::ChannelManager( |
508 worker_thread_, | 508 std::unique_ptr<cricket::MediaEngineInterface>(media_engine_), |
509 network_thread_)), | 509 worker_thread_, |
| 510 network_thread_)), |
510 media_controller_( | 511 media_controller_( |
511 webrtc::MediaControllerInterface::Create(cricket::MediaConfig(), | 512 webrtc::MediaControllerInterface::Create(cricket::MediaConfig(), |
512 worker_thread_, | 513 worker_thread_, |
513 channel_manager_.get(), | 514 channel_manager_.get(), |
514 &event_log_)), | 515 &event_log_)), |
515 session_(media_controller_.get()) { | 516 session_(media_controller_.get()) { |
516 // By default, we ignore session GetStats calls. | 517 // By default, we ignore session GetStats calls. |
517 EXPECT_CALL(session_, GetStats(_)).WillRepeatedly(ReturnNull()); | 518 EXPECT_CALL(session_, GetStats(_)).WillRepeatedly(ReturnNull()); |
518 // Add default returns for mock classes. | 519 // Add default returns for mock classes. |
519 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); | 520 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 std::string srtp_crypto_suite = | 774 std::string srtp_crypto_suite = |
774 ExtractStatsValue(StatsReport::kStatsReportTypeComponent, reports, | 775 ExtractStatsValue(StatsReport::kStatsReportTypeComponent, reports, |
775 StatsReport::kStatsValueNameSrtpCipher); | 776 StatsReport::kStatsValueNameSrtpCipher); |
776 EXPECT_EQ(rtc::SrtpCryptoSuiteToName(rtc::SRTP_AES128_CM_SHA1_80), | 777 EXPECT_EQ(rtc::SrtpCryptoSuiteToName(rtc::SRTP_AES128_CM_SHA1_80), |
777 srtp_crypto_suite); | 778 srtp_crypto_suite); |
778 } | 779 } |
779 | 780 |
780 webrtc::RtcEventLogNullImpl event_log_; | 781 webrtc::RtcEventLogNullImpl event_log_; |
781 rtc::Thread* const worker_thread_; | 782 rtc::Thread* const worker_thread_; |
782 rtc::Thread* const network_thread_; | 783 rtc::Thread* const network_thread_; |
| 784 // |media_engine_| is actually owned by |channel_manager_|. |
783 cricket::FakeMediaEngine* media_engine_; | 785 cricket::FakeMediaEngine* media_engine_; |
784 std::unique_ptr<cricket::ChannelManager> channel_manager_; | 786 std::unique_ptr<cricket::ChannelManager> channel_manager_; |
785 std::unique_ptr<webrtc::MediaControllerInterface> media_controller_; | 787 std::unique_ptr<webrtc::MediaControllerInterface> media_controller_; |
786 MockWebRtcSession session_; | 788 MockWebRtcSession session_; |
787 MockPeerConnection pc_; | 789 MockPeerConnection pc_; |
788 FakeDataChannelProvider data_channel_provider_; | 790 FakeDataChannelProvider data_channel_provider_; |
789 SessionStats session_stats_; | 791 SessionStats session_stats_; |
790 rtc::scoped_refptr<webrtc::MediaStream> stream_; | 792 rtc::scoped_refptr<webrtc::MediaStream> stream_; |
791 rtc::scoped_refptr<webrtc::VideoTrack> track_; | 793 rtc::scoped_refptr<webrtc::VideoTrack> track_; |
792 rtc::scoped_refptr<FakeAudioTrack> audio_track_; | 794 rtc::scoped_refptr<FakeAudioTrack> audio_track_; |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2025 EXPECT_CALL(*media_channel, GetStats(_)) | 2027 EXPECT_CALL(*media_channel, GetStats(_)) |
2026 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); | 2028 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); |
2027 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); | 2029 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
2028 stats.GetStats(NULL, &reports); | 2030 stats.GetStats(NULL, &reports); |
2029 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded), | 2031 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded), |
2030 ExtractSsrcStatsValue(reports, | 2032 ExtractSsrcStatsValue(reports, |
2031 StatsReport::kStatsValueNameFramesDecoded)); | 2033 StatsReport::kStatsValueNameFramesDecoded)); |
2032 } | 2034 } |
2033 | 2035 |
2034 } // namespace webrtc | 2036 } // namespace webrtc |
OLD | NEW |