Commit 9eb10b3c authored by Wez's avatar Wez Committed by Commit Bot

Replace MessageLoop with ScopedTaskEnvironment in RTCRtpSenderTest.

This test base instantiates a content::ChildProcess to provide the
expected environment for the code-under-test. ChildProcess expects to
either run in the context of ScopedTaskEnvironment, in tests, or to
need to initialize the TaskScheduler itself.

Add a ScopedTaskEnvironment to the test base, otherwise the ChildProcess
TaskScheduler will "leak" and break later tests.

Re-enables the RTCVideoDecoderAdapterTest tests, that had been
broken by this issue.

TBR=hbos

Bug: 875278, 875301, 875336
Change-Id: I8a7ee1f42e62241d48720c41897bdcadbcd26bdf
Reviewed-on: https://chromium-review.googlesource.com/1180408
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584298}
parent e1bccfe3
......@@ -8,10 +8,10 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/scoped_task_environment.h"
#include "content/child/child_process.h"
#include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h"
#include "content/renderer/media/webrtc/mock_peer_connection_impl.h"
......@@ -97,9 +97,10 @@ class RTCRtpReceiverTest : public ::testing::Test {
run_loop->Quit();
}
// Message loop and child processes is needed for task queues and threading to
// work, as is necessary to create tracks and adapters.
base::MessageLoop message_loop_;
// Code under test expects to be run in a process with an initialized
// ChildProcess, which requires TaskScheduler, and a main-thread MessageLoop,
// which the ScopedTaskEnvironment also provides.
base::test::ScopedTaskEnvironment task_environment_;
ChildProcess child_process_;
std::unique_ptr<MockPeerConnectionDependencyFactory> dependency_factory_;
......
......@@ -7,9 +7,9 @@
#include <memory>
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/test/scoped_task_environment.h"
#include "build/build_config.h"
#include "content/child/child_process.h"
#include "content/renderer/media/stream/media_stream_audio_source.h"
......@@ -136,9 +136,10 @@ class RTCRtpSenderTest : public ::testing::Test {
return *result_holder;
}
// Message loop and child processes is needed for task queues and threading to
// work, as is necessary to create tracks and adapters.
base::MessageLoop message_loop_;
// Code under test expects to be run in a process with an initialized
// ChildProcess, which requires TaskScheduler, and a main-thread MessageLoop,
// which the ScopedTaskEnvironment also provides.
base::test::ScopedTaskEnvironment task_environment_;
ChildProcess child_process_;
std::unique_ptr<MockPeerConnectionDependencyFactory> dependency_factory_;
......
......@@ -203,19 +203,16 @@ class RTCVideoDecoderAdapterTest : public ::testing::Test {
DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoderAdapterTest);
};
// Flakily crashing on various platforms. See https://crbug.com/875278.
TEST_F(RTCVideoDecoderAdapterTest, DISABLED_Lifecycle) {
TEST_F(RTCVideoDecoderAdapterTest, Lifecycle) {
ASSERT_TRUE(BasicSetup());
ASSERT_TRUE(BasicTeardown());
}
// Flakily crashing on various platforms. See https://crbug.com/875278.
TEST_F(RTCVideoDecoderAdapterTest, DISABLED_InitializationFailure) {
TEST_F(RTCVideoDecoderAdapterTest, InitializationFailure) {
ASSERT_FALSE(CreateAndInitialize(false));
}
// Flakily crashing on various platforms. See https://crbug.com/875278.
TEST_F(RTCVideoDecoderAdapterTest, DISABLED_Decode) {
TEST_F(RTCVideoDecoderAdapterTest, Decode) {
ASSERT_TRUE(BasicSetup());
EXPECT_CALL(*video_decoder_, Decode(_, _))
......@@ -228,8 +225,7 @@ TEST_F(RTCVideoDecoderAdapterTest, DISABLED_Decode) {
media_thread_.FlushForTesting();
}
// Flakily crashing on various platforms. See https://crbug.com/875278.
TEST_F(RTCVideoDecoderAdapterTest, DISABLED_Decode_Error) {
TEST_F(RTCVideoDecoderAdapterTest, Decode_Error) {
ASSERT_TRUE(BasicSetup());
EXPECT_CALL(*video_decoder_, Decode(_, _))
......@@ -241,8 +237,7 @@ TEST_F(RTCVideoDecoderAdapterTest, DISABLED_Decode_Error) {
ASSERT_EQ(Decode(1), WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE);
}
// Flakily crashing on various platforms. See https://crbug.com/875278.
TEST_F(RTCVideoDecoderAdapterTest, DISABLED_Decode_Hang_Short) {
TEST_F(RTCVideoDecoderAdapterTest, Decode_Hang_Short) {
ASSERT_TRUE(BasicSetup());
// Ignore Decode() calls.
......@@ -260,8 +255,7 @@ TEST_F(RTCVideoDecoderAdapterTest, DISABLED_Decode_Hang_Short) {
FAIL();
}
// Flakily crashing on various platforms. See https://crbug.com/875278.
TEST_F(RTCVideoDecoderAdapterTest, DISABLED_Decode_Hang_Long) {
TEST_F(RTCVideoDecoderAdapterTest, Decode_Hang_Long) {
ASSERT_TRUE(BasicSetup());
// Ignore Decode() calls.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment