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

Unified Diff: webrtc/call/flexfec_receive_stream_unittest.cc

Issue 2966963002: Fix gmock warnings emanating from FlexfecReceiveStreamTest (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/flexfec_receive_stream_unittest.cc
diff --git a/webrtc/call/flexfec_receive_stream_unittest.cc b/webrtc/call/flexfec_receive_stream_unittest.cc
index ba4140609435c6c1f498014b2abb0c7ecab9b0e5..1788efd0769766a50f25d1817ddf36c59d8425b9 100644
--- a/webrtc/call/flexfec_receive_stream_unittest.cc
+++ b/webrtc/call/flexfec_receive_stream_unittest.cc
@@ -8,10 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "webrtc/call/flexfec_receive_stream_impl.h"
+
#include <stdint.h>
+#include <memory>
#include "webrtc/base/array_view.h"
-#include "webrtc/call/flexfec_receive_stream_impl.h"
#include "webrtc/call/rtp_stream_receiver_controller.h"
#include "webrtc/modules/pacing/packet_router.h"
#include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h"
@@ -20,6 +22,7 @@
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
#include "webrtc/modules/utility/include/mock/mock_process_thread.h"
+#include "webrtc/rtc_base/ptr_util.h"
#include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h"
#include "webrtc/test/mock_transport.h"
@@ -28,6 +31,8 @@ namespace webrtc {
namespace {
+using ::testing::_;
+
constexpr uint8_t kFlexfecPlType = 118;
constexpr uint8_t kFlexfecSsrc[] = {0x00, 0x00, 0x00, 0x01};
constexpr uint8_t kMediaSsrc[] = {0x00, 0x00, 0x00, 0x02};
@@ -77,12 +82,16 @@ TEST(FlexfecReceiveStreamConfigTest, IsCompleteAndEnabled) {
class FlexfecReceiveStreamTest : public ::testing::Test {
protected:
FlexfecReceiveStreamTest()
- : config_(CreateDefaultConfig(&rtcp_send_transport_)),
- receive_stream_(&rtp_stream_receiver_controller_,
- config_,
- &recovered_packet_receiver_,
- &rtt_stats_,
- &process_thread_) {}
+ : config_(CreateDefaultConfig(&rtcp_send_transport_)) {
+ EXPECT_CALL(process_thread_, RegisterModule(_, _)).Times(1);
+ receive_stream_ = rtc::MakeUnique<FlexfecReceiveStreamImpl>(
+ &rtp_stream_receiver_controller_, config_, &recovered_packet_receiver_,
+ &rtt_stats_, &process_thread_);
+ }
+
+ ~FlexfecReceiveStreamTest() {
+ EXPECT_CALL(process_thread_, DeRegisterModule(_)).Times(1);
+ }
MockTransport rtcp_send_transport_;
FlexfecReceiveStream::Config config_;
@@ -90,14 +99,14 @@ class FlexfecReceiveStreamTest : public ::testing::Test {
MockRtcpRttStats rtt_stats_;
MockProcessThread process_thread_;
RtpStreamReceiverController rtp_stream_receiver_controller_;
- FlexfecReceiveStreamImpl receive_stream_;
+ std::unique_ptr<FlexfecReceiveStreamImpl> receive_stream_;
};
TEST_F(FlexfecReceiveStreamTest, ConstructDestruct) {}
TEST_F(FlexfecReceiveStreamTest, StartStop) {
- receive_stream_.Start();
- receive_stream_.Stop();
+ receive_stream_->Start();
+ receive_stream_->Stop();
}
// Create a FlexFEC packet that protects a single media packet and ensure
@@ -136,6 +145,7 @@ TEST_F(FlexfecReceiveStreamTest, RecoversPacketWhenStarted) {
// clang-format on
testing::StrictMock<MockRecoveredPacketReceiver> recovered_packet_receiver;
+ EXPECT_CALL(process_thread_, RegisterModule(_, _)).Times(1);
FlexfecReceiveStreamImpl receive_stream(&rtp_stream_receiver_controller_,
config_, &recovered_packet_receiver,
&rtt_stats_, &process_thread_);
@@ -145,10 +155,12 @@ TEST_F(FlexfecReceiveStreamTest, RecoversPacketWhenStarted) {
// Call back after being started.
receive_stream.Start();
- EXPECT_CALL(
- recovered_packet_receiver,
- OnRecoveredPacket(::testing::_, kRtpHeaderSize + kPayloadLength[1]));
+ EXPECT_CALL(recovered_packet_receiver,
+ OnRecoveredPacket(_, kRtpHeaderSize + kPayloadLength[1]));
receive_stream.OnRtpPacket(ParsePacket(kFlexfecPacket));
+
+ // Tear-down
+ EXPECT_CALL(process_thread_, DeRegisterModule(_)).Times(1);
}
} // namespace webrtc
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698