0
Files
src/fuchsia_web
David Song a6510cd992 Reland "[fuchsia] Switch browsertests to Flatland"
This is a reland of commit c537ce7cc0

Previously this broke component builds because FrameWindowTreeHost was
not exported.

Original change's description:
> [fuchsia] Switch browsertests to Flatland
>
> Switch Browsertests to run with the Flatland TestUiStack, and remove
> scenic hardcoding in WebEngineTestLauncher. WebEngineBrowserMainParts
> picks the appropriate Ozone platform based on
> fuchsia.ui.scenic/Scenic.UseFlatland. Test configurations that cannot
> use Scenic or Flatland should use Headless instead with
> --ozone-platform=headless. See crrev.com/c/4001000 for example.
>
> * web_engine_browsertests now runs with the Flatland TestUiStack.
> * cast_runner_browsertests now runs with the same Flatland TestUiStack
>   to detect Scenic.
> * FrameImplTest.VisibilityState is migrated to CreateView2 because
>   GraphicalPresenter no longer accepts GFX parameters.
> * VirtualKeyboardTest and KeyboardInputTest are migrated to CreateView2
>   because they assert the KOID of the ViewRef.
> * VirtualKeyboardTest and KeyboardInputTest are skipped when ran with
>   headless Ozone because keyboard events are ignored.
>
> Tests can continue to use Frame.CreateView and
> Frame.CreateViewWithViewRef for now, since GFX APIs are still present.
> Future CLs will migrate these to CreateView2.
>
>
> Bug: 1300993
> Change-Id: I9655bf1ec5185cf6949e21b89db54490ef28e58a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4371128
> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
> Commit-Queue: David Song <wintermelons@google.com>
> Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1148204}

Bug: 1300993
Change-Id: I59bafd3981ab4223b402ec717041898bf44c3ecd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4757320
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Commit-Queue: David Song <wintermelons@google.com>
Cr-Commit-Position: refs/heads/main@{#1181764}
2023-08-09 23:41:58 +00:00
..

fuchsia.web - Fuchsia WebEngine and Runners

This directory contains code related to the fuchsia.web FIDL API. Specifically, it contains the implementation of Fuchsia WebEngine and code related to it, including the Runners that use it. Code in this directory must not be used outside it and its subdirectories.

General information about Chromium on Fuchsia is here.

[TOC]

Code organization

Each of the following subdirectories contain code for a specific Fuchsia service:

  • ./common contains code shared by both WebEngine and Runners.
  • ./runnerscontains implementations of Fuchsia sys.runner.
    • ./runners/cast Enables the Fuchsia system to launch Cast applications.
  • ./shell contains WebEngineShell, a simple wrapper for launching URLs in WebEngine from the command line.
  • ./webengine contains the WebEngine implementation. WebEngine is an implementation of fuchsia.web that enables Fuchsia Components to render web content using Chrome's Content layer.
  • ./webinstance_host contains code for WebEngine clients to directly instantiate a WebInstance Component (web_instance.cm) using the WebEngine package.

Test code

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_web/webengine:web_engine_integration_tests make use of the //fuchsia_web/webengine: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. For example, the //fuchsia_web/webengine/test directory, which contains code shared by all browser tests, and //fuchsia_web/common/test, which contains code shared by tests for both WebEngine and Runners.