Skip to content
Permalink
Browse files

Backport some tests in /dbus 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
/dbus.

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

This CL was uploaded by git cl split.

R=hashimoto@chromium.org

Bug: 891670
Change-Id: I05ed8a9c81b692d2deda1ebb32abfce3011f15cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1786754
Auto-Submit: Gabriel Charette <gab@chromium.org>
Commit-Queue: Ryo Hashimoto <hashimoto@chromium.org>
Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694664}
  • Loading branch information
Gabriel Charette Commit Bot
Gabriel Charette authored and Commit Bot committed Sep 9, 2019
1 parent 9757955 commit 1858a23ce09a71969577c9c29b73231d7c795d90
@@ -130,7 +130,7 @@ TEST(BusTest, GetObjectProxyIgnoreUnknownService) {
}

TEST(BusTest, RemoveObjectProxy) {
base::test::TaskEnvironment task_environment;
base::test::SingleThreadTaskEnvironment task_environment;

// Start the D-Bus thread.
base::Thread::Options thread_options;
@@ -318,8 +318,8 @@ TEST(BusTest, DoubleAddAndRemoveMatch) {
}

TEST(BusTest, ListenForServiceOwnerChange) {
base::test::TaskEnvironment task_environment(
base::test::TaskEnvironment::MainThreadType::IO);
base::test::SingleThreadTaskEnvironment task_environment(
base::test::SingleThreadTaskEnvironment::MainThreadType::IO);

RunLoopWithExpectedCount run_loop_state;

@@ -256,7 +256,7 @@ class EndToEndAsyncTest : public testing::Test {
run_loop_->Run();
}

base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
std::unique_ptr<base::RunLoop> run_loop_;
std::vector<std::string> response_strings_;
std::vector<std::string> error_names_;
@@ -83,7 +83,7 @@ class MockTest : public testing::Test {

protected:
std::string response_string_;
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
std::unique_ptr<base::RunLoop> run_loop_;
scoped_refptr<MockBus> mock_bus_;
scoped_refptr<MockObjectProxy> mock_proxy_;
@@ -206,7 +206,7 @@ class ObjectManagerTest
WaitForMethodCallback();
}

base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
std::unique_ptr<base::RunLoop> run_loop_;
std::unique_ptr<base::Thread> dbus_thread_;
scoped_refptr<Bus> bus_;
@@ -159,7 +159,7 @@ class PropertyTest : public testing::Test {
}
}

base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
std::unique_ptr<base::RunLoop> run_loop_;
std::unique_ptr<base::Thread> dbus_thread_;
scoped_refptr<Bus> bus_;
@@ -167,7 +167,7 @@ class SignalSenderVerificationTest : public testing::Test {
base::ThreadRestrictions::SetIOAllowed(false);
}

base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
std::unique_ptr<base::RunLoop> run_loop_;
std::unique_ptr<base::Thread> dbus_thread_;
scoped_refptr<Bus> bus_;

0 comments on commit 1858a23

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