Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: services/service_manager/public/cpp/service_test.cc

Issue 2878453002: Use ScopedTaskEnvironment instead of MessageLoop in service_manager::test::ServiceTest. (Closed)
Patch Set: fix-build-error Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/service_manager/public/cpp/service_test.cc
diff --git a/services/service_manager/public/cpp/service_test.cc b/services/service_manager/public/cpp/service_test.cc
index cfae6810f13b6cd5ec12890788c69d5cb8527160..96bc3fc6441ff81d9d0d28cfbe795d3852bd0d33 100644
--- a/services/service_manager/public/cpp/service_test.cc
+++ b/services/service_manager/public/cpp/service_test.cc
@@ -32,10 +32,13 @@ void ServiceTestClient::OnBindInterface(
const std::string& interface_name,
mojo::ScopedMessagePipeHandle interface_pipe) {}
-ServiceTest::ServiceTest() {}
+ServiceTest::ServiceTest() : ServiceTest(std::string(), true) {}
ServiceTest::ServiceTest(const std::string& test_name, bool init_edk)
- : test_name_(test_name), init_edk_(init_edk) {}
+ : scoped_task_environment_(
+ base::test::ScopedTaskEnvironment::MainThreadType::UI),
+ test_name_(test_name),
+ init_edk_(init_edk) {}
ServiceTest::~ServiceTest() {}
@@ -48,10 +51,6 @@ std::unique_ptr<Service> ServiceTest::CreateService() {
return base::MakeUnique<ServiceTestClient>(this);
}
-std::unique_ptr<base::MessageLoop> ServiceTest::CreateMessageLoop() {
- return base::MakeUnique<base::MessageLoop>();
-}
-
void ServiceTest::OnStartCalled(Connector* connector,
const std::string& name,
const std::string& user_id) {
@@ -62,8 +61,6 @@ void ServiceTest::OnStartCalled(Connector* connector,
}
void ServiceTest::SetUp() {
- message_loop_ = CreateMessageLoop();
-
DCHECK(!init_edk_);
background_service_manager_ =
@@ -89,7 +86,6 @@ void ServiceTest::SetUp() {
void ServiceTest::TearDown() {
background_service_manager_.reset();
context_.reset();
- message_loop_.reset();
}
} // namespace test

Powered by Google App Engine
This is Rietveld 408576698