Chromium Code Reviews| 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 #include <memory> |
| 15 | 15 |
| 16 #include "webrtc/api/statscollector.h" | 16 #include "webrtc/api/statscollector.h" |
| 17 | 17 |
| 18 #include "webrtc/api/mediastream.h" | 18 #include "webrtc/api/mediastream.h" |
| 19 #include "webrtc/api/mediastreaminterface.h" | 19 #include "webrtc/api/mediastreaminterface.h" |
| 20 #include "webrtc/api/mediastreamtrack.h" | 20 #include "webrtc/api/mediastreamtrack.h" |
| 21 #include "webrtc/api/peerconnection.h" | 21 #include "webrtc/api/peerconnection.h" |
| 22 #include "webrtc/api/peerconnectionfactory.h" | 22 #include "webrtc/api/peerconnectionfactory.h" |
| 23 #include "webrtc/api/test/fakedatachannelprovider.h" | 23 #include "webrtc/api/test/fakedatachannelprovider.h" |
| 24 #include "webrtc/api/test/fakevideotracksource.h" | 24 #include "webrtc/api/test/fakevideotracksource.h" |
| 25 #include "webrtc/api/test/mock_peerconnection.h" | 25 #include "webrtc/api/test/mock_peerconnection.h" |
| 26 #include "webrtc/api/test/mock_webrtcsession.h" | 26 #include "webrtc/api/test/mock_webrtcsession.h" |
| 27 #include "webrtc/api/videotrack.h" | 27 #include "webrtc/api/videotrack.h" |
| 28 #include "webrtc/base/base64.h" | 28 #include "webrtc/base/base64.h" |
| 29 #include "webrtc/base/checks.h" | |
| 29 #include "webrtc/base/fakesslidentity.h" | 30 #include "webrtc/base/fakesslidentity.h" |
| 30 #include "webrtc/base/gunit.h" | 31 #include "webrtc/base/gunit.h" |
| 31 #include "webrtc/base/network.h" | 32 #include "webrtc/base/network.h" |
| 32 #include "webrtc/base/stringencode.h" | 33 #include "webrtc/base/stringencode.h" |
| 33 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 34 #include "webrtc/logging/rtc_event_log/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" |
| 38 #include "webrtc/test/gmock.h" | 39 #include "webrtc/test/gmock.h" |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 webrtc::StatsCollector* stats, | 603 webrtc::StatsCollector* stats, |
| 603 cricket::VoiceChannel* voice_channel, | 604 cricket::VoiceChannel* voice_channel, |
| 604 const std::string& vc_name, | 605 const std::string& vc_name, |
| 605 MockVoiceMediaChannel* media_channel, | 606 MockVoiceMediaChannel* media_channel, |
| 606 cricket::VoiceSenderInfo* voice_sender_info, | 607 cricket::VoiceSenderInfo* voice_sender_info, |
| 607 cricket::VoiceReceiverInfo* voice_receiver_info, | 608 cricket::VoiceReceiverInfo* voice_receiver_info, |
| 608 cricket::VoiceMediaInfo* stats_read, | 609 cricket::VoiceMediaInfo* stats_read, |
| 609 StatsReports* reports) { | 610 StatsReports* reports) { |
| 610 // A track can't have both sender report and recv report at the same time | 611 // A track can't have both sender report and recv report at the same time |
| 611 // for now, this might change in the future though. | 612 // for now, this might change in the future though. |
| 612 ASSERT((voice_sender_info == NULL) ^ (voice_receiver_info == NULL)); | 613 RTC_CHECK((voice_sender_info == NULL) ^ (voice_receiver_info == NULL)); |
|
kwiberg-webrtc
2017/01/17 09:39:25
You may not be able to use ASSERT_* here. Will EXP
nisse-webrtc
2017/01/17 12:19:21
EXPECT_TRUE seems to work.
But I think RTC_CHECK
kwiberg-webrtc
2017/01/17 13:52:47
Sounds reasonable.
| |
| 613 | 614 |
| 614 // Instruct the session to return stats containing the transport channel. | 615 // Instruct the session to return stats containing the transport channel. |
| 615 InitSessionStats(vc_name); | 616 InitSessionStats(vc_name); |
| 616 EXPECT_CALL(session_, GetStats(_)).WillRepeatedly(Invoke( | 617 EXPECT_CALL(session_, GetStats(_)).WillRepeatedly(Invoke( |
| 617 [this](const ChannelNamePairs&) { | 618 [this](const ChannelNamePairs&) { |
| 618 return std::unique_ptr<SessionStats>( | 619 return std::unique_ptr<SessionStats>( |
| 619 new SessionStats(session_stats_)); | 620 new SessionStats(session_stats_)); |
| 620 })); | 621 })); |
| 621 | 622 |
| 622 // Constructs an ssrc stats update. | 623 // Constructs an ssrc stats update. |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1299 const char local_ip[] = "192.168.0.1"; | 1300 const char local_ip[] = "192.168.0.1"; |
| 1300 const int remote_port = 2001; | 1301 const int remote_port = 2001; |
| 1301 const char remote_ip[] = "192.168.0.2"; | 1302 const char remote_ip[] = "192.168.0.2"; |
| 1302 | 1303 |
| 1303 rtc::SocketAddress local_address(local_ip, local_port); | 1304 rtc::SocketAddress local_address(local_ip, local_port); |
| 1304 rtc::SocketAddress remote_address(remote_ip, remote_port); | 1305 rtc::SocketAddress remote_address(remote_ip, remote_port); |
| 1305 rtc::AdapterType network_type = rtc::ADAPTER_TYPE_ETHERNET; | 1306 rtc::AdapterType network_type = rtc::ADAPTER_TYPE_ETHERNET; |
| 1306 uint32_t priority = 1000; | 1307 uint32_t priority = 1000; |
| 1307 | 1308 |
| 1308 cricket::Candidate c; | 1309 cricket::Candidate c; |
| 1309 ASSERT(c.id().length() > 0); | 1310 RTC_CHECK(c.id().length() > 0); |
|
kwiberg-webrtc
2017/01/17 09:39:25
ASSERT_* or EXPECT_*
nisse-webrtc
2017/01/17 12:19:21
Changed to EXPECT_GT.
| |
| 1310 c.set_type(cricket::LOCAL_PORT_TYPE); | 1311 c.set_type(cricket::LOCAL_PORT_TYPE); |
| 1311 c.set_protocol(cricket::UDP_PROTOCOL_NAME); | 1312 c.set_protocol(cricket::UDP_PROTOCOL_NAME); |
| 1312 c.set_address(local_address); | 1313 c.set_address(local_address); |
| 1313 c.set_priority(priority); | 1314 c.set_priority(priority); |
| 1314 c.set_network_type(network_type); | 1315 c.set_network_type(network_type); |
| 1315 std::string report_id = AddCandidateReport(&stats, c, true)->id()->ToString(); | 1316 std::string report_id = AddCandidateReport(&stats, c, true)->id()->ToString(); |
| 1316 EXPECT_EQ("Cand-" + c.id(), report_id); | 1317 EXPECT_EQ("Cand-" + c.id(), report_id); |
| 1317 | 1318 |
| 1318 c = cricket::Candidate(); | 1319 c = cricket::Candidate(); |
| 1319 ASSERT(c.id().length() > 0); | 1320 RTC_CHECK(c.id().length() > 0); |
| 1320 c.set_type(cricket::PRFLX_PORT_TYPE); | 1321 c.set_type(cricket::PRFLX_PORT_TYPE); |
| 1321 c.set_protocol(cricket::UDP_PROTOCOL_NAME); | 1322 c.set_protocol(cricket::UDP_PROTOCOL_NAME); |
| 1322 c.set_address(remote_address); | 1323 c.set_address(remote_address); |
| 1323 c.set_priority(priority); | 1324 c.set_priority(priority); |
| 1324 c.set_network_type(network_type); | 1325 c.set_network_type(network_type); |
| 1325 report_id = AddCandidateReport(&stats, c, false)->id()->ToString(); | 1326 report_id = AddCandidateReport(&stats, c, false)->id()->ToString(); |
| 1326 EXPECT_EQ("Cand-" + c.id(), report_id); | 1327 EXPECT_EQ("Cand-" + c.id(), report_id); |
| 1327 | 1328 |
| 1328 stats.GetStats(NULL, &reports); | 1329 stats.GetStats(NULL, &reports); |
| 1329 | 1330 |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2017 EXPECT_CALL(*media_channel, GetStats(_)) | 2018 EXPECT_CALL(*media_channel, GetStats(_)) |
| 2018 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); | 2019 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); |
| 2019 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); | 2020 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
| 2020 stats.GetStats(NULL, &reports); | 2021 stats.GetStats(NULL, &reports); |
| 2021 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded), | 2022 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded), |
| 2022 ExtractSsrcStatsValue(reports, | 2023 ExtractSsrcStatsValue(reports, |
| 2023 StatsReport::kStatsValueNameFramesDecoded)); | 2024 StatsReport::kStatsValueNameFramesDecoded)); |
| 2024 } | 2025 } |
| 2025 | 2026 |
| 2026 } // namespace webrtc | 2027 } // namespace webrtc |
| OLD | NEW |