This document describes how to test Android Web Apps (WebAPKs and TWAs) manually and via automated tests.
To test manually using an emulator:
You can use a public PWA (like https://pokedex.org) or serve one locally.
https://pokedex.org.python3 -m http.server 8000.adb reverse tcp:8000 tcp:8000.To trust a TWA or WebAPK during local testing with developer builds, you must bypass Chrome's security checks.
Chrome requires DAL verification to run a TWA in app mode. To bypass this for a test URL:
--disable-digital-asset-link-verification-for-url="https://pokedex.org"out/<Dir>/bin/chrome_public_apk launch --args="--disable-digital-asset-link-verification-for-url=https://pokedex.org"chrome://flags): adb shell "echo '_ --disable-digital-asset-link-verification-for-url=https://pokedex.org' > /data/local/tmp/chrome-command-line"Chrome verifies that WebAPKs are signed by the trusted WebAPK minting server. Locally built debug WebAPKs will fail this check. To bypass this:
--skip-webapk-verificationout/<Dir>/bin/chrome_public_apk launch --args="--skip-webapk-verification"You can use Bubblewrap to generate an APK for your test site and install it: adb install path/to/generated.apk
To test WebAPK installation:
https://pokedex.org).Chromium has several test suites that cover Web App functionality on Android. To keep this guide maintainable, tests are grouped by directory and feature area.
Run any test file or directory (Java instrumentation, host-side Robolectric JUnit, or C++ unit tests) with tools/autotest.py, which automatically selects and builds the matching test target:
tools/autotest.py -C out/<Dir> <path/to/test_file_or_directory>
These tests run on an emulator or physical device to test UI, integration, and lifecycle. Unlike host-side JUnit tests below, instrumentation tests cannot run without an active device.
To start the recommended local development emulator (x64 image, emulator window, and networking enabled):
tools/android/avd/avd.py start -v \ --avd-config tools/android/avd/proto/android_google_apis_x64_local.textpb \ --emulator-window --no-read-only --enable-network
For more options and configuration details, see:
Clank Noogler Guide: Step 5 - Start an emulator (Google internal)
Clank Android Emulator Tips (Google internal)
WebAPKs (chrome/android/javatests/src/org/chromium/chrome/browser/webapps/):
chrome_public_test_apk pre-installs a standalone test WebAPK (org.chromium.webapk.test) in its own Android package and UID, so full integration launches genuinely cross package and UID boundaries through the shell APK into Chrome and associate WebappActivity with a non-Chrome package in PackageManager.WebappActivity UI and lifecycle bound to org.chromium.webapk.test metadata.PackageInstaller installation and update swaps (the test WebAPK is pre-installed before tests run, so installation completes once the request is handled).Client-App Trusted Web Activities (TWAs) (chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/):
org.chromium.chrome.tests.support), including permissiondelegation/ and digitalgoods/.PackageManager App Links checks.org.chromium.chrome.tests.support helper APK only provides bound test services and a deep-link resolution stub (with no TWA launcher activity).Auto-Minted TWAs (chrome/android/javatests/src/org/chromium/chrome/browser/webapps/):
WebAppManager minting and install confirmation: Real OS WebAppManager APK generation, package installation, and interactive OS install-confirmation UI.Install Prompts & Bottom Sheets (chrome/android/javatests/src/org/chromium/chrome/browser/webapps/):
These Robolectric unit tests run on the development host JVM without requiring an emulator or device.
Activity lifecycles, or multi-process Android UID and Binder enforcement.chrome/android/junit/src/org/chromium/chrome/browser/webapps/: WebAPK and webapp registration, storage, lifecycle, and update logic.chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ (including permissiondelegation/ and ui/): Trusted Web Activity verification, delegation, and UI controllers.components/webapps/browser/android/java/src/org/chromium/components/webapps/: Install UI mediators, web app utilities, and auto-minted TWA installer unit tests.These tests cover the standalone WebAPK shell APK and client runtime libraries in isolation from full Chrome and Blink integration (see chrome/android/webapk/README.md for specialized shell APK details).
chrome/android/webapk/libs/client/junit/ (Host-side JUnit)chrome/android/webapk/libs/runtime_library/javatests/ (Instrumentation)chrome/android/webapk/shell_apk/junit/ (Host-side JUnit)chrome/android/webapk/shell_apk/javatests/ (Instrumentation)These tests cover shared native installability and WebAPK data pipelines in isolation from the Android Java framework, Activity lifecycles, and PackageManager.
Activity launches, PackageManager queries, or OS WebAppManager service calls.components/webapps/browser/android/components/webapps/browser/banners/ (Shared, but relevant to Android promotion)components/webapps/browser/installable/ (Shared, but relevant to Android installability)