blob: da74e26b76783228da6058368ac90fe2fa4fa518 [file] [log] [blame] [view]
dtrainorac84a372015-10-05 18:01:481# Running Blimp
sriramsr0b6a45f42016-06-30 19:42:182[TOC]
dtrainorac84a372015-10-05 18:01:483
4See [build](build.md) for instructions on how to build Blimp.
5
sriramsr0b6a45f42016-06-30 19:42:186## Android Client
dtrainorac84a372015-10-05 18:01:487
sriramsr0b6a45f42016-06-30 19:42:188### Installing the client
9
10Install the Blimp APK with the following:
11
12```bash
13./build/android/adb_install_apk.py $(PRODUCT_DIR)/apks/Blimp.apk
14```
15
16This is equivalent to just running:
17
18```bash
19adb install $(PRODUCT_DIR)/apks/Blimp.apk
20```
21
22### Setting up command line flags
23
24Set up any command line flags with:
25
26```bash
27./build/android/adb_blimp_command_line --your-flag-here
28```
29
30To see your current command line, run `adb_blimp_command_line` without any
31arguments.
32
33The Blimp client reads command line arguments from the file
34`/data/local/blimp-command-line` and the above script reads/writes that file.
35Typical format of the file is `chrome --your-flag-here`. So one can use `adb`
36directly to create the file:
37
38```bash
39echo 'chrome --engine-ip=10.0.2.2 --engine-port=25467 --engine-transport=tcp' \
40 '--blimp-client-token-path=/data/data/org.chromium.blimp/blimp_client_token' \
41 '--vmodule="*=1""' > /tmp/blimp-command-line
42adb push /tmp/blimp-command-line /data/local/blimp-command-line
43adb shell start chmod 0664 /data/local/blimp-command-line
44```
dtrainorac84a372015-10-05 18:01:4845
khushalsagara77412e12016-04-05 22:23:3346### Instructing client to connect to specific host
47
48To have the client connect to a custom engine use the `--engine-ip`,
49`--engine-port`, and `--engine-transport` flags. The possible valid
50values for `--engine-transport` are 'tcp' and 'ssl'.
51An example valid endpoint would be
sriramsr0b6a45f42016-06-30 19:42:1852`--engine-ip=127.0.0.1 --engine-port=25467 --engine-transport=tcp`.
khushalsagara77412e12016-04-05 22:23:3353
54SSL-encrypted connections take an additional flag
55`--engine-cert-path` which specifies a path to a PEM-encoded certificate
sriramsr0b6a45f42016-06-30 19:42:1856file (e.g. `--engine-cert-path=/path_on_device_to/file.pem`). Remember to also
57copy the file to the device when using this option.
khushalsagara77412e12016-04-05 22:23:3358
59### Requesting the complete page from the engine
sriramsr0b6a45f42016-06-30 19:42:1860The engine sends partially rendered content to the client. To request the
61complete page from the engine, use the `--download-whole-document` flag on the
62client.
khushalsagara77412e12016-04-05 22:23:3363
lethalantidotef16b3ac2016-05-16 19:06:5264### Specifying the client auth token file
65The client needs access to a file containing a client auth token. One should
66make sure this file is available by pushing it onto the device before running
67the client. One can do this by running the following command:
68
69```bash
70adb push /path/to/blimp_client_token \
71 /data/data/org.chromium.blimp/blimp_client_token
72```
73
74To have the client use the given client auth token file, use the
75`--blimp-client-token-path` flag (e.g.
76`--blimp-client-token-path=/data/data/org.chromium.blimp/blimp_client_token`)
77
lethalantidotefb98d142016-05-16 23:42:0378An example of a client token file is
79[test_client_token](https://code.google.com/p/chromium/codesearch#chromium/src/blimp/test/data/test_client_token).
lethalantidotef16b3ac2016-05-16 19:06:5280
sriramsr0b6a45f42016-06-30 19:42:1881### Start the Client
dtrainorac84a372015-10-05 18:01:4882Run the Blimp APK with:
83
84```bash
nyquistf87e5032016-02-23 18:45:2685./build/android/adb_run_blimp_client
dtrainorac84a372015-10-05 18:01:4886```
sriramsr0b6a45f42016-06-30 19:42:1887The script under the cover uses adb to start the application:
nyquistf87e5032016-02-23 18:45:2688
89```bash
sriramsr0b6a45f42016-06-30 19:42:1890adb shell am start -a android.intent.action.VIEW -n org.chromium.blimp/org.chromium.blimp.BlimpRendererActivity
nyquistf87e5032016-02-23 18:45:2691```
92
sriramsr0b6a45f42016-06-30 19:42:1893### Connecting to an Engine running on a workstation
nyquistf87e5032016-02-23 18:45:2694To run the engine on a workstation and make your Android client connect to it,
95you need to forward a port from the Android device to the host, and also
96instruct the client to connect using that port on its localhost address.
97
98#### Port forwarding
kmarshall6c98508d2016-01-11 21:06:2899If you are running the engine on your workstation and are connected to the
100client device via USB, you'll need remote port forwarding to allow the Blimp
nyquistf87e5032016-02-23 18:45:26101client to talk to your computer.
marcinjb446acf652016-01-15 22:18:36102
nyquistf87e5032016-02-23 18:45:26103##### Option A
104Follow the
105[remote debugging instructions](https://developer.chrome.com/devtools/docs/remote-debugging)
106to get started. You'll probably want to remap 25467 to "localhost:25467".
107*Note* This requires the separate `Chrome` application to be running on the
108device. Otherwise you will not see the green light for the port forwarding.
dtrainor6df61642016-02-19 16:10:25109
nyquistf87e5032016-02-23 18:45:26110##### Option B
111If you are having issues with using the built-in Chrome port forwarding, you can
112also start a new shell and keep the following command running:
113
114```bash
115./build/android/adb_reverse_forwarder.py --debug -v 25467 25467
116```
117
sriramsr0b6a45f42016-06-30 19:42:18118### Running the client in an Android emulator
119Running the client using an Android emulator is similar to running it on device.
120Here are a few gotchas:
121
122* Build an APK matching the emulator cpu type. The emulator cpu type is most
123 likely x86, while the default Android build cpu type is ARM. Follow the
124 Android build instructions above to change the CPU type.
125
126* Ensure that the emulator is running at least Android Marshmallow so that
127 fonts are rendered correctly. Also ensure that you have the latest Play
128 services binaries.
129
130* Some of scripts under `build/android` will fail to run as it uses `adb scp`.
131 Follow the instruction above to use `adb` directly.
132
133* To connect to an Engine running on the host machine, you should use
134 `10.0.2.2` as `engine-ip` instead of `127.0.0.1` as `127.0.0.1` will refer to
135 the emulator itself. There is no need of set up
136 [port forwarding](#Port-forwarding) when this approach is used.
137
138## Linux Client
139
140The Linux client is used for development purpose while the Android client is
141shipped. The Linux client is built as part of the `blimp` target.
142To run it with local logging enabled, execute:
143
144```bash
145./out-linux/Debug/blimp_shell \
146 --user-data-dir=/tmp/blimpclient \
147 --enable-logging=stderr \
148 --vmodule="*=1"
149```
150
151## Running the engine
152
153### In a container
154For running the engine in a container, see [container](container.md).
155
156### On a workstation
157The following flags are required to start an Engine instance:
158
nyquistf87e5032016-02-23 18:45:26159* `--blimp-client-token-path=$PATH`: Path to a file containing a nonempty
160 token string. If this is not present, the engine will fail to boot.
161* `--use-remote-compositing`: Ensures that the renderer uses the remote
162 compositor.
163* `--disable-cached-picture-raster`: Ensures that rasterized content is not
164 destroyed before serialization.
nyquistb4fd5702016-03-09 01:42:13165* `--android-fonts-path=$PATH`: Path to where the fonts are located.
166 Typically this would be `out-linux/Debug/gen/third_party/blimp_fonts`.
khushalsagara612bb872016-03-22 23:02:37167* `--disable-remote-fonts`: Disables downloading of custom web fonts in the
168 renderer.
lethalantidotefb98d142016-05-16 23:42:03169
170#### Typical invocation
171
172One can start the engine using these flags:
173
174```bash
175out-linux/Debug/blimp_engine_app \
176 --android-fonts-path=out-linux/Debug/gen/third_party/blimp_fonts \
177 --blimp-client-token-path=/tmp/blimpengine-token \
178 --enable-logging=stderr \
179 --vmodule="blimp*=1"
180```