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 <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26820}
diff --git a/BUILD.gn b/BUILD.gn
index 4c10d66..58277ff 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -44,7 +44,6 @@
":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 @@
"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 9011094..97cf71a 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -493,19 +493,16 @@
]
}
- 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 b8c7e56..df5ba1b 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 <memory>
+#include <utility>
#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 @@
// Check that all the packets were sent.
EXPECT_EQ(static_cast<size_t>(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 @@
// Check that all the packets were sent.
EXPECT_EQ(static_cast<size_t>(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();
}