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

Unified Diff: ui/views/mus/views_mus_test_suite.cc

Issue 2645973006: [Service Manager] Get rid of dynamic service discovery (Closed)
Patch Set: . Created 3 years, 11 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
« no previous file with comments | « ui/views/mus/run_all_unittests_mus.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/views_mus_test_suite.cc
diff --git a/ui/views/mus/views_mus_test_suite.cc b/ui/views/mus/views_mus_test_suite.cc
index 9d79bf024734a78f94a8a6717ccefb1f88507a8c..57776440cbec6e94308fc9e3fbe6ee2fbe5c8271 100644
--- a/ui/views/mus/views_mus_test_suite.cc
+++ b/ui/views/mus/views_mus_test_suite.cc
@@ -14,6 +14,9 @@
#include "base/synchronization/waitable_event.h"
#include "base/threading/simple_thread.h"
#include "base/threading/thread.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/scoped_ipc_support.h"
+#include "services/catalog/catalog.h"
#include "services/service_manager/background/background_service_manager.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/service.h"
@@ -35,6 +38,9 @@
namespace views {
namespace {
+const base::FilePath::CharType kCatalogFilename[] =
+ FILE_PATH_LITERAL("views_mus_tests_catalog.json");
+
void EnsureCommandLineSwitch(const std::string& name) {
base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
if (!cmd_line->HasSwitch(name))
@@ -99,7 +105,17 @@ std::unique_ptr<PlatformTestHelper> CreatePlatformTestHelper(
class ServiceManagerConnection {
public:
ServiceManagerConnection()
- : thread_("Persistent service_manager connections") {
+ : thread_("Persistent service_manager connections"),
+ ipc_thread_("IPC thread") {
+ catalog::Catalog::LoadDefaultCatalogManifest(
+ base::FilePath(kCatalogFilename));
+ mojo::edk::Init();
+ ipc_thread_.StartWithOptions(
+ base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
+ ipc_support_ = base::MakeUnique<mojo::edk::ScopedIPCSupport>(
+ ipc_thread_.task_runner(),
+ mojo::edk::ScopedIPCSupport::ShutdownPolicy::CLEAN);
+
base::WaitableEvent wait(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED);
base::Thread::Options options;
@@ -149,11 +165,16 @@ class ServiceManagerConnection {
void SetUpConnections(base::WaitableEvent* wait) {
background_service_manager_ =
- base::MakeUnique<service_manager::BackgroundServiceManager>();
- background_service_manager_->Init(nullptr);
+ base::MakeUnique<service_manager::BackgroundServiceManager>(
+ nullptr, nullptr);
+ service_manager::mojom::ServicePtr service;
context_ = base::MakeUnique<service_manager::ServiceContext>(
base::MakeUnique<DefaultService>(),
- background_service_manager_->CreateServiceRequest(GetTestName()));
+ service_manager::mojom::ServiceRequest(&service));
+ background_service_manager_->RegisterService(
+ service_manager::Identity(
+ GetTestName(), service_manager::mojom::kRootUserID),
+ std::move(service), nullptr);
// ui/views/mus requires a WindowManager running, so launch test_wm.
service_manager::Connector* connector = context_->connector();
@@ -179,6 +200,8 @@ class ServiceManagerConnection {
}
base::Thread thread_;
+ base::Thread ipc_thread_;
+ std::unique_ptr<mojo::edk::ScopedIPCSupport> ipc_support_;
std::unique_ptr<service_manager::BackgroundServiceManager>
background_service_manager_;
std::unique_ptr<service_manager::ServiceContext> context_;
« no previous file with comments | « ui/views/mus/run_all_unittests_mus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698