Commit f58373ad authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

AW docs: revise netlog documentation

Miscellaneous edits to the netlog documentation:

* Don't refer to chromium scripts in the manual section; the user may
  not have a chromium checkout
* Fix the script output (the line of output requires --verbose)
* Explain how to clean up the flags file
* Cross-link to the commandline-flags page
* Link to the online netlog viewer, rather than its README file

Bug: 918221
Test: tools/md_browser/md_browser.py
Test: Upload to gerrit > open file > click "gitiles"
Change-Id: Ib2d0027b58266fa39d2c0400567adb3d113cada6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1820090Reviewed-by: default avatarShimi Zhang <ctzsm@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699165}
parent 2d1b33c0
......@@ -16,23 +16,29 @@ check with `adb shell getprop ro.build.type`). Flags cannot be enabled on
production builds of Android.
***
### Python script
If you have a chromium checkout, the preferred way to set the netlog flag is to
use the `record_netlog.py` script like so:
```shell
# Optional: set any flags of your choosing before running the script
# Optional: set any flags of your choosing before running the script. Don't set
# --log-net-log though; this is set by record_netlog.py.
$ build/android/adb_system_webview_command_line --enable-features=MyFeature,MyOtherFeature
Wrote command line file. Current flags (in webview-command-line):
005d1ac915b0c7d6 (bullhead-userdebug 6.0 MDB08M 2353240 dev-keys): --enable-features=MyFeature,MyOtherFeature
# Replace "<app package name>" with your app's package name (ex. the
# WebView Shell is "org.chromium.webview_shell")
# WebView Shell is "org.chromium.webview_shell"). This script will set an
# appropriate value for --log-net-log and handle setup/cleanup.
$ android_webview/tools/record_netlog.py --package="<app package name>"
Running with flags ['--enable-features=MyFeature,MyOtherFeature', '--log-net-log=netlog.json']
Netlog will start recording as soon as app starts up. Press ctrl-C to stop recording.
^C
Pulling netlog to "netlog.json"
```
Then import the JSON file into [the NetLog
viewer](https://chromium.googlesource.com/catapult/+/master/netlog_viewer/).
Then import the JSON file (`netlog.json` in the working directory) into [the
NetLog viewer][1].
### Manual steps
......@@ -48,14 +54,23 @@ viewer](https://chromium.googlesource.com/catapult/+/master/netlog_viewer/).
multiple WebView apps might try (and succeed) to write to the file
simultaneously.
1. Kill the app, if running
1. Set the netlog flag:
1. [Set the netlog flag](commandline-flags.md):
```sh
build/android/adb_system_webview_command_line --log-net-log=${jsonFile}
FLAG_FILE=/data/local/tmp/webview-command-line
adb shell "echo '_ --log-net-log=${jsonFile}' > ${FLAG_FILE}"
```
1. Restart the app. Reproduce whatever is of interest, and then kill the app
when finished
1. Get the netlog off the device:
```sh
adb pull "${appDataDir}/app_webview/${jsonFile}"
adb shell "rm '${appDataDir}/app_webview/${jsonFile}'"
```
1. Follow the step above for using the Netlog viewer
1. Optional: view the data in [the NetLog viewer][1]
1. Optional: [clear the commandline flags](commandline-flags.md):
```sh
FLAG_FILE=/data/local/tmp/webview-command-line
adb shell "rm ${FLAG_FILE}"
```
[1]: https://netlog-viewer.appspot.com/#import
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment