README.md
1# WebView Demo App
2
3**See this page rendered in [Gitiles
4markdown](https://android.googlesource.com/platform/frameworks/support/+/androidx-main/webkit/integration-tests/testapp/README.md).**
5
6The WebView/Webkit demo app serves as both a practical demonstration how to use
7the latest AndroidX Webkit APIs and as a means to exercise those APIs for manual
8testing.
9
10## Reading example code
11
12Examples are organized so that each Activity showcases a small subset of related
13APIs. To get started, [find the
14Activity](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:webkit/integration-tests/testapp/src/main/java/com/example/androidx/webkit/)
15for the APIs you're interested in learning about.
16
17## Building the demo app
18
19```shell
20cd frameworks/support/
21
22# Optional: you can use Android Studio as your editor
23./studiow
24
25# Build the app
26./gradlew :webkit:integration-tests:testapp:assembleDebug
27
28# Install the app
29./gradlew :webkit:integration-tests:testapp:installDebug
30
31# Check for Lint warnings
32./gradlew :webkit:integration-tests:testapp:lintDebug
33
34# Run automated espresso tests
35./gradlew :webkit:integration-tests:testapp:connectedAndroidTest
36
37# Optional: launch the app via adb
38adb shell am start -n com.example.androidx.webkit/.MainActivity
39adb shell am start -n com.example.androidx.webkit/.ForceDarkActivity # or, any exported Activity
40```
41
42## Extending the demo app
43
441. Add a new Activity under
45 [src/main/java/com/example/androidx/webkit/](src/main/java/com/example/androidx/webkit/).
461. Add this Activity to the end of the `MenuListView.MenuItem[]` array in
47 [MainActivity.java](src/main/java/com/example/androidx/webkit/MainActivity.java),
48 or in a suitable lower-level Activity, like
49 [SafeBrowsingActivity.java](src/main/java/com/example/androidx/webkit/SafeBrowsingActivity.java).
501. Export this Activity in AndroidManifest.xml. Try to organize your Activity
51 with other related Activities, or leave space if things are unrelated.
521. If reasonable, write automated test cases for your new Activity, following
53 [internal
54 documentation](https://docs.google.com/document/d/1dKmNuGiwlJcd-NkIBLK_1RCJCY588usxP0Uw3kOaLWk/edit?usp=sharing).
551. Before uploading a change, please take a [screen
56 recording](https://developer.android.com/studio/command-line/adb#screenrecord)
57 using the new Activity in the testapp (Googlers should add this to
58 http://go/wvsl-demo-app-recordings for posterity).
591. After landing a change, Googlers should upload screenshots and describe
60 expected behavior on http://go/wvsl-demo-app-guide for future reference.
61
62## Downloading prebuilt APKs
63
64We **do not** publicly distribute prebuilt APKs. Googlers can download prebuilt
65APKs by following [these
66instructions](https://docs.google.com/document/d/1K_uOjyTn_UldZP1YxmvCEYXibDn2YB-S_76r3Y-z0bg/edit?usp=sharing).
67
68## Expected behavior (Googlers only)
69
70Most Activities have documentation for the expected behavior. See descriptions
71and screenshots at http://go/wvsl-demo-app-guide, and can see screen recording
72videos at http://go/wvsl-demo-app-recordings.
73