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}
This commit is contained in:
Sebastian Jansson 2019-02-21 16:21:51 +01:00 committed by Commit Bot
parent 29f9cd9358
commit 487c09bb73
3 changed files with 11 additions and 13 deletions

View File

@ -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",

View File

@ -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",

View File

@ -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 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) {
// 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 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithPacketsInPipeTest) {
// 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();
}