0
Files
src/fuchsia_web
Hzj_jie aedf947a5a [Fuchsia] Move api-key setup to PreBrowserMain
https://crrev.com/c/5424132 shifted the order of initialization. But
FeatureList isn't initialized before accessing api_key_cache and
the api-key will be overridden by WebEngineMainDelegate anyway.

https://crsrc.org/c/fuchsia_web/webengine/web_engine_main_delegate.cc;drc=59ac8227c5dd59754331b3f7f9f85e1a947f1242;l=83

It would cause an assertion failure.

FATAL:feature_list.cc(109)] Check failed: !feature. Accessed feature OverrideAPIKey before FeatureList registration.

So this change moved the api-key setup logic to the PreBrowserMain
which will be executed after the initialization of FeatureList.

The solution eliminates the less preferred fuchsia specific logic in
the google_apis/, so that the original CL https://crrev.com/c/5424132
can keep unchanged.

This change should be safe, the uses of google_apis::GetAPIKey()
won't be before the finish of initialization.
But it would be great to monitor the impact.

https://source.chromium.org/search?q=google_apis::GetApiKey%20-f:google_apis%2F&sq=

Cq-Include-Trybots: luci.chrome.try:fuchsia-smoke-sherlock
Bug: 333064918
Change-Id: I906cff72ed944a50aa3a583c38bc414aefba3183
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5491833
Reviewed-by: David Song <wintermelons@google.com>
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Commit-Queue: David Song <wintermelons@google.com>
Auto-Submit: Zijie He <zijiehe@google.com>
Cr-Commit-Position: refs/heads/main@{#1293945}
2024-04-29 20:41:56 +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.