Skip to content
Permalink
Browse files

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: Scott Violet <sky@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693918}
  • Loading branch information
Gabriel Charette Commit Bot
Gabriel Charette authored and Commit Bot committed Sep 5, 2019
1 parent 24fae53 commit 5d580fe4d56a5100dc89754c2c6525d6c679886b
@@ -1986,7 +1986,7 @@ DEFINE_TEST_CLIENT_TEST_WITH_PIPE(DataPipeStatusChangeInTransitClient,
EXPECT_EQ(MOJO_RESULT_OK,
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.
{
@@ -1275,7 +1275,7 @@ DEFINE_TEST_CLIENT_TEST_WITH_PIPE(MessagePipeStatusChangeInTransitClient,
EXPECT_EQ(MOJO_RESULT_OK,
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.
{
@@ -197,7 +197,7 @@ class BindTaskRunnerTest : public testing::Test {
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> remote_task_runner_;

@@ -235,7 +235,7 @@ class AssociatedBindTaskRunnerTest : public testing::Test {

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_remote_task_runner_;
scoped_refptr<TestTaskRunner> sender_receiver_task_runner_;
@@ -93,7 +93,7 @@ class MojoBindingsPerftest : public testing::Test {
MojoBindingsPerftest() = default;

protected:
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
};

TEST_F(MojoBindingsPerftest, InProcessPingPong) {
@@ -109,7 +109,7 @@ class ConnectorTest : public testing::Test {
ScopedMessagePipeHandle handle1_;

private:
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
};

TEST_F(ConnectorTest, Basic) {
@@ -23,7 +23,7 @@ namespace {

class DataViewTest : public testing::Test {
private:
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
};

struct DataViewHolder {
@@ -130,7 +130,7 @@ class MojoE2EPerftest : public core::test::MojoTestBase {
}

protected:
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;

private:
void RunTests(MojoHandle client_mp, const std::string& test_name) {
@@ -61,7 +61,7 @@ class MultiplexRouterTest : public testing::Test {
ScopedInterfaceEndpointHandle endpoint1_;

private:
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
};

TEST_F(MultiplexRouterTest, BasicRequestResponse) {
@@ -191,7 +191,7 @@ class PickleTest : public testing::Test {
};

private:
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
ChromiumPicklePasserImpl chromium_service_;
ReceiverSet<PicklePasser> chromium_receivers_;
BlinkPicklePasserImpl blink_service_;
@@ -109,7 +109,7 @@ class ReceiverCallbackTest : public testing::Test {
void PumpMessages() { base::RunLoop().RunUntilIdle(); }

private:
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
};

// Tests that the Remote and the Receiver can communicate with each other
@@ -502,7 +502,7 @@ class StrongMathCalculatorImpl : public math::Calculator {
};

TEST(StrongConnectorTest, Math) {
base::test::TaskEnvironment task_environment;
base::test::SingleThreadTaskEnvironment task_environment;

bool disconnected = false;
bool destroyed = false;
@@ -578,7 +578,7 @@ class WeakMathCalculatorImpl : public math::Calculator {
};

TEST(WeakConnectorTest, Math) {
base::test::TaskEnvironment task_environment;
base::test::SingleThreadTaskEnvironment task_environment;

bool disconnected = false;
bool destroyed = false;
@@ -188,7 +188,7 @@ class StructTraitsTest : public testing::Test,
std::move(callback).Run(std::move(u));
}

base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;

ChromiumRectServiceImpl chromium_service_;
ReceiverSet<RectService> chromium_receivers_;
@@ -1148,7 +1148,7 @@ class SmallCacheImpl : public SmallCache {
};

TEST(UnionTest, InterfaceInUnion) {
base::test::TaskEnvironment task_environment;
base::test::SingleThreadTaskEnvironment task_environment;
base::RunLoop run_loop;
SmallCacheImpl impl(run_loop.QuitClosure());
Remote<SmallCache> remote;
@@ -1164,7 +1164,7 @@ TEST(UnionTest, InterfaceInUnion) {
}

TEST(UnionTest, InterfaceInUnionFactoryFunction) {
base::test::TaskEnvironment task_environment;
base::test::SingleThreadTaskEnvironment task_environment;
base::RunLoop run_loop;
SmallCacheImpl impl(run_loop.QuitClosure());
Remote<SmallCache> remote;
@@ -1178,7 +1178,7 @@ TEST(UnionTest, InterfaceInUnionFactoryFunction) {
}

TEST(UnionTest, InterfaceInUnionSerialization) {
base::test::TaskEnvironment task_environment;
base::test::SingleThreadTaskEnvironment task_environment;
base::RunLoop run_loop;
SmallCacheImpl impl(run_loop.QuitClosure());
Remote<SmallCache> remote;
@@ -1215,7 +1215,7 @@ class UnionInterfaceImpl : public UnionInterface {
};

TEST(UnionTest, UnionInInterface) {
base::test::TaskEnvironment task_environment;
base::test::SingleThreadTaskEnvironment task_environment;
UnionInterfaceImpl impl;
Remote<UnionInterface> remote;
Receiver<UnionInterface> receiver(&impl, remote.BindNewPipeAndPassReceiver());
@@ -220,7 +220,7 @@ class ValidationTest : public testing::Test {
ValidationTest() {}

protected:
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
};

class ValidationIntegrationTest : public ValidationTest {
@@ -59,7 +59,7 @@ class WTFTypesTest : public testing::Test {
WTFTypesTest() {}

private:
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
};

WTF::Vector<WTF::String> ConstructStringArray() {
@@ -38,7 +38,7 @@ class DataPipeDrainerTest : public testing::Test,

void OnDataComplete() override { completion_callback_.Run(); }

base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
std::string data_;
std::unique_ptr<DataPipeDrainer> drainer_;

@@ -40,7 +40,7 @@ class SimpleWatcherTest : public testing::Test {
~SimpleWatcherTest() override {}

private:
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;

DISALLOW_COPY_AND_ASSIGN(SimpleWatcherTest);
};

0 comments on commit 5d580fe

Please sign in to comment.
You can’t perform that action at this time.