From 487c09bb73c18fd7ae8c2efc746531422c324c1f Mon Sep 17 00:00:00 2001 From: Sebastian Jansson Date: Thu, 21 Feb 2019 16:21:51 +0100 Subject: [PATCH] Adds FakeNetworkPipeTest to rtc_unittests. Also updating the tests so they pass. The previous target was not part of the targets that runs on the try bots, so they started breaking during a recent refactor. By adding it to the common target we'll avoid regression like this in the future. Bug: None Change-Id: I55391d454bd52964875818be39cdaa853360ae81 Reviewed-on: https://webrtc-review.googlesource.com/c/123199 Commit-Queue: Sebastian Jansson Reviewed-by: Karl Wiberg Cr-Commit-Position: refs/heads/master@{#26820} --- BUILD.gn | 2 +- call/BUILD.gn | 11 ++++------- call/{test => }/fake_network_pipe_unittest.cc | 11 ++++++----- 3 files changed, 11 insertions(+), 13 deletions(-) rename call/{test => }/fake_network_pipe_unittest.cc (98%) diff --git a/BUILD.gn b/BUILD.gn index 4c10d668ae..58277ffb03 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -44,7 +44,6 @@ if (!build_with_chromium) { ":video_engine_tests", ":webrtc_nonparallel_tests", ":webrtc_perf_tests", - "call:fake_network_unittests", "common_audio:common_audio_unittests", "common_video:common_video_unittests", "examples:examples_unittests", @@ -484,6 +483,7 @@ if (rtc_include_tests) { "api/audio_codecs/test:audio_codecs_api_unittests", "api/video/test:rtc_api_video_unittests", "api/video_codecs/test:video_codecs_api_unittests", + "call:fake_network_pipe_unittests", "p2p:libstunprober_unittests", "p2p:rtc_p2p_unittests", "rtc_base:rtc_base_approved_unittests", diff --git a/call/BUILD.gn b/call/BUILD.gn index 9011094ce7..97cf71aa39 100644 --- a/call/BUILD.gn +++ b/call/BUILD.gn @@ -493,19 +493,16 @@ if (rtc_include_tests) { ] } - rtc_test("fake_network_unittests") { + rtc_source_set("fake_network_pipe_unittests") { + testonly = true + sources = [ - "test/fake_network_pipe_unittest.cc", + "fake_network_pipe_unittest.cc", ] deps = [ - ":call_interfaces", ":fake_network", ":simulated_network", - "../modules/rtp_rtcp", - "../rtc_base:rtc_base_approved", "../system_wrappers", - "../test:test_common", - "../test:test_main", "../test:test_support", "//testing/gtest", "//third_party/abseil-cpp/absl/memory", diff --git a/call/test/fake_network_pipe_unittest.cc b/call/fake_network_pipe_unittest.cc similarity index 98% rename from call/test/fake_network_pipe_unittest.cc rename to call/fake_network_pipe_unittest.cc index b8c7e56d17..df5ba1b7bd 100644 --- a/call/test/fake_network_pipe_unittest.cc +++ b/call/fake_network_pipe_unittest.cc @@ -11,19 +11,18 @@ #include "call/fake_network_pipe.h" #include +#include #include "absl/memory/memory.h" -#include "call/call.h" #include "call/simulated_network.h" -#include "modules/rtp_rtcp/include/rtp_header_parser.h" #include "system_wrappers/include/clock.h" #include "test/gmock.h" #include "test/gtest.h" using ::testing::_; using ::testing::AnyNumber; -using ::testing::Return; using ::testing::Invoke; +using ::testing::Return; namespace webrtc { @@ -259,7 +258,8 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) { // Check that all the packets were sent. EXPECT_EQ(static_cast(2 * kNumPackets), pipe->SentPackets()); - fake_clock_.AdvanceTimeMilliseconds(*pipe->TimeUntilNextProcess()); + EXPECT_FALSE(pipe->TimeUntilNextProcess().has_value()); + fake_clock_.AdvanceTimeMilliseconds(1000); EXPECT_CALL(receiver, DeliverPacket(_, _, _)).Times(0); pipe->Process(); } @@ -307,7 +307,8 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithPacketsInPipeTest) { // Check that all the packets were sent. EXPECT_EQ(static_cast(kNumPackets), pipe->SentPackets()); - fake_clock_.AdvanceTimeMilliseconds(*pipe->TimeUntilNextProcess()); + EXPECT_FALSE(pipe->TimeUntilNextProcess().has_value()); + fake_clock_.AdvanceTimeMilliseconds(1000); EXPECT_CALL(receiver, DeliverPacket(_, _, _)).Times(0); pipe->Process(); }