0

[fuchsia] Remove support for using test_fonts in CFv1 tests

All tests that use //skia:test_fonts are now component framework v2
components, so it's high time to remove support for using them in v1
components.

Bug: 1287051
Change-Id: I898e6d2ea6490080ec76e2ee1ca243319057168e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3975331
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Auto-Submit: Greg Thompson <grt@chromium.org>
Commit-Queue: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1064826}
This commit is contained in:
Greg Thompson
2022-10-28 14:39:45 +00:00
committed by Chromium LUCI CQ
parent 92a47bf407
commit 2d1bacb14b
6 changed files with 13 additions and 156 deletions
content/web_test
skia
third_party/blink/renderer/platform
ui/gfx

@ -335,6 +335,7 @@ static_library("web_test_renderer") {
"//printing/mojom",
"//services/service_manager/public/cpp",
"//skia",
"//skia:test_fonts",
"//ui/base/ime:ime_types",
"//ui/events:dom_keycode_converter",
"//ui/events:events_base",
@ -355,10 +356,4 @@ static_library("web_test_renderer") {
]
deps += [ "//printing" ]
}
if (is_fuchsia) {
deps += [ "//skia:test_fonts_cfv2" ]
} else {
deps += [ "//skia:test_fonts" ]
}
}

@ -819,45 +819,10 @@ group("test_fonts_resources") {
}
}
source_set("test_fonts") {
testonly = true
deps = [ ":test_fonts_resources" ]
if (is_fuchsia) {
public = [
"ext/test_fonts.h",
"ext/test_fonts_fuchsia.h",
]
sources = [
"ext/test_fonts_fuchsia.cc",
"ext/test_fonts_fuchsia_cfv1.cc",
]
public_deps = [ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.fonts" ]
deps += [
"//base",
"//skia",
"//third_party/abseil-cpp:absl",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.io",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.sys",
"//third_party/fuchsia-sdk/sdk/pkg/fidl_cpp_base",
"//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
]
}
if (is_mac) {
public = [ "ext/test_fonts.h" ]
sources = [ "ext/test_fonts_mac.mm" ]
deps += [ "//base" ]
}
}
# Fuchsia components that use the test fonts must include
# "//build/config/fuchsia/test/test_fonts.shard.test-cml" in their
# `additional_manifest_fragments`.
# TODO(https://crbug.com/1287051): Once all consumers are migrated to CFv2,
# move the `is_fuchsia` section below up into `test_fonts` above and remove this
# target.
source_set("test_fonts_cfv2") {
source_set("test_fonts") {
testonly = true
deps = [ ":test_fonts_resources" ]
@ -878,6 +843,11 @@ source_set("test_fonts_cfv2") {
"//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
]
}
if (is_mac) {
public = [ "ext/test_fonts.h" ]
sources = [ "ext/test_fonts_mac.mm" ]
deps += [ "//base" ]
}
}
test("skia_unittests") {
@ -903,6 +873,7 @@ test("skia_unittests") {
deps = [
":skia",
":test_fonts",
"//base",
"//base/test:test_support",
"//mojo/core/test:run_all_unittests",
@ -924,14 +895,9 @@ test("skia_unittests") {
if (is_fuchsia) {
sources += [ "ext/fontmgr_fuchsia_unittest.cc" ]
deps += [
":test_fonts_cfv2",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.fonts",
]
deps += [ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.fonts" ]
additional_manifest_fragments =
[ "//build/config/fuchsia/test/test_fonts.shard.test-cml" ]
} else {
deps += [ ":test_fonts" ]
}
if (skia_support_skottie) {

@ -1,92 +0,0 @@
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "skia/ext/test_fonts_fuchsia.h"
#include <fuchsia/fonts/cpp/fidl.h>
#include <fuchsia/io/cpp/fidl.h>
#include <fuchsia/sys/cpp/fidl.h>
#include <lib/fidl/cpp/interface_handle.h>
#include <lib/sys/cpp/component_context.h>
#include <utility>
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/fuchsia/file_utils.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/no_destructor.h"
#include "base/path_service.h"
#include "skia/ext/test_fonts.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace skia {
namespace {
// Runs the fonts component via fuchsia.sys.Launcher.
class TestFontsProvider {
public:
TestFontsProvider();
TestFontsProvider(const TestFontsProvider&) = delete;
TestFontsProvider& operator=(const TestFontsProvider&) = delete;
~TestFontsProvider();
fuchsia::fonts::ProviderHandle GetProvider();
private:
fidl::InterfaceHandle<fuchsia::sys::ComponentController> controller_;
absl::optional<sys::ServiceDirectory> services_client_;
};
TestFontsProvider::TestFontsProvider() {
// Start a fuchsia.fonts.Provider instance and configure it to load the test
// fonts, which must be bundled in the calling process' package.
fuchsia::sys::LaunchInfo launch_info;
launch_info.url = "fuchsia-pkg://fuchsia.com/fonts#meta/fonts.cmx";
// Note: the manifest name here matches the default used by the Fuchsia fonts
// component so that the file can be found automagically by the modern (cfv2)
// variant.
launch_info.arguments.emplace(
{"--font-manifest", "/test_fonts/all.font_manifest.json"});
launch_info.flat_namespace = fuchsia::sys::FlatNamespace::New();
launch_info.flat_namespace->paths.push_back("/test_fonts");
base::FilePath assets_path;
CHECK(base::PathService::Get(base::DIR_ASSETS, &assets_path))
<< "Can't get DIR_ASSETS";
launch_info.flat_namespace->directories.push_back(
base::OpenDirectoryHandle(assets_path.AppendASCII("test_fonts"))
.TakeChannel());
fidl::InterfaceHandle<fuchsia::io::Directory> font_provider_services_dir;
launch_info.directory_request =
font_provider_services_dir.NewRequest().TakeChannel();
fuchsia::sys::LauncherSyncPtr launcher;
auto status =
base::ComponentContextForProcess()->svc()->Connect(launcher.NewRequest());
ZX_CHECK(status == ZX_OK, status) << "Connect to fuchsia.sys.Launcher";
launcher->CreateComponent(std::move(launch_info), controller_.NewRequest());
services_client_.emplace(std::move(font_provider_services_dir));
}
TestFontsProvider::~TestFontsProvider() = default;
fuchsia::fonts::ProviderHandle TestFontsProvider::GetProvider() {
fuchsia::fonts::ProviderHandle font_provider;
services_client_->Connect(font_provider.NewRequest());
return font_provider;
}
} // namespace
fuchsia::fonts::ProviderHandle GetTestFontsProvider() {
static base::NoDestructor<TestFontsProvider> test_fonts_provider;
return test_fonts_provider->GetProvider();
}
} // namespace skia

@ -2259,6 +2259,7 @@ source_set("blink_platform_unittests_sources") {
"//services/viz/public/mojom",
"//skia",
"//skia:skcms",
"//skia:test_fonts",
"//testing/gmock",
"//testing/gtest",
"//third_party:freetype_harfbuzz",
@ -2295,12 +2296,6 @@ source_set("blink_platform_unittests_sources") {
if (use_minikin_hyphenation) {
defines += [ "USE_MINIKIN_HYPHENATION" ]
}
if (is_fuchsia) {
deps += [ "//skia:test_fonts_cfv2" ]
} else {
deps += [ "//skia:test_fonts" ]
}
}
executable("image_decode_bench") {
@ -2416,6 +2411,7 @@ test("blink_fuzzer_unittests") {
"//base/test:test_support",
"//gin:gin",
"//mojo/core/embedder:embedder",
"//skia:test_fonts",
"//third_party/blink/public:test_support",
]
@ -2428,14 +2424,11 @@ test("blink_fuzzer_unittests") {
}
if (is_fuchsia) {
deps += [ "//skia:test_fonts_cfv2" ]
test_runner_shard = "//build/config/fuchsia/test/elf_test_ambient_exec_runner.shard.test-cml"
additional_manifest_fragments = [
"//build/config/fuchsia/test/test_fonts.shard.test-cml",
"//build/config/fuchsia/test/mark_vmo_executable.shard.test-cml",
]
} else {
deps += [ "//skia:test_fonts" ]
}
}

@ -169,17 +169,12 @@ source_set("blink_heap_unittests_sources") {
"//base/test:test_support",
"//gin:gin",
"//mojo/core/embedder:embedder",
"//skia:test_fonts",
"//testing/gmock",
"//testing/gtest",
"//third_party/blink/renderer/platform:test_support",
"//third_party/blink/renderer/platform/wtf",
]
if (is_fuchsia) {
deps += [ "//skia:test_fonts_cfv2" ]
} else {
deps += [ "//skia:test_fonts" ]
}
}
test("blink_heap_perftests") {

@ -908,7 +908,7 @@ test("gfx_unittests") {
}
if (is_fuchsia) {
deps += [ "//skia:test_fonts_cfv2" ]
deps += [ "//skia:test_fonts" ]
additional_manifest_fragments =
[ "//build/config/fuchsia/test/test_fonts.shard.test-cml" ]
}