0

[fuchsia] Extract web_engine_shell from engine/test/ to shell/

Bug: 1081525, 1309686
Change-Id: Ib7004e7eb450390938f485f135d900d26137e5d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3708350
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Commit-Queue: David Dorwin <ddorwin@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1018680}
This commit is contained in:
David Dorwin
2022-06-28 14:53:27 +00:00
committed by Chromium LUCI CQ
parent 685bd298da
commit e280da259c
20 changed files with 140 additions and 100 deletions

@ -2382,8 +2382,8 @@ def CheckSpamLogging(input_api, output_api):
r"^courgette[\\/]courgette_tool\.cc$",
r"^extensions[\\/]renderer[\\/]logging_native_handler\.cc$",
r"^fuchsia_web[\\/]common[\\/]init_logging.cc$",
r"^fuchsia[\\/]engine[\\/]browser[\\/]frame_impl.cc$",
r"^fuchsia_web[\\/]runners[\\/]common[\\/]web_component.cc$",
r"^fuchsia_web[\\/]shell[\\/]web_engine_shell.cc$",
r"^headless[\\/]app[\\/]headless_shell\.cc$",
r"^ipc[\\/]ipc_logging\.cc$",
r"^native_client_sdk[\\/]",

@ -234,8 +234,10 @@ cipd_archive("web_engine_shell") {
description = "Simple command-line embedder for WebEngine."
testonly = true
deps = [ "//fuchsia_web/webengine:web_engine_shell_pkg" ]
sources = [ "${root_gen_dir}/fuchsia_web/webengine/web_engine_shell/web_engine_shell.far" ]
deps = [ "//fuchsia_web/shell:web_engine_shell_pkg" ]
sources = [
"${root_gen_dir}/fuchsia_web/shell/web_engine_shell/web_engine_shell.far",
]
}
_stripped_chromedriver_file = "${root_out_dir}/clang_x64/stripped/chromedriver"

@ -730,9 +730,11 @@ if (is_android) {
"//content/test:telemetry_gpu_integration_test_support",
"//tools/perf/chrome_telemetry_build:telemetry_chrome_test",
]
# TODO(crbug.com/1310086): Move WebEngine-specific cases in //fuchsia_web.
if (fuchsia_browser_type == "web_engine_shell") {
data_deps += [
"//fuchsia_web/webengine:web_engine_shell",
"//fuchsia_web/shell",
"//fuchsia_web/webengine:web_engine_with_webui_installer",
]
}

@ -789,7 +789,7 @@ if (is_fuchsia) {
data = [ "//content/test/gpu/fuchsia_util.py" ]
data_deps = [
"//chrome/app:chrome_fuchsia",
"//fuchsia_web/webengine:web_engine_shell",
"//fuchsia_web/shell",
"//fuchsia_web/webengine:web_engine_with_webui_installer",
]
}

@ -38,16 +38,18 @@ def RunTestOnFuchsiaDevice(script_cmd):
if runner_script_args.browser == 'web-engine-shell':
package_names = ['web_engine_with_webui', 'web_engine_shell']
package_dir = os.path.join(runner_script_args.out_dir, 'gen', 'fuchsia_web',
'webengine')
package_dirs = [
os.path.join(runner_script_args.out_dir, 'gen', 'fuchsia_web',
'webengine'),
os.path.join(runner_script_args.out_dir, 'gen', 'fuchsia_web', 'shell')
]
else:
package_names = ['chrome']
package_dir = os.path.join(runner_script_args.out_dir, 'gen', 'chrome',
'app')
package_dirs = [
os.path.join(runner_script_args.out_dir, 'gen', 'chrome', 'app')
]
package_paths = list(
map(lambda package_name: os.path.join(package_dir, package_name),
package_names))
package_paths = list(map(os.path.join, package_dirs, package_names))
# Pass all other arguments to the gpu integration tests.
script_cmd.extend(test_args)
@ -80,9 +82,9 @@ def RunTestOnFuchsiaDevice(script_cmd):
# Install necessary packages on the device.
far_files = list(
map(
lambda package_name: os.path.join(package_dir, package_name,
package_name + '.far'),
package_names))
lambda package_dir, package_name: os.path.join(
package_dir, package_name, package_name + '.far'),
package_dirs, package_names))
target.InstallPackage(far_files)
return subprocess.call(script_cmd)
finally:

@ -5,7 +5,7 @@
General instruction on running and debugging GPU integration tests can be
found [here](../gpu/gpu_testing.md).
Fuchsia uses either [web_engine_shell](../../fuchsia_web/webengine/test/README.md)
Fuchsia uses either [web_engine_shell](../../fuchsia_web/shell/README.md)
or the Chrome browser to run GPU integration tests. For the sake of this
example, we will be using `web_engine_shell` as the target browser and
`gpu_process` as the test suite we wish to execute. Build the target

