This directory contains implementation code for Fuchsia WebEngine and code specifically related to it, including the Runners that use it.
For general information about building Chromium on Fuchsia, see this documentation.
[TOC]
Each of the following subdirectories contain code for a specific Fuchsia service:
./engine
contains the WebEngine implementation. WebEngine enables Fuchsia applications to embed Chromium frames for rendering web content../runners
contains implementations of Fuchsiasys.runner
../runners/cast
Enables the Fuchsia system to launch Cast applications../runners/web
Enables the Fuchsia system to launch HTTP or HTTPS URLs.
There are 3 major types of tests within this directory:
- Unit tests: Exercise a single class in isolation, allowing full control over the external environment of this class.
- Browser tests: Spawn a full browser process and its child processes. The test code is run inside the browser process, allowing for full access to the browser code - but not other processes.
- Integration tests: Exercise the published FIDL API of a Fuchsia Component. For
instance,
//fuchsia_webengine/engine:web_engine_integration_tests
make use of the//fuchsia_webengine/engine:web_engine
component. The test code runs in a separate process in a separate Fuchsia Component, allowing only access to the published API of the component under test.
Integration tests are more resource-intensive than browser tests, which are in turn more expensive than unit tests. Therefore, when writing new tests, it is preferred to write unit tests over browser tests over integration tests.
As a general rule, test-only code should live in the same directory as the code
under test with an explicit file name, either fake_*
, test_*
,
*_unittest.cc
, *_ browsertest.cc
or *_integration_test.cc
.
Test code that is shared across components should live in a dedicated test
directory, under the cr_fuchsia
namespace. For instance, see the
//fuchsia/engine/test
directory, which contains code shared by all browser
tests.
Fuchsia binaries are deployed and executed via scripts that are automatically
generated by the fuchsia_package_installer()
or
fuchsia_run_script_with_packages()
GN templates. Details on
deploying and running Fuchsia test binaries can be found
here
Check this documentation for debugging tips.
When you build web_runner
, Chromium will automatically generate scripts for
you that will automatically provision a device with Fuchsia and then install
web_runner
and its dependencies.
To build and run web_runner
, follow these steps:
-
(Optional) Ensure that you have a device ready to boot into Fuchsia.
If you wish to have
web_runner
manage the OS deployment process, then you should have the device booting into Zedboot. -
Build
web_runner
.$ autoninja -C out/fuchsia web_runner
-
Install
web_runner
.-
For devices running Zedboot:
$ out/fuchsia/bin/install_web_runner -d
-
For devices already booted into Fuchsia:
You will need to add command line flags specifying the device's IP address and the path to the
ssh_config
used by the device (located at$FUCHSIA_OUT_DIR/ssh-keys/ssh_config
):$ out/fuchsia/bin/install_web_runner -d --ssh-config $PATH_TO_SSH_CONFIG
-
-
Press Alt-Esc key on your device to switch back to terminal mode or run
fx shell
from the host. -
Launch a webpage.
$ tiles_ctl add https://www.chromium.org/
-
Press Alt-Esc to switch back to graphical view if needed. The browser window should be displayed and ready to use.
-
You can deploy and run new versions of Chromium without needing to reboot.
First kill any running processes:
$ killall context_provider.cmx; killall web_runner.cmx
Then repeat steps 1 through 6 from the installation instructions, excluding step #3 (running Tiles).
-
Press the Windows key to return to the terminal.
-
Instruct tiles_ctl to remove the webpage's window tile. The tile's number is reported by step 6, or it can be found by running
tiles_ctl list
and noting the ID of the "url" entry.$ tiles_ctl remove TILE_NUMBER