Commit cabfc901 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Eliminate catalog usage in ui and services/ws

Removes service catalog uses in these directories, replacing them
instead with inlined collections of Manifest objects.

Test-only manifests have also been converted from JSON to C++ and are
inlined within corresponding test code.

Bug: 895616
Change-Id: I9ea61bbc263307feed4eec6e4e66f3a88e785eed
Reviewed-on: https://chromium-review.googlesource.com/c/1436877Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#626197}
parent a1fa2144
......@@ -4,7 +4,6 @@
import("//build/config/ui.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//services/catalog/public/tools/catalog.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//testing/test.gni")
......@@ -162,7 +161,6 @@ static_library("test_support") {
deps = [
":lib",
":tests_catalog_source",
"//base",
"//base/test:test_support",
"//components/viz/test:test_support",
......@@ -173,6 +171,7 @@ static_library("test_support") {
"//services/ws/public/cpp",
"//services/ws/public/cpp/host",
"//services/ws/public/mojom",
"//services/ws/test_ws:manifest",
"//testing/gtest",
"//ui/aura",
"//ui/aura:test_support",
......@@ -190,23 +189,6 @@ static_library("test_support") {
]
}
service_manifest("unittests_manifest") {
name = "ui_ws2_service_unittests"
source = "test_manifest.json"
}
catalog("tests_catalog") {
testonly = true
embedded_services = [ ":unittests_manifest" ]
standalone_services = [ "//services/ws/test_ws:manifest" ]
}
catalog_cpp_source("tests_catalog_source") {
testonly = true
catalog = ":tests_catalog"
generated_function_name = "ws::test::CreateTestCatalog"
}
source_set("tests") {
testonly = true
......
......@@ -12,8 +12,5 @@ per-file *_type_converter*.*=file://ipc/SECURITY_OWNERS
per-file manifest.json=set noparent
per-file manifest.json=file://ipc/SECURITY_OWNERS
per-file test_manifest.json=set noparent
per-file test_manifest.json=file://ipc/SECURITY_OWNERS
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
......@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//services/catalog/public/tools/catalog.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//testing/test.gni")
......@@ -30,38 +29,19 @@ source_set("tests") {
]
deps = [
":tests_catalog_source",
"//base",
"//base/test:test_support",
"//services/service_manager/public/cpp",
"//services/service_manager/public/cpp/test:test_support",
"//services/ws/ime/test_ime_driver:manifest",
"//services/ws/ime/test_ime_driver/public/mojom",
"//services/ws/public/mojom",
"//services/ws/test_ws:manifest",
"//testing/gtest",
]
data_deps = [
":lib",
"//services/ws/ime/test_ime_driver",
"//services/ws/test_ws",
]
}
service_manifest("unittest_manifest") {
name = "ime_unittests"
source = "test_manifest.json"
}
catalog("tests_catalog") {
testonly = true
embedded_services = [ ":unittest_manifest" ]
standalone_services = [
"//services/ws/ime/test_ime_driver:manifest",
"//services/ws/test_ws:manifest",
]
}
catalog_cpp_source("tests_catalog_source") {
testonly = true
catalog = ":tests_catalog"
generated_function_name = "ws::test::CreateImeTestCatalog"
}
per-file test_manifest.json=set noparent
per-file test_manifest.json=file://ipc/SECURITY_OWNERS
......@@ -9,13 +9,15 @@
#include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "services/service_manager/public/cpp/manifest_builder.h"
#include "services/service_manager/public/cpp/service.h"
#include "services/service_manager/public/cpp/service_binding.h"
#include "services/service_manager/public/cpp/test/test_service_manager.h"
#include "services/ws/ime/test_ime_driver/manifest.h"
#include "services/ws/ime/test_ime_driver/public/mojom/constants.mojom.h"
#include "services/ws/ime/tests_catalog_source.h"
#include "services/ws/public/mojom/constants.mojom.h"
#include "services/ws/public/mojom/ime/ime.mojom.h"
#include "services/ws/test_ws/manifest.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/dom/dom_code.h"
......@@ -59,13 +61,21 @@ class TestTextInputClient : public ws::mojom::TextInputClient {
DISALLOW_COPY_AND_ASSIGN(TestTextInputClient);
};
const char kTestServiceName[] = "ime_unittests";
class IMEAppTest : public testing::Test {
public:
IMEAppTest()
: test_service_manager_(ws::test::CreateImeTestCatalog()),
: test_service_manager_(
{test_ws::GetManifest(), test_ime_driver::GetManifest(),
service_manager::ManifestBuilder()
.WithServiceName(kTestServiceName)
.RequireCapability(ws::mojom::kServiceName, "app")
.RequireCapability(test_ime_driver::mojom::kServiceName, "")
.Build()}),
test_service_binding_(
&test_service_,
test_service_manager_.RegisterTestInstance("ime_unittests")) {
test_service_manager_.RegisterTestInstance(kTestServiceName)) {
// test_ime_driver will register itself as the current IMEDriver.
// TODO(https://crbug.com/904148): This should not use |WarmService()|.
connector()->WarmService(service_manager::ServiceFilter::ByName(
......
{
"name": "ime_unittests",
"display_name": "IME Service Unittests",
"interface_provider_specs": {
"service_manager:connector": {
"requires": {
"ui": [ "app" ],
"test_ime_driver": [ ]
}
}
}
}
{
"name": "ui_ws2_service_unittests",
"display_name": "Window Service Unittests",
"interface_provider_specs": {
"service_manager:connector": {
"provides": {
"ui:window_tree_client": [
"ws.mojom.WindowTreeClient"
]
},
"requires": {
"*": [ "app" ],
"ui_ws2_service_unittests": [ "ui:window_tree_client" ],
"viz": [ "viz_host" ]
}
}
}
}
......@@ -8,8 +8,11 @@
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "services/service_manager/public/cpp/manifest_builder.h"
#include "services/ws/common/switches.h"
#include "services/ws/tests_catalog_source.h"
#include "services/ws/public/mojom/constants.mojom.h"
#include "services/ws/public/mojom/window_tree.mojom.h"
#include "services/ws/test_ws/manifest.h"
#include "ui/gl/gl_switches.h"
namespace ws {
......@@ -27,7 +30,17 @@ void EnsureCommandLineSwitch(const std::string& name) {
} // namespace
WindowServerServiceTestBase::WindowServerServiceTestBase()
: test_service_manager_(test::CreateTestCatalog()),
: test_service_manager_(
{test_ws::GetManifest(),
service_manager::ManifestBuilder()
.WithServiceName(kTestAppName)
.ExposeCapability("ui:window_tree_client",
service_manager::Manifest::InterfaceList<
ws::mojom::WindowTreeClient>())
.RequireCapability(kTestAppName, "ui:window_tree_client")
.RequireCapability(ws::mojom::kServiceName, "app")
.RequireCapability("viz", "viz_host")
.Build()}),
test_service_binding_(
this,
test_service_manager_.RegisterTestInstance(kTestAppName)) {
......
......@@ -7,7 +7,6 @@ import("//build/config/features.gni")
import("//build/config/jumbo.gni")
import("//build/config/ui.gni")
import("//components/vector_icons/vector_icons.gni")
import("//services/catalog/public/tools/catalog.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//testing/test.gni")
import("//ui/base/ui_features.gni")
......@@ -915,12 +914,13 @@ jumbo_source_set("test_support") {
]
deps += [
":views_unittests_catalog_source",
"//services/catalog:lib",
"//services/service_manager/background:lib",
"//services/service_manager/public/cpp",
"//services/service_manager/public/mojom",
"//services/ws/common",
"//services/ws/ime/test_ime_driver:manifest",
"//services/ws/public/mojom",
"//services/ws/test_ws:manifest",
"//testing/gtest",
"//ui/compositor:test_support",
"//ui/gl:test_support",
......@@ -929,7 +929,6 @@ jumbo_source_set("test_support") {
]
data_deps = [
":views_unittests_catalog",
"//services/ws/ime/test_ime_driver",
"//ui/resources:ui_test_pak_data",
]
......@@ -1343,35 +1342,3 @@ test("views_perftests") {
"//testing:run_perf_test",
]
}
if (enable_mus) {
service_manifest("unittests_manifest") {
name = "views_unittests"
source = "unittests_manifest.json"
}
service_manifest("interactive_ui_tests_manifest") {
name = "interactive_ui_tests"
source = "interactive_ui_tests_manifest.json"
}
catalog("views_unittests_catalog") {
testonly = true
embedded_services = [
":unittests_manifest",
":interactive_ui_tests_manifest",
]
standalone_services = [
"//services/ws/test_ws:manifest",
"//services/ws/ime/test_ime_driver:manifest",
]
}
catalog_cpp_source("views_unittests_catalog_source") {
testonly = true
catalog = ":views_unittests_catalog"
generated_function_name = "views::CreateViewsUnittestsCatalog"
}
}
......@@ -40,7 +40,6 @@ specific_include_rules = {
],
"views_test_base\.cc": [
"+mojo/core/embedder",
"+services/catalog",
"+services/service_manager/background",
"+services/service_manager/public",
"+services/ws",
......
{
"name": "interactive_ui_tests",
"display_name": "Interactive UI Tests",
"interface_provider_specs": {
"service_manager:connector": {
"requires": {
"*": [ "app", "test" ],
"ui": [ "window_manager" ]
}
}
}
}
......@@ -5,7 +5,6 @@
import("//build/config/features.gni")
import("//build/config/jumbo.gni")
import("//build/config/ui.gni")
import("//services/catalog/public/tools/catalog.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//testing/test.gni")
import("//tools/grit/repack.gni")
......
......@@ -5,7 +5,7 @@ include_rules = [
"+mojo/converters",
"+mojo/core/embedder",
"+mojo/public",
"+services/catalog",
"+services/catalog/public",
"+services/service_manager/public",
"+services/ws",
"+skia",
......
......@@ -4,8 +4,9 @@ include_rules = [
specific_include_rules = {
"platform_test_helper_mus.cc": [
"+services/catalog/catalog.h",
"+services/service_manager/background/background_service_manager.h",
"+services/service_manager/public",
"+services/ws/ime/test_ime_driver/manifest.h",
"+services/ws/test_ws/manifest.h",
]
}
......@@ -8,12 +8,15 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/threading/simple_thread.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/constants.h"
#include "services/service_manager/public/cpp/manifest_builder.h"
#include "services/service_manager/public/cpp/service.h"
#include "services/service_manager/public/cpp/service_binding.h"
#include "services/ws/ime/test_ime_driver/manifest.h"
#include "services/ws/public/mojom/constants.mojom.h"
#include "services/ws/test_ws/manifest.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/test/env_test_helper.h"
......@@ -23,7 +26,6 @@
#include "ui/views/mus/mus_client.h"
#include "ui/views/test/views_test_helper_aura.h"
#include "ui/views/views_delegate.h"
#include "ui/views/views_unittests_catalog_source.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
#include "ui/views/widget/native_widget_aura.h"
......@@ -110,7 +112,27 @@ class PlatformTestHelperMus::ServiceManagerConnection {
void SetUpConnectionsOnBackgroundThread(base::WaitableEvent* wait) {
background_service_manager_ =
std::make_unique<service_manager::BackgroundServiceManager>(
nullptr, CreateViewsUnittestsCatalog());
nullptr, std::vector<service_manager::Manifest>{
test_ws::GetManifest(), test_ime_driver::GetManifest(),
// The manifest used for the test service instance when
// running as a "views_unitttests" executable.
service_manager::ManifestBuilder()
.WithServiceName("views_unittests")
.RequireCapability("*", "app")
.RequireCapability("*", "test")
.Build(),
// The manifest used for the test service instance when
// running as a "views_unitttests" executable.
service_manager::ManifestBuilder()
.WithServiceName("interactive_ui_tests")
.RequireCapability("*", "app")
.RequireCapability("*", "test")
.RequireCapability(ws::mojom::kServiceName,
"window_manager")
.Build()});
service_manager::mojom::ServicePtr service;
default_service_binding_.Bind(mojo::MakeRequest(&service));
background_service_manager_->RegisterService(
......
{
"name": "views_unittests",
"display_name": "Views Unittests",
"interface_provider_specs": {
"service_manager:connector": {
"requires": {
"*": [ "app", "test" ]
}
}
}
}
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