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

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

Issue 1818963002: Use a FakeVideoTrackSource instead of nullptr in all VideoTrack tests. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « webrtc/api/rtpsenderreceiver_unittest.cc ('k') | webrtc/api/test/fakevideotracksource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include <stdio.h> 11 #include <stdio.h>
12 12
13 #include <algorithm> 13 #include <algorithm>
14 14
15 #include "webrtc/api/statscollector.h" 15 #include "webrtc/api/statscollector.h"
16 16
17 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 #include "webrtc/api/mediastream.h" 19 #include "webrtc/api/mediastream.h"
20 #include "webrtc/api/mediastreaminterface.h" 20 #include "webrtc/api/mediastreaminterface.h"
21 #include "webrtc/api/mediastreamtrack.h" 21 #include "webrtc/api/mediastreamtrack.h"
22 #include "webrtc/api/peerconnection.h" 22 #include "webrtc/api/peerconnection.h"
23 #include "webrtc/api/peerconnectionfactory.h" 23 #include "webrtc/api/peerconnectionfactory.h"
24 #include "webrtc/api/test/fakedatachannelprovider.h" 24 #include "webrtc/api/test/fakedatachannelprovider.h"
25 #include "webrtc/api/test/fakevideotracksource.h"
25 #include "webrtc/api/videotrack.h" 26 #include "webrtc/api/videotrack.h"
26 #include "webrtc/base/base64.h" 27 #include "webrtc/base/base64.h"
27 #include "webrtc/base/fakesslidentity.h" 28 #include "webrtc/base/fakesslidentity.h"
28 #include "webrtc/base/gunit.h" 29 #include "webrtc/base/gunit.h"
29 #include "webrtc/base/network.h" 30 #include "webrtc/base/network.h"
30 #include "webrtc/media/base/fakemediaengine.h" 31 #include "webrtc/media/base/fakemediaengine.h"
31 #include "webrtc/p2p/base/faketransportcontroller.h" 32 #include "webrtc/p2p/base/faketransportcontroller.h"
32 #include "webrtc/pc/channelmanager.h" 33 #include "webrtc/pc/channelmanager.h"
33 34
34 using rtc::scoped_ptr; 35 using rtc::scoped_ptr;
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 transport_stats.transport_name = kTransportName; 517 transport_stats.transport_name = kTransportName;
517 transport_stats.channel_stats.push_back(channel_stats); 518 transport_stats.channel_stats.push_back(channel_stats);
518 519
519 session_stats_.transport_stats[kTransportName] = transport_stats; 520 session_stats_.transport_stats[kTransportName] = transport_stats;
520 session_stats_.proxy_to_transport[vc_name] = kTransportName; 521 session_stats_.proxy_to_transport[vc_name] = kTransportName;
521 } 522 }
522 523
523 // Adds a outgoing video track with a given SSRC into the stats. 524 // Adds a outgoing video track with a given SSRC into the stats.
524 void AddOutgoingVideoTrackStats() { 525 void AddOutgoingVideoTrackStats() {
525 stream_ = webrtc::MediaStream::Create("streamlabel"); 526 stream_ = webrtc::MediaStream::Create("streamlabel");
526 track_= webrtc::VideoTrack::Create(kLocalTrackId, NULL); 527 track_ = webrtc::VideoTrack::Create(kLocalTrackId,
528 webrtc::FakeVideoTrackSource::Create());
527 stream_->AddTrack(track_); 529 stream_->AddTrack(track_);
528 EXPECT_CALL(session_, GetLocalTrackIdBySsrc(kSsrcOfTrack, _)) 530 EXPECT_CALL(session_, GetLocalTrackIdBySsrc(kSsrcOfTrack, _))
529 .WillRepeatedly(DoAll(SetArgPointee<1>(kLocalTrackId), Return(true))); 531 .WillRepeatedly(DoAll(SetArgPointee<1>(kLocalTrackId), Return(true)));
530 } 532 }
531 533
532 // Adds a incoming video track with a given SSRC into the stats. 534 // Adds a incoming video track with a given SSRC into the stats.
533 void AddIncomingVideoTrackStats() { 535 void AddIncomingVideoTrackStats() {
534 stream_ = webrtc::MediaStream::Create("streamlabel"); 536 stream_ = webrtc::MediaStream::Create("streamlabel");
535 track_= webrtc::VideoTrack::Create(kRemoteTrackId, NULL); 537 track_ = webrtc::VideoTrack::Create(kRemoteTrackId,
538 webrtc::FakeVideoTrackSource::Create());
536 stream_->AddTrack(track_); 539 stream_->AddTrack(track_);
537 EXPECT_CALL(session_, GetRemoteTrackIdBySsrc(kSsrcOfTrack, _)) 540 EXPECT_CALL(session_, GetRemoteTrackIdBySsrc(kSsrcOfTrack, _))
538 .WillRepeatedly(DoAll(SetArgPointee<1>(kRemoteTrackId), Return(true))); 541 .WillRepeatedly(DoAll(SetArgPointee<1>(kRemoteTrackId), Return(true)));
539 } 542 }
540 543
541 // Adds a outgoing audio track with a given SSRC into the stats. 544 // Adds a outgoing audio track with a given SSRC into the stats.
542 void AddOutgoingAudioTrackStats() { 545 void AddOutgoingAudioTrackStats() {
543 if (stream_ == NULL) 546 if (stream_ == NULL)
544 stream_ = webrtc::MediaStream::Create("streamlabel"); 547 stream_ = webrtc::MediaStream::Create("streamlabel");
545 548
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 cricket::VoiceSenderInfo new_voice_sender_info; 1734 cricket::VoiceSenderInfo new_voice_sender_info;
1732 InitVoiceSenderInfo(&new_voice_sender_info); 1735 InitVoiceSenderInfo(&new_voice_sender_info);
1733 cricket::VoiceMediaInfo new_stats_read; 1736 cricket::VoiceMediaInfo new_stats_read;
1734 reports.clear(); 1737 reports.clear();
1735 SetupAndVerifyAudioTrackStats( 1738 SetupAndVerifyAudioTrackStats(
1736 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, 1739 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName,
1737 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); 1740 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports);
1738 } 1741 }
1739 1742
1740 } // namespace webrtc 1743 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/rtpsenderreceiver_unittest.cc ('k') | webrtc/api/test/fakevideotracksource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698