@ -11,9 +11,11 @@ visibility = [ "//:gn_all" ]
# TODO(crbug.com/1081525): Update these to targets within this directory as
# they are moved.
group("gn_all") {
testonly = true
deps = [
"runners:cast_runner",
"runners:web_runner",
"shell",
"webengine:web_engine",
]
}

@ -0,0 +1,69 @@
# Copyright 2022 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
assert(is_fuchsia)
import("//build/config/fuchsia/generate_runner_scripts.gni")
# Nothing else should depend on these targets except the final component.
visibility = [ ":*" ]
group("shell") {
testonly = true
visibility += [
"//chrome/test:*",
"//content/test:*",
"//fuchsia_web:gn_all",
]
deps = [ ":web_engine_shell" ]
}
fuchsia_component("web_engine_shell_component") {
testonly = true
manifest = "web_engine_shell.cmx"
data_deps = [ ":web_engine_shell_exec" ]
}
fuchsia_package("web_engine_shell_pkg") {
testonly = true
# TODO(fxbug.dev/100944): Add appropriate visibility when fixed.
package_name = "web_engine_shell"
deps = [ ":web_engine_shell_component" ]
}
fuchsia_package_installer("web_engine_shell") {
testonly = true
package = ":web_engine_shell_pkg"
package_name = "web_engine_shell"
package_deps = [
[
"//fuchsia_web/webengine:web_engine",
"web_engine",
],
[
"//fuchsia_web/webengine:web_engine_with_webui",
"web_engine_with_webui",
],
]
}
executable("web_engine_shell_exec") {
testonly = true
sources = [ "web_engine_shell.cc" ]
data = [ "data" ]
deps = [
"//base",
"//fuchsia_web/common",
"//fuchsia_web/webinstance_host/",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.policy",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.web",
"//third_party/fuchsia-sdk/sdk/pkg/fdio",
"//third_party/fuchsia-sdk/sdk/pkg/scenic_cpp",
"//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
"//url",
]
}

3
fuchsia_web/shell/DEPS Normal file

@ -0,0 +1,3 @@
include_rules = [
"+fuchsia_web/webinstance_host",
]

3
fuchsia_web/shell/OWNERS Normal file

@ -0,0 +1,3 @@
# For sandbox security review.
per-file *.cmx=set noparent
per-file *.cmx=file://build/fuchsia/SECURITY_OWNERS

@ -0,0 +1,26 @@
*WebEngine Shell*
The WebEngine Shell is a simple command-line executable which will create a
fullscreen browsing session and navigate it to a specified URL. It can be used
for validating web platform features, or it can serve as example code for
embedding WebEngine in C++ applications.
**Usage**
To build and run WebEngine Shell, execute the following commands:
```
$ autoninja -C $OUTDIR web_engine_shell
$ $OUTDIR/bin/deploy_web_engine_shell --fuchsia-out-dir $FUCHSIA_OUTDIR
$ cd $FUCHSIA
$ fx shell
$ run fuchsia-pkg://fuchsia.com/web_engine_shell#meta/web_engine_shell.cmx --remote-debugging-port=1234 http://www.example.com
```
Local files can be deployed with the WebEngine Shell and accessed via the
URL `fuchsia-dir://data/PATH/TO/FILE`. Files may be added to the directory
by placing them under the path `//fuchsia_web/webengine/data`.
Here is an example command line which loads a local file:
```
$ run fuchsia-pkg://fuchsia.com/web_engine_shell#meta/web_engine_shell.cmx fuchsia-dir://data/index.html
```

@ -169,13 +169,13 @@ int main(int argc, char** argv) {
additional_args.erase(additional_args.begin());
// Set up the content directory fuchsia-pkg://shell-data/, which will host
// the files stored under //fuchsia_web/webengine/test/shell_data.
// the files stored under //fuchsia_web/shell/data.
fuchsia::web::CreateContextParams create_context_params;
fuchsia::web::ContentDirectoryProvider content_directory;
base::FilePath pkg_path;
base::PathService::Get(base::DIR_SRC_TEST_DATA_ROOT, &pkg_path);
content_directory.set_directory(base::OpenDirectoryHandle(
pkg_path.AppendASCII("fuchsia_web/webengine/test/shell_data")));
pkg_path.AppendASCII("fuchsia_web/shell/data")));
content_directory.set_name("shell-data");
std::vector<fuchsia::web::ContentDirectoryProvider> content_directories;
content_directories.emplace_back(std::move(content_directory));

