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

Side by Side Diff: webrtc/media/base/videoengine_unittest.h

Issue 2353033005: Refactoring: move ownership of RtcEventLog from Call to PeerConnection (Closed)
Patch Set: Updated unit tests to use RtcEventLogNullImpl. Created 4 years, 2 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 (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 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 #ifndef WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ // NOLINT 11 #ifndef WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ // NOLINT
12 #define WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ 12 #define WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_
13 13
14 #include <memory> 14 #include <memory>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/base/bytebuffer.h" 18 #include "webrtc/base/bytebuffer.h"
19 #include "webrtc/base/gunit.h" 19 #include "webrtc/base/gunit.h"
20 #include "webrtc/base/timeutils.h" 20 #include "webrtc/base/timeutils.h"
21 #include "webrtc/call.h" 21 #include "webrtc/call.h"
22 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
22 #include "webrtc/media/base/fakenetworkinterface.h" 23 #include "webrtc/media/base/fakenetworkinterface.h"
23 #include "webrtc/media/base/fakevideocapturer.h" 24 #include "webrtc/media/base/fakevideocapturer.h"
24 #include "webrtc/media/base/fakevideorenderer.h" 25 #include "webrtc/media/base/fakevideorenderer.h"
25 #include "webrtc/media/base/mediachannel.h" 26 #include "webrtc/media/base/mediachannel.h"
26 #include "webrtc/media/base/streamparams.h" 27 #include "webrtc/media/base/streamparams.h"
27 #include "webrtc/media/engine/fakewebrtccall.h" 28 #include "webrtc/media/engine/fakewebrtccall.h"
28 29
29 #define EXPECT_FRAME_WAIT(c, w, h, t) \ 30 #define EXPECT_FRAME_WAIT(c, w, h, t) \
30 EXPECT_EQ_WAIT((c), renderer_.num_rendered_frames(), (t)); \ 31 EXPECT_EQ_WAIT((c), renderer_.num_rendered_frames(), (t)); \
31 EXPECT_EQ((w), renderer_.width()); \ 32 EXPECT_EQ((w), renderer_.width()); \
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return static_cast<int>( 73 return static_cast<int>(
73 cricket::VideoFormat::FpsToInterval(codec.framerate) / 74 cricket::VideoFormat::FpsToInterval(codec.framerate) /
74 rtc::kNumNanosecsPerMillisec); 75 rtc::kNumNanosecsPerMillisec);
75 } 76 }
76 77
77 template<class E, class C> 78 template<class E, class C>
78 class VideoMediaChannelTest : public testing::Test, 79 class VideoMediaChannelTest : public testing::Test,
79 public sigslot::has_slots<> { 80 public sigslot::has_slots<> {
80 protected: 81 protected:
81 VideoMediaChannelTest<E, C>() 82 VideoMediaChannelTest<E, C>()
82 : call_(webrtc::Call::Create(webrtc::Call::Config())) {} 83 : call_(webrtc::Call::Create(
84 cricket::ConfigWithRtcEventLog(&event_log_))) {}
83 85
84 virtual cricket::VideoCodec DefaultCodec() = 0; 86 virtual cricket::VideoCodec DefaultCodec() = 0;
85 87
86 virtual cricket::StreamParams DefaultSendStreamParams() { 88 virtual cricket::StreamParams DefaultSendStreamParams() {
87 return cricket::StreamParams::CreateLegacy(kSsrc); 89 return cricket::StreamParams::CreateLegacy(kSsrc);
88 } 90 }
89 91
90 virtual void SetUp() { 92 virtual void SetUp() {
91 engine_.Init(); 93 engine_.Init();
92 channel_.reset(engine_.CreateChannel(call_.get(), cricket::MediaConfig(), 94 channel_.reset(engine_.CreateChannel(call_.get(), cricket::MediaConfig(),
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 void TwoStreamsSendAndReceive(const cricket::VideoCodec& codec) { 1071 void TwoStreamsSendAndReceive(const cricket::VideoCodec& codec) {
1070 SetUpSecondStream(); 1072 SetUpSecondStream();
1071 // Test sending and receiving on first stream. 1073 // Test sending and receiving on first stream.
1072 SendAndReceive(codec); 1074 SendAndReceive(codec);
1073 // Test sending and receiving on second stream. 1075 // Test sending and receiving on second stream.
1074 EXPECT_EQ_WAIT(1, renderer2_.num_rendered_frames(), kTimeout); 1076 EXPECT_EQ_WAIT(1, renderer2_.num_rendered_frames(), kTimeout);
1075 EXPECT_GT(NumRtpPackets(), 0); 1077 EXPECT_GT(NumRtpPackets(), 0);
1076 EXPECT_EQ(1, renderer2_.num_rendered_frames()); 1078 EXPECT_EQ(1, renderer2_.num_rendered_frames());
1077 } 1079 }
1078 1080
1081 webrtc::RtcEventLogNullImpl event_log_;
1079 const std::unique_ptr<webrtc::Call> call_; 1082 const std::unique_ptr<webrtc::Call> call_;
1080 E engine_; 1083 E engine_;
1081 std::unique_ptr<cricket::FakeVideoCapturer> video_capturer_; 1084 std::unique_ptr<cricket::FakeVideoCapturer> video_capturer_;
1082 std::unique_ptr<cricket::FakeVideoCapturer> video_capturer_2_; 1085 std::unique_ptr<cricket::FakeVideoCapturer> video_capturer_2_;
1083 std::unique_ptr<C> channel_; 1086 std::unique_ptr<C> channel_;
1084 cricket::FakeNetworkInterface network_interface_; 1087 cricket::FakeNetworkInterface network_interface_;
1085 cricket::FakeVideoRenderer renderer_; 1088 cricket::FakeVideoRenderer renderer_;
1086 cricket::VideoMediaChannel::Error media_error_; 1089 cricket::VideoMediaChannel::Error media_error_;
1087 1090
1088 // Used by test cases where 2 streams are run on the same channel. 1091 // Used by test cases where 2 streams are run on the same channel.
1089 cricket::FakeVideoRenderer renderer2_; 1092 cricket::FakeVideoRenderer renderer2_;
1090 }; 1093 };
1091 1094
1092 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT 1095 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698