diff options
author | dtrainor <dtrainor@chromium.org> | 2015-09-25 17:14:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-26 00:14:55 +0000 |
commit | 4ae3272eafeffdc499cc839432dc49689d42a204 (patch) | |
tree | d6ca5e6c95afa6ffd6eeaeb262c181c1b5706671 | |
parent | 730fcbedc16dbea063e664d04f64736189d6fc7b (diff) | |
download | chromium_src-4ae3272eafeffdc499cc839432dc49689d42a204.zip chromium_src-4ae3272eafeffdc499cc839432dc49689d42a204.tar.gz chromium_src-4ae3272eafeffdc499cc839432dc49689d42a204.tar.bz2 |
Add basic test suite for Blimp
- Add the BlimpTest target.
- Add a dummy test that runs.
BUG=526219
Review URL: https://codereview.chromium.org/1365823002
Cr-Commit-Position: refs/heads/master@{#350956}
-rw-r--r-- | BUILD.gn | 2 | ||||
-rw-r--r-- | blimp/BUILD.gn | 12 | ||||
-rw-r--r-- | blimp/README.md | 4 | ||||
-rw-r--r-- | blimp/client/BUILD.gn | 35 | ||||
-rw-r--r-- | blimp/client/android/AndroidManifest.xml.jinja2 | 2 | ||||
-rw-r--r-- | blimp/client/android/java/src/org/chromium/blimp/BlimpApplication.java | 3 | ||||
-rw-r--r-- | blimp/client/android/javatests/AndroidManifest.xml.jinja2 | 26 | ||||
-rw-r--r-- | blimp/client/android/javatests/src/org/chromium/blimp/DummyTest.java | 18 | ||||
-rw-r--r-- | blimp/docs/build.md | 12 | ||||
-rw-r--r-- | blimp/docs/test.md | 38 | ||||
-rw-r--r-- | testing/buildbot/chromium.linux.json | 12 | ||||
-rw-r--r-- | testing/buildbot/tryserver.chromium.linux.json | 6 |
12 files changed, 153 insertions, 17 deletions
@@ -617,7 +617,7 @@ group("gn_only") { # and figure out how cross-platform they are deps += [ ":gn_mojo_targets", - "//blimp", + "//blimp:blimp_tests", "//chrome/browser/resources:extension_resource_demo", "//chrome/installer/util:strings", "//chrome:main_dll", diff --git a/blimp/BUILD.gn b/blimp/BUILD.gn index 9f601ad..d3da27a 100644 --- a/blimp/BUILD.gn +++ b/blimp/BUILD.gn @@ -12,3 +12,15 @@ group("blimp") { deps += [ "//blimp/client:blimp_apk" ] } } + +group("blimp_tests") { + testonly = true + + deps = [ + ":blimp", + ] + + if (is_android) { + deps += [ "//blimp/client:blimp_test_apk" ] + } +} diff --git a/blimp/README.md b/blimp/README.md index 5833b9d..82e434c 100644 --- a/blimp/README.md +++ b/blimp/README.md @@ -5,3 +5,7 @@ Blimp is an experimental project for building Chromium as a thin client. ## Engineering For building blimp, read more at [building](docs/build.md). + +## Testing + +For testing blimp, read more at [testing](docs/test.md).
\ No newline at end of file diff --git a/blimp/client/BUILD.gn b/blimp/client/BUILD.gn index 6892b9f..a0f7ff9 100644 --- a/blimp/client/BUILD.gn +++ b/blimp/client/BUILD.gn @@ -51,11 +51,23 @@ shared_library("blimp_client") { } if (is_android) { + manifest_package = "org.chromium.blimp" blimp_apk_manifest = "$target_gen_dir/blimp_apk_manifest/AndroidManifest.xml" + blimp_test_apk_manifest = + "$target_gen_dir/blimp_test_apk_manifest/AndroidManifest.xml" + + jinja_variables = [ "manifest_package=$manifest_package" ] jinja_template("blimp_apk_manifest") { input = "android/AndroidManifest.xml.jinja2" output = blimp_apk_manifest + variables = jinja_variables + } + + jinja_template("blimp_test_apk_manifest") { + input = "android/javatests/AndroidManifest.xml.jinja2" + output = blimp_test_apk_manifest + variables = jinja_variables } generate_jni("jni_headers") { @@ -139,6 +151,19 @@ if (is_android) { ] } + android_library("blimp_test_java") { + testonly = true + + deps = [ + ":blimp_java", + ":blimp_java_resources", + "//base:base_java", + "//base:base_java_test_support", + ] + + java_files = [ "android/javatests/src/org/chromium/blimp/DummyTest.java" ] + } + android_apk("blimp_apk") { deps = [ ":blimp_apk_manifest", @@ -151,4 +176,14 @@ if (is_android) { android_manifest = blimp_apk_manifest native_libs = [ "libblimp_client.so" ] } + + instrumentation_test_apk("blimp_test_apk") { + apk_name = "BlimpTest" + apk_under_test = ":blimp_apk" + android_manifest = blimp_test_apk_manifest + deps = [ + ":blimp_test_apk_manifest", + ":blimp_test_java", + ] + } } diff --git a/blimp/client/android/AndroidManifest.xml.jinja2 b/blimp/client/android/AndroidManifest.xml.jinja2 index 00ea5e6..3d35331 100644 --- a/blimp/client/android/AndroidManifest.xml.jinja2 +++ b/blimp/client/android/AndroidManifest.xml.jinja2 @@ -5,7 +5,7 @@ found in the LICENSE file. --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="org.chromium.blimp"> + package="{{manifest_package}}"> <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="21" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> diff --git a/blimp/client/android/java/src/org/chromium/blimp/BlimpApplication.java b/blimp/client/android/java/src/org/chromium/blimp/BlimpApplication.java index 95b1afd..e5ca111 100644 --- a/blimp/client/android/java/src/org/chromium/blimp/BlimpApplication.java +++ b/blimp/client/android/java/src/org/chromium/blimp/BlimpApplication.java @@ -6,13 +6,14 @@ package org.chromium.blimp; import android.app.Application; +import org.chromium.base.BaseChromiumApplication; import org.chromium.base.PathUtils; import org.chromium.base.ResourceExtractor; /** * The {@link Application} for the Blimp client. */ -public class BlimpApplication extends Application { +public class BlimpApplication extends BaseChromiumApplication { private static final String[] MANDATORY_PAK_FILES = new String[] {}; private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "blimp"; diff --git a/blimp/client/android/javatests/AndroidManifest.xml.jinja2 b/blimp/client/android/javatests/AndroidManifest.xml.jinja2 new file mode 100644 index 0000000..71ae5af --- /dev/null +++ b/blimp/client/android/javatests/AndroidManifest.xml.jinja2 @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2015 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<!-- package name must be unique. --> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="org.chromium.blimp.tests"> + + <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" /> + <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /> + <uses-permission android:name="android.permission.READ_LOGS"/> + <uses-permission android:name="android.permission.WAKE_LOCK" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> + <uses-permission android:name="android.permission.INTERNET" /> + + <application + android:label="BlimpTest"> + <uses-library android:name="android.test.runner" /> + </application> + + + <instrumentation android:name="org.chromium.base.test.BaseInstrumentationTestRunner" + android:targetPackage="{{manifest_package}}" + android:label="Tests for {{manifest_package}}"/> +</manifest> diff --git a/blimp/client/android/javatests/src/org/chromium/blimp/DummyTest.java b/blimp/client/android/javatests/src/org/chromium/blimp/DummyTest.java new file mode 100644 index 0000000..41dd5b3 --- /dev/null +++ b/blimp/client/android/javatests/src/org/chromium/blimp/DummyTest.java @@ -0,0 +1,18 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.blimp; + +import android.test.InstrumentationTestCase; +import android.test.suitebuilder.annotation.SmallTest; + +/** + * Placeholder so that BlimpTest has a test to run. + */ +public class DummyTest extends InstrumentationTestCase { + /** Empty test that always passes. */ + @SmallTest + public void testDummy() { + } +}
\ No newline at end of file diff --git a/blimp/docs/build.md b/blimp/docs/build.md index becda69..1162375 100644 --- a/blimp/docs/build.md +++ b/blimp/docs/build.md @@ -6,13 +6,13 @@ be found in the GN [quick start guide](../../tools/gn/docs/quick_start.md). ## Android setup To setup GN, run the following command: -``` +```bash gn args out-android/Debug ``` This will bring up an editor, where you can type in the following: -``` +```bash target_os = "android" is_debug = true is_clang = true @@ -24,13 +24,13 @@ use_goma = true ## Linux setup For building for Linux, you can have a side-by-side out-directory: -``` +```bash gn args out-linux/Debug ``` Use the same arguments as above, but remove `target_os`. -``` +```bash is_debug = true is_clang = true is_component_build = true @@ -44,12 +44,12 @@ To build blimp, build the target ```blimp```. ## Building for Android -``` +```bash ninja -C out-android/Debug blimp ``` ## Building for Linux -``` +```bash ninja -C out-linux/Debug blimp ``` diff --git a/blimp/docs/test.md b/blimp/docs/test.md new file mode 100644 index 0000000..4d17278 --- /dev/null +++ b/blimp/docs/test.md @@ -0,0 +1,38 @@ +# Testing + +Blimp only supports building using [GN](../../tools/gn/README.md), and only +supports building for Android and Linux. See [building](build.md) for general +GN setup. + +## Testing on Android + +Run the following command to build the Android tests: + +```bash +ninja -C out-android/Debug blimp_tests +``` + +### Running the Java instrumentation tests + +Install the Blimp APK with the following: + +```bash +./build/android/adb_install_apk.py $(PRODUCT_DIR)/apks/Blimp.apk +``` + +Run the Java instrumentation tests (with an optional test filter) with the +following: + +```bash +$(PRODUCT_DIR)/bin/run_blimp_test_apk [ -f DummyTest#* ] +``` + +### Testing on Linux + +Run the following command to build the Linux tests: + +```bash +ninja -C out-linux/Debug blimp_tests +``` + +There are no tests that run on Linux yet. diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index 8ff30ea..32f09c1 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json @@ -1,7 +1,7 @@ { "Android GN": { "additional_compile_targets": [ - "blimp", + "blimp_tests", "chrome_public_apk", "chrome_public_test_apk", "content_shell_apk", @@ -72,7 +72,7 @@ }, "Android GN (dbg)": { "additional_compile_targets": [ - "blimp", + "blimp_tests", "chrome_public_apk", "chrome_public_test_apk", "content_shell_apk", @@ -240,7 +240,6 @@ }, "Linux GN": { "additional_compile_targets": [ - "blimp", "mandoline:all" ], "gtest_tests": [ @@ -604,7 +603,6 @@ "accessibility_unittests", "app_list_unittests", "aura_unittests", - "blimp", "browser_tests", "cacheinvalidation_unittests", "cast_unittests", @@ -657,6 +655,9 @@ ] }, "Linux Tests": { + "additional_compile_targets": [ + "blimp_tests" + ], "gtest_tests": [ { "swarming": { @@ -1044,6 +1045,9 @@ ] }, "Linux Tests (dbg)(1)": { + "additional_compile_targets": [ + "blimp_tests" + ], "gtest_tests": [ { "swarming": { diff --git a/testing/buildbot/tryserver.chromium.linux.json b/testing/buildbot/tryserver.chromium.linux.json index 1c90609..745444e 100644 --- a/testing/buildbot/tryserver.chromium.linux.json +++ b/testing/buildbot/tryserver.chromium.linux.json @@ -1,7 +1,7 @@ { "android_chromium_gn_compile_dbg": { "additional_compile_targets": [ - "blimp", + "blimp_tests", "chrome_public_apk", "chrome_public_test_apk", "content_shell_apk", @@ -10,7 +10,7 @@ }, "android_chromium_gn_compile_rel": { "additional_compile_targets": [ - "blimp", + "blimp_tests", "chrome_public_apk", "chrome_public_test_apk", "content_shell_apk", @@ -116,7 +116,6 @@ "accessibility_unittests", "app_list_unittests", "aura_unittests", - "blimp", "browser_tests", "cacheinvalidation_unittests", "cast_unittests", @@ -165,7 +164,6 @@ }, "linux_chromium_gn_rel": { "additional_compile_targets": [ - "blimp", "browser_tests", "mandoline:all" ], |