Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: docs/android_test_instructions.md

Issue 2627003006: Fix a typo and adjust formatting (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Android Test Instructions 1 # Android Test Instructions
2 2
3 [TOC] 3 [TOC]
4 4
5 ## Device Setup 5 ## Device Setup
6 6
7 ### Physical Device Setup 7 ### Physical Device Setup
8 8
9 #### ADB Debugging 9 #### ADB Debugging
10 10
11 In order to allow the ADB to connect to the device, you must enable USB 11 In order to allow the ADB to connect to the device, you must enable USB
12 debugging: 12 debugging:
13 13
14 * Before Android 4.1 (Jelly Bean): 14 * Before Android 4.1 (Jelly Bean):
15 * Go to "System Settings" 15 * Go to "System Settings"
16 * Go to "Developer options" 16 * Go to "Developer options"
17 * Check "USB debugging". 17 * Check "USB debugging".
18 * Un-check "Verify apps over USB". 18 * Un-check "Verify apps over USB".
19 * On Jelly Bean and above, developer options are hidden by default. To unhide them: 19 * On Jelly Bean and above, developer options are hidden by default. To unhide
20 them:
20 * Go to "About phone" 21 * Go to "About phone"
21 * Tap 10 times on "Build number" 22 * Tap 10 times on "Build number"
22 * The "Developer options" menu will now be available. 23 * The "Developer options" menu will now be available.
23 * Check "USB debugging". 24 * Check "USB debugging".
24 * Un-check "Verify apps over USB". 25 * Un-check "Verify apps over USB".
25 26
26 #### Screen 27 #### Screen
27 28
28 You MUST ensure that the screen stays on while testing: `adb shell svc power 29 You **must** ensure that the screen stays on while testing: `adb shell svc power
29 stayon usb` Or do this manually on the device: Settings -> Developer options 30 stayon usb` Or do this manually on the device: Settings -> Developer options ->
30 -> Stay Awake. 31 Stay Awake.
31 32
32 If this option is greyed out, stay awake is probably disabled by policy. In that 33 If this option is greyed out, stay awake is probably disabled by policy. In that
33 case, get another device or log in with a normal, unmanaged account (because the 34 case, get another device or log in with a normal, unmanaged account (because the
34 tests will break in exciting ways if stay awake is off). 35 tests will break in exciting ways if stay awake is off).
35 36
36 #### Enable Asserts 37 #### Enable Asserts
37 38
38 adb shell setprop debug.assert 1 39 ```
40 adb shell setprop debug.assert 1
41 ```
39 42
40 #### Disable Verify Apps 43 #### Disable Verify Apps
41 44
42 You may see a dialog like 45 You may see a dialog like [this
43 [this one](http://www.samsungmobileusa.com/simulators/ATT_GalaxyMega/mobile/scre ens/06-02_12.jpg), 46 one](http://www.samsungmobileusa.com/simulators/ATT_GalaxyMega/mobile/screens/06 -02_12.jpg),
44 which states, _Google may regularly check installed apps for potentially harmful 47 which states, _Google may regularly check installed apps for potentially harmful
45 behavior._ This can interfere with the test runner. To disable this dialog, run: 48 behavior._ This can interfere with the test runner. To disable this dialog, run:
46 `adb shell settings put global package_verifier_enable 0` 49
50 ```
51 adb shell settings put global package_verifier_enable 0
52 ```
47 53
48 ### Emulator Setup 54 ### Emulator Setup
49 55
50 #### Option 1 56 #### Option 1
51 57
52 Use an emulator (i.e. Android Virtual Device, AVD): Enabling Intel's 58 Use an emulator (i.e. Android Virtual Device, AVD): Enabling Intel's
53 Virtualizaton support provides the fastest, most reliable emulator configuration 59 Virtualizaton support provides the fastest, most reliable emulator configuration
54 available (i.e. x86 emulator with GPU acceleration and KVM support). 60 available (i.e. x86 emulator with GPU acceleration and KVM support). Remember to
55 Remember to build with `target_arch=ia32` for x86. Otherwise installing the APKs 61 build with `target_arch=ia32` for x86. Otherwise installing the APKs will fail
56 will fail with `INSTALL_FAILED_NO_MATCHING_ABIS`. 62 with `INSTALL_FAILED_NO_MATCHING_ABIS`.
57 63
58 1. Enable Intel Virtualization support in the BIOS. 64 1. Enable Intel Virtualization support in the BIOS.
59 65
60 2. Set up your environment: 66 2. Set up your environment:
61 67
62 ```shell 68 ```shell
63 . build/android/envsetup.sh 69 . build/android/envsetup.sh
64 ``` 70 ```
65 71
66 3. Install emulator deps: 72 3. Install emulator deps:
67 73
68 ```shell 74 ```shell
69 build/android/install_emulator_deps.py --api-level=23 75 build/android/install_emulator_deps.py --api-level=23
70 ``` 76 ```
71 77
72 This script will download Android SDK and place it a directory called 78 This script will download Android SDK and place it a directory called
73 android\_tools in the same parent directory as your chromium checkout. It 79 android\_tools in the same parent directory as your chromium checkout. It
74 will also download the system-images for the emulators (i.e. arm and x86). 80 will also download the system-images for the emulators (i.e. arm and x86).
75 Note that this is a different SDK download than the Android SDK in the 81 Note that this is a different SDK download than the Android SDK in the
76 chromium source checkout (i.e. `src/third_party/android_emulator_sdk`). 82 chromium source checkout (i.e. `src/third_party/android_emulator_sdk`).
77 83
78 4. Run the avd.py script. To start up _num_ emulators use -n. For non-x86 use 84 4. Run the avd.py script. To start up _num_ emulators use -n. For non-x86 use
79 --abi. 85 --abi.
80 86
81 ```shell 87 ```shell
82 build/android/avd.py --api-level=23 88 build/android/avd.py --api-level=23
83 ``` 89 ```
84 90
85 This script will attempt to use GPU emulation, so you must be running the 91 This script will attempt to use GPU emulation, so you must be running the
86 emulators in an environment with hardware rendering available. See 92 emulators in an environment with hardware rendering available. See `avd.py
87 `avd.py --help` for more details. 93 --help` for more details.
88 94
89 #### Option 2 95 #### Option 2
90 96
91 Alternatively, you can create and run your own emulator using the tools provided 97 Alternatively, you can create and run your own emulator using the tools provided
92 by the Android SDK. When doing so, be sure to enable GPU emulation in hardware 98 by the Android SDK. When doing so, be sure to enable GPU emulation in hardware
93 settings, since Chromium requires it to render. 99 settings, since Chromium requires it to render.
94 100
95 ## Building Tests 101 ## Building Tests
96 102
97 If you're adding a new test file, you'll need to explicitly add it to a gn 103 If you're adding a new test file, you'll need to explicitly add it to a gn
98 target. If you're adding a test to an existing file, you won't to make gn 104 target. If you're adding a test to an existing file, you won't need to make gn
99 changes, but you may be interested in where your test winds up. In either case, 105 changes, but you may be interested in where your test winds up. In either case,
100 here are some guidelines for where a test belongs: 106 here are some guidelines for where a test belongs:
101 107
102 ### C++ 108 ### C++
103 109
104 C++ test files typically belong in `<top-level directory>_unittests` (e.g. 110 C++ test files typically belong in `<top-level directory>_unittests` (e.g.
105 `base_unittests` for `//base`). There are a few exceptions -- browser tests are 111 `base_unittests` for `//base`). There are a few exceptions -- browser tests are
106 typically their own target (e.g. `content_browsertests` for `//content`, or 112 typically their own target (e.g. `content_browsertests` for `//content`, or
107 `browser_tests` for `//chrome`), and some unit test suites are broken at the 113 `browser_tests` for `//chrome`), and some unit test suites are broken at the
108 second directory rather than the top-level one. 114 second directory rather than the top-level one.
109 115
110 ### Java 116 ### Java
111 117
112 Java test files vary a bit more widely than their C++ counterparts: 118 Java test files vary a bit more widely than their C++ counterparts:
113 119
114 - Instrumentation test files -- i.e., tests that will run on a device -- 120 - Instrumentation test files -- i.e., tests that will run on a device --
115 typically belong in either `<top-level directory>_javatests` or 121 typically belong in either `<top-level directory>_javatests` or `<top-level
116 `<top-level directory>_test_java`. Regardless, they'll wind up getting packaged 122 directory>_test_java`. Regardless, they'll wind up getting packaged into one
117 into one of a few test APKs: 123 of a few test APKs:
118 - `android_webview_test_apk` for anything in `//android_webview` 124 - `android_webview_test_apk` for anything in `//android_webview`
119 - `content_shell_test_apk` for anything in `//content` or below 125 - `content_shell_test_apk` for anything in `//content` or below
120 - `chrome_public_test_apk` for most things in `//chrome` 126 - `chrome_public_test_apk` for most things in `//chrome`
121 - `chrome_sync_shell_test_apk` in a few exceptional cases 127 - `chrome_sync_shell_test_apk` in a few exceptional cases
122 - JUnit or Robolectric test files -- i.e., tests that will run on the host -- 128 - JUnit or Robolectric test files -- i.e., tests that will run on the host --
123 typically belong in `<top-level directory>_junit_tests` (e.g. `base_junit_tests` 129 typically belong in `<top-level directory>_junit_tests` (e.g.
124 for `//base`), though here again there are cases (particularly in 130 `base_junit_tests` for `//base`), though here again there are cases
125 `//components`) where suites are split at the second directory rather than the 131 (particularly in `//components`) where suites are split at the second
126 top-level one. 132 directory rather than the top-level one.
127 133
128 Once you know what to build, just do it like you normally would build anything 134 Once you know what to build, just do it like you normally would build anything
129 else, e.g.: `ninja -C out/Release chrome_public_test_apk` 135 else, e.g.: `ninja -C out/Release chrome_public_test_apk`
130 136
131 ## Running Tests 137 ## Running Tests
132 138
133 All functional tests should be runnable via the wrapper scripts generated at 139 All functional tests should be runnable via the wrapper scripts generated at
134 build time: 140 build time:
135 141
136 ```sh 142 ```sh
(...skipping 17 matching lines...) Expand all
154 # Resize userdata partition to be 1G 160 # Resize userdata partition to be 1G
155 resize2fs android_emulator_sdk/sdk/system-images/android-24/x86/userdata.img 1G 161 resize2fs android_emulator_sdk/sdk/system-images/android-24/x86/userdata.img 1G
156 162
157 # Set filesystem parameter to continue on errors; Android doesn't like some 163 # Set filesystem parameter to continue on errors; Android doesn't like some
158 # things e2fsprogs does. 164 # things e2fsprogs does.
159 tune2fs -e continue android_emulator_sdk/sdk/system-images/android-24/x86/userda ta.img 165 tune2fs -e continue android_emulator_sdk/sdk/system-images/android-24/x86/userda ta.img
160 ``` 166 ```
161 167
162 ## Symbolizing Crashes 168 ## Symbolizing Crashes
163 169
164 Crash stacks are logged and can be viewed using adb logcat. To symbolize the 170 Crash stacks are logged and can be viewed using `adb logcat`. To symbolize the
165 traces, define `CHROMIUM_OUTPUT_DIR=$OUTDIR` where `$OUTDIR` is the argument you 171 traces, define `CHROMIUM_OUTPUT_DIR=$OUTDIR` where `$OUTDIR` is the argument you
166 pass to `ninja -C`, and pipe the output through 172 pass to `ninja -C`, and pipe the output through
167 `third_party/android_platform/development/scripts/stack`. If 173 `third_party/android_platform/development/scripts/stack`. If
168 `$CHROMIUM_OUTPUT_DIR` is unset, the script will search `out/Debug` and 174 `$CHROMIUM_OUTPUT_DIR` is unset, the script will search `out/Debug` and
169 `out/Release`. For example: 175 `out/Release`. For example:
170 176
171 ```shell 177 ```shell
172 # If you build with 178 # If you build with
173 ninja -C out/Debug chrome_public_test_apk 179 ninja -C out/Debug chrome_public_test_apk
174 # You can run: 180 # You can run:
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 ``` 268 ```
263 269
264 AndroidWebView tests: 270 AndroidWebView tests:
265 271
266 ```shell 272 ```shell
267 ninja -C out/Release android_webview_apk 273 ninja -C out/Release android_webview_apk
268 ninja -C out/Release android_webview_test_apk 274 ninja -C out/Release android_webview_test_apk
269 out/Release/bin/run_android_webview_test_apk [-vv] 275 out/Release/bin/run_android_webview_test_apk [-vv]
270 ``` 276 ```
271 277
272 In order to run a subset of tests, use -f to filter based on test 278 In order to run a subset of tests, use -f to filter based on test class/method
273 class/method or -A/-E to filter using annotations. 279 or -A/-E to filter using annotations.
274 280
275 Filtering examples: 281 Filtering examples:
276 282
277 ```shell 283 ```shell
278 # Run a test suite 284 # Run a test suite
279 out/Debug/bin/run_content_shell_test_apk 285 out/Debug/bin/run_content_shell_test_apk
280 286
281 # Run a specific test class 287 # Run a specific test class
282 out/Debug/bin/run_content_shell_test_apk -f AddressDetectionTest.* 288 out/Debug/bin/run_content_shell_test_apk -f AddressDetectionTest.*
283 289
(...skipping 16 matching lines...) Expand all
300 306
301 See [Layout Tests](testing/layout_tests.md). 307 See [Layout Tests](testing/layout_tests.md).
302 308
303 ## Running GPU tests 309 ## Running GPU tests
304 310
305 (e.g. the "Android Debug (Nexus 7)" bot on the chromium.gpu waterfall) 311 (e.g. the "Android Debug (Nexus 7)" bot on the chromium.gpu waterfall)
306 312
307 See https://www.chromium.org/developers/testing/gpu-testing for details. Use 313 See https://www.chromium.org/developers/testing/gpu-testing for details. Use
308 `--browser=android-content-shell`. Examine the stdio from the test invocation on 314 `--browser=android-content-shell`. Examine the stdio from the test invocation on
309 the bots to see arguments to pass to `src/content/test/gpu/run_gpu_test.py`. 315 the bots to see arguments to pass to `src/content/test/gpu/run_gpu_test.py`.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698