Commit 5d580fe4 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Backport some tests in /mojo to SingleThreadTaskEnvironment

These tests were previously migrated from single-threaded MessageLoop to
a multi-threaded TaskEnvironment (then named ScopedTaskEnvironment) as
part of crbug.com/891670.

//base OWNERS decided in retrospect that it was better to keep a
single-threaded option for TaskEnvironment and introduced
SingleThreadTaskEnvironment. This CL retrofits that decision for
/mojo.

This CL is a no-op if it passes CQ.

This CL was uploaded by git cl split.

R=sky@chromium.org

Bug: 891670
Change-Id: If1ba8688539709b8e28ce009e3483a1aac36fc4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1786977
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693918}
parent 24fae53a
...@@ -1986,7 +1986,7 @@ DEFINE_TEST_CLIENT_TEST_WITH_PIPE(DataPipeStatusChangeInTransitClient, ...@@ -1986,7 +1986,7 @@ DEFINE_TEST_CLIENT_TEST_WITH_PIPE(DataPipeStatusChangeInTransitClient,
EXPECT_EQ(MOJO_RESULT_OK, EXPECT_EQ(MOJO_RESULT_OK,
WaitForSignals(consumers[0], MOJO_HANDLE_SIGNAL_PEER_CLOSED)); WaitForSignals(consumers[0], MOJO_HANDLE_SIGNAL_PEER_CLOSED));
base::test::TaskEnvironment task_environment; base::test::SingleThreadTaskEnvironment task_environment;
// Wait on producer 1 and consumer 1 using SimpleWatchers. // Wait on producer 1 and consumer 1 using SimpleWatchers.
{ {
......
...@@ -1275,7 +1275,7 @@ DEFINE_TEST_CLIENT_TEST_WITH_PIPE(MessagePipeStatusChangeInTransitClient, ...@@ -1275,7 +1275,7 @@ DEFINE_TEST_CLIENT_TEST_WITH_PIPE(MessagePipeStatusChangeInTransitClient,
EXPECT_EQ(MOJO_RESULT_OK, EXPECT_EQ(MOJO_RESULT_OK,
WaitForSignals(handles[0], MOJO_HANDLE_SIGNAL_PEER_CLOSED)); WaitForSignals(handles[0], MOJO_HANDLE_SIGNAL_PEER_CLOSED));
base::test::TaskEnvironment task_environment; base::test::SingleThreadTaskEnvironment task_environment;
// Wait on handle 1 using a SimpleWatcher. // Wait on handle 1 using a SimpleWatcher.
{ {
......
...@@ -197,7 +197,7 @@ class BindTaskRunnerTest : public testing::Test { ...@@ -197,7 +197,7 @@ class BindTaskRunnerTest : public testing::Test {
impl_.reset(new ImplType(std::move(receiver), receiver_task_runner_)); impl_.reset(new ImplType(std::move(receiver), receiver_task_runner_));
} }
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
scoped_refptr<TestTaskRunner> receiver_task_runner_; scoped_refptr<TestTaskRunner> receiver_task_runner_;
scoped_refptr<TestTaskRunner> remote_task_runner_; scoped_refptr<TestTaskRunner> remote_task_runner_;
...@@ -235,7 +235,7 @@ class AssociatedBindTaskRunnerTest : public testing::Test { ...@@ -235,7 +235,7 @@ class AssociatedBindTaskRunnerTest : public testing::Test {
void QuitTaskRunner() { connection_receiver_task_runner_->Quit(); } void QuitTaskRunner() { connection_receiver_task_runner_->Quit(); }
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
scoped_refptr<TestTaskRunner> connection_receiver_task_runner_; scoped_refptr<TestTaskRunner> connection_receiver_task_runner_;
scoped_refptr<TestTaskRunner> connection_remote_task_runner_; scoped_refptr<TestTaskRunner> connection_remote_task_runner_;
scoped_refptr<TestTaskRunner> sender_receiver_task_runner_; scoped_refptr<TestTaskRunner> sender_receiver_task_runner_;
......
...@@ -93,7 +93,7 @@ class MojoBindingsPerftest : public testing::Test { ...@@ -93,7 +93,7 @@ class MojoBindingsPerftest : public testing::Test {
MojoBindingsPerftest() = default; MojoBindingsPerftest() = default;
protected: protected:
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
}; };
TEST_F(MojoBindingsPerftest, InProcessPingPong) { TEST_F(MojoBindingsPerftest, InProcessPingPong) {
......
...@@ -109,7 +109,7 @@ class ConnectorTest : public testing::Test { ...@@ -109,7 +109,7 @@ class ConnectorTest : public testing::Test {
ScopedMessagePipeHandle handle1_; ScopedMessagePipeHandle handle1_;
private: private:
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
}; };
TEST_F(ConnectorTest, Basic) { TEST_F(ConnectorTest, Basic) {
......
...@@ -23,7 +23,7 @@ namespace { ...@@ -23,7 +23,7 @@ namespace {
class DataViewTest : public testing::Test { class DataViewTest : public testing::Test {
private: private:
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
}; };
struct DataViewHolder { struct DataViewHolder {
......
...@@ -130,7 +130,7 @@ class MojoE2EPerftest : public core::test::MojoTestBase { ...@@ -130,7 +130,7 @@ class MojoE2EPerftest : public core::test::MojoTestBase {
} }
protected: protected:
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
private: private:
void RunTests(MojoHandle client_mp, const std::string& test_name) { void RunTests(MojoHandle client_mp, const std::string& test_name) {
......
...@@ -61,7 +61,7 @@ class MultiplexRouterTest : public testing::Test { ...@@ -61,7 +61,7 @@ class MultiplexRouterTest : public testing::Test {
ScopedInterfaceEndpointHandle endpoint1_; ScopedInterfaceEndpointHandle endpoint1_;
private: private:
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
}; };
TEST_F(MultiplexRouterTest, BasicRequestResponse) { TEST_F(MultiplexRouterTest, BasicRequestResponse) {
......
...@@ -191,7 +191,7 @@ class PickleTest : public testing::Test { ...@@ -191,7 +191,7 @@ class PickleTest : public testing::Test {
}; };
private: private:
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
ChromiumPicklePasserImpl chromium_service_; ChromiumPicklePasserImpl chromium_service_;
ReceiverSet<PicklePasser> chromium_receivers_; ReceiverSet<PicklePasser> chromium_receivers_;
BlinkPicklePasserImpl blink_service_; BlinkPicklePasserImpl blink_service_;
......
...@@ -109,7 +109,7 @@ class ReceiverCallbackTest : public testing::Test { ...@@ -109,7 +109,7 @@ class ReceiverCallbackTest : public testing::Test {
void PumpMessages() { base::RunLoop().RunUntilIdle(); } void PumpMessages() { base::RunLoop().RunUntilIdle(); }
private: private:
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
}; };
// Tests that the Remote and the Receiver can communicate with each other // Tests that the Remote and the Receiver can communicate with each other
......
...@@ -502,7 +502,7 @@ class StrongMathCalculatorImpl : public math::Calculator { ...@@ -502,7 +502,7 @@ class StrongMathCalculatorImpl : public math::Calculator {
}; };
TEST(StrongConnectorTest, Math) { TEST(StrongConnectorTest, Math) {
base::test::TaskEnvironment task_environment; base::test::SingleThreadTaskEnvironment task_environment;
bool disconnected = false; bool disconnected = false;
bool destroyed = false; bool destroyed = false;
...@@ -578,7 +578,7 @@ class WeakMathCalculatorImpl : public math::Calculator { ...@@ -578,7 +578,7 @@ class WeakMathCalculatorImpl : public math::Calculator {
}; };
TEST(WeakConnectorTest, Math) { TEST(WeakConnectorTest, Math) {
base::test::TaskEnvironment task_environment; base::test::SingleThreadTaskEnvironment task_environment;
bool disconnected = false; bool disconnected = false;
bool destroyed = false; bool destroyed = false;
......
...@@ -188,7 +188,7 @@ class StructTraitsTest : public testing::Test, ...@@ -188,7 +188,7 @@ class StructTraitsTest : public testing::Test,
std::move(callback).Run(std::move(u)); std::move(callback).Run(std::move(u));
} }
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
ChromiumRectServiceImpl chromium_service_; ChromiumRectServiceImpl chromium_service_;
ReceiverSet<RectService> chromium_receivers_; ReceiverSet<RectService> chromium_receivers_;
......
...@@ -1148,7 +1148,7 @@ class SmallCacheImpl : public SmallCache { ...@@ -1148,7 +1148,7 @@ class SmallCacheImpl : public SmallCache {
}; };
TEST(UnionTest, InterfaceInUnion) { TEST(UnionTest, InterfaceInUnion) {
base::test::TaskEnvironment task_environment; base::test::SingleThreadTaskEnvironment task_environment;
base::RunLoop run_loop; base::RunLoop run_loop;
SmallCacheImpl impl(run_loop.QuitClosure()); SmallCacheImpl impl(run_loop.QuitClosure());
Remote<SmallCache> remote; Remote<SmallCache> remote;
...@@ -1164,7 +1164,7 @@ TEST(UnionTest, InterfaceInUnion) { ...@@ -1164,7 +1164,7 @@ TEST(UnionTest, InterfaceInUnion) {
} }
TEST(UnionTest, InterfaceInUnionFactoryFunction) { TEST(UnionTest, InterfaceInUnionFactoryFunction) {
base::test::TaskEnvironment task_environment; base::test::SingleThreadTaskEnvironment task_environment;
base::RunLoop run_loop; base::RunLoop run_loop;
SmallCacheImpl impl(run_loop.QuitClosure()); SmallCacheImpl impl(run_loop.QuitClosure());
Remote<SmallCache> remote; Remote<SmallCache> remote;
...@@ -1178,7 +1178,7 @@ TEST(UnionTest, InterfaceInUnionFactoryFunction) { ...@@ -1178,7 +1178,7 @@ TEST(UnionTest, InterfaceInUnionFactoryFunction) {
} }
TEST(UnionTest, InterfaceInUnionSerialization) { TEST(UnionTest, InterfaceInUnionSerialization) {
base::test::TaskEnvironment task_environment; base::test::SingleThreadTaskEnvironment task_environment;
base::RunLoop run_loop; base::RunLoop run_loop;
SmallCacheImpl impl(run_loop.QuitClosure()); SmallCacheImpl impl(run_loop.QuitClosure());
Remote<SmallCache> remote; Remote<SmallCache> remote;
...@@ -1215,7 +1215,7 @@ class UnionInterfaceImpl : public UnionInterface { ...@@ -1215,7 +1215,7 @@ class UnionInterfaceImpl : public UnionInterface {
}; };
TEST(UnionTest, UnionInInterface) { TEST(UnionTest, UnionInInterface) {
base::test::TaskEnvironment task_environment; base::test::SingleThreadTaskEnvironment task_environment;
UnionInterfaceImpl impl; UnionInterfaceImpl impl;
Remote<UnionInterface> remote; Remote<UnionInterface> remote;
Receiver<UnionInterface> receiver(&impl, remote.BindNewPipeAndPassReceiver()); Receiver<UnionInterface> receiver(&impl, remote.BindNewPipeAndPassReceiver());
......
...@@ -220,7 +220,7 @@ class ValidationTest : public testing::Test { ...@@ -220,7 +220,7 @@ class ValidationTest : public testing::Test {
ValidationTest() {} ValidationTest() {}
protected: protected:
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
}; };
class ValidationIntegrationTest : public ValidationTest { class ValidationIntegrationTest : public ValidationTest {
......
...@@ -59,7 +59,7 @@ class WTFTypesTest : public testing::Test { ...@@ -59,7 +59,7 @@ class WTFTypesTest : public testing::Test {
WTFTypesTest() {} WTFTypesTest() {}
private: private:
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
}; };
WTF::Vector<WTF::String> ConstructStringArray() { WTF::Vector<WTF::String> ConstructStringArray() {
......
...@@ -38,7 +38,7 @@ class DataPipeDrainerTest : public testing::Test, ...@@ -38,7 +38,7 @@ class DataPipeDrainerTest : public testing::Test,
void OnDataComplete() override { completion_callback_.Run(); } void OnDataComplete() override { completion_callback_.Run(); }
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
std::string data_; std::string data_;
std::unique_ptr<DataPipeDrainer> drainer_; std::unique_ptr<DataPipeDrainer> drainer_;
......
...@@ -40,7 +40,7 @@ class SimpleWatcherTest : public testing::Test { ...@@ -40,7 +40,7 @@ class SimpleWatcherTest : public testing::Test {
~SimpleWatcherTest() override {} ~SimpleWatcherTest() override {}
private: private:
base::test::TaskEnvironment task_environment_; base::test::SingleThreadTaskEnvironment task_environment_;
DISALLOW_COPY_AND_ASSIGN(SimpleWatcherTest); DISALLOW_COPY_AND_ASSIGN(SimpleWatcherTest);
}; };
......
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