@ -5,7 +5,6 @@
assert(is_fuchsia)
import("//build/config/fuchsia/generate_runner_scripts.gni")
import("//build/config/fuchsia/symbol_archive.gni")
import("//build/config/locales.gni")
import("//testing/test.gni")
import("//third_party/fuchsia-sdk/sdk/build/fidl_library.gni")
@ -360,6 +359,7 @@ fuchsia_component("context_provider_component") {
}
fuchsia_package("web_engine") {
# TODO(fxbug.dev/100944): Add appropriate visibility when fixed.
deps = [
":context_provider_component",
":web_instance_component",
@ -398,6 +398,7 @@ fuchsia_component("context_provider_with_webui_component") {
}
fuchsia_package("web_engine_with_webui") {
# TODO(fxbug.dev/100944): Add appropriate visibility when fixed.
deps = [
":context_provider_with_webui_component",
":web_instance_component",
@ -613,7 +614,8 @@ test("web_engine_integration_tests") {
"web_engine_integration_test_base.cc",
"web_engine_integration_test_base.h",
# TODO(crbug.com/1081525): Move to //fuchsia_web/webinstance_host/.
# TODO(crbug.com/1081525): Move to //fuchsia_web/webinstance_host/ and
# remove the deps below.
"web_instance_host_integration_test.cc",
]
data = [ "test/data" ]
@ -647,50 +649,3 @@ test("web_engine_integration_tests") {
"//build/config/fuchsia/test/web_instance_host_capabilities.test-cmx",
]
}
fuchsia_component("web_engine_shell_component") {
testonly = true
manifest = "test/web_engine_shell.cmx"
data_deps = [ ":web_engine_shell_exec" ]
}
fuchsia_package("web_engine_shell_pkg") {
testonly = true
package_name = "web_engine_shell"
deps = [ ":web_engine_shell_component" ]
}
fuchsia_package_installer("web_engine_shell") {
testonly = true
package = ":web_engine_shell_pkg"
package_name = "web_engine_shell"
package_deps = [
[
":web_engine",
"web_engine",
],
[
":web_engine_with_webui",
"web_engine_with_webui",
],
]
}
executable("web_engine_shell_exec") {
testonly = true
sources = [ "test/web_engine_shell.cc" ]
data = [ "test/shell_data" ]
deps = [
"//base",
"//fuchsia_web/common",
"//fuchsia_web/webinstance_host",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.policy",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.web",
"//third_party/fuchsia-sdk/sdk/pkg/fdio",
"//third_party/fuchsia-sdk/sdk/pkg/scenic_cpp",
"//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
"//url",
]
}

@ -9,7 +9,6 @@ include_rules = [
"+components/version_info",
"+content/public/app",
"+content/public/common",
"+fuchsia_web/webinstance_host",
"+google_apis",
"+gpu/command_buffer/service/gpu_switches.h",
"+media/base/media_switches.h",
@ -22,10 +21,16 @@ include_rules = [
]
specific_include_rules = {
"context_provider_impl\.*" : [
"+fuchsia_web/webinstance_host"
],
"context_provider_impl_unittest\.cc": [
"+services/network/public/cpp/network_switches.h"
],
"web_engine_browser_main_parts\.cc": [
"+components/fuchsia_legacymetrics/legacymetrics_client.h"
]
],
"web_instance_host_integration_test\.cc" : [
"+fuchsia_web/webinstance_host"
],
}

@ -1,6 +1,3 @@
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
# For sandbox security review.
per-file context_provider_impl.*=set noparent
per-file context_provider_impl.*=file://build/fuchsia/SECURITY_OWNERS

@ -1,26 +0,0 @@
*Web Engine Shell*
The Web Engine Shell is a simple command-line executable which will create a
fullscreen browsing session and navigate it to a specified URL. It can be used
for validating web platform features, or it can serve as example code for
embedding Web Engine in C++ applications.
**Usage**
To build and run Web Engine Shell, execute the following commands:
```
$ autoninja -C $OUTDIR web_engine_shell
$ $OUTDIR/bin/install_web_engine_shell --fuchsia-out-dir $FUCHSIA_OUTDIR
$ cd $FUCHSIA
$ fx shell
$ run fuchsia-pkg://fuchsia.com/web_engine_shell#meta/web_engine_shell.cmx --remote-debugging-port=1234 http://www.example.com
```
Local files can be deployed with the Web Engine Shell and accessed via the
URL `fuchsia-dir://shell-data/PATH/TO/FILE`. Files may be added to the directory
by placing them under the path `//fuchsia_web/webengine/test/shell_data`.
Here is an example command line which loads a local file:
```
$ run fuchsia-pkg://fuchsia.com/web_engine_shell#meta/web_engine_shell.cmx fuchsia-dir://shell-data/index.html
```

@ -11,7 +11,7 @@ source_set("webinstance_host") {
visibility += [
# WebEngine clients that instantiate WebInstances directly.
"//fuchsia_web/runners/*",
"//fuchsia_web/webengine:web_engine_shell_exec",
"//fuchsia_web/shell:web_engine_shell_exec",
# TODO(crbug.com/1081525): Change to the context_provider target when created.
"//fuchsia_web/webengine:web_engine_core",

@ -2001,7 +2001,7 @@
"type": "console_test_launcher",
},
"web_engine_shell_pkg": {
"label": "//fuchsia_web/webengine:web_engine_shell_pkg",
"label": "//fuchsia_web/shell:web_engine_shell_pkg",
"type": "additional_compile_target",
},
"web_engine_unittests": {