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

Side by Side Diff: webrtc/pc/statscollector_unittest.cc

Issue 2685093002: Switching some interfaces to use std::unique_ptr<>. (Closed)
Patch Set: Rebase onto master Created 3 years, 10 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 * 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
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
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 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); 2030 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
2029 stats.GetStats(NULL, &reports); 2031 stats.GetStats(NULL, &reports);
2030 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded), 2032 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded),
2031 ExtractSsrcStatsValue(reports, 2033 ExtractSsrcStatsValue(reports,
2032 StatsReport::kStatsValueNameFramesDecoded)); 2034 StatsReport::kStatsValueNameFramesDecoded));
2033 EXPECT_EQ(rtc::ToString(*video_receiver_info.qp_sum), 2035 EXPECT_EQ(rtc::ToString(*video_receiver_info.qp_sum),
2034 ExtractSsrcStatsValue(reports, StatsReport::kStatsValueNameQpSum)); 2036 ExtractSsrcStatsValue(reports, StatsReport::kStatsValueNameQpSum));
2035 } 2037 }
2036 2038
2037 } // namespace webrtc 2039 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698