Skip to content

Commit f88779e

Browse files
author
Xudong Ma
committed
Add the Android interop test App.
So far, it is built separately from the other gRpc components.
1 parent a479c91 commit f88779e

File tree

22 files changed

+2392
-0
lines changed

22 files changed

+2392
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
build
33
gradle.properties
44
.gradle
5+
local.properties
56

67
# IntelliJ IDEA
78
.idea

android-interop-testing/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
gRPC Android test App
2+
=======================
3+
4+
Implements gRPC integration tests in an Android App.
5+
6+
TODO(madongfly) integrate this App into the gRPC-Java build system.
7+
8+
In order to build this app, you need a local.properties file under this directory which specifies
9+
the location of your android sdk:
10+
```
11+
sdk.dir=/somepath/somepath/sdk
12+
```
13+
14+
Connect your Android device or start the emulator:
15+
```
16+
$ ./start-emulator.sh <AVD name> & ./wait-for-emulator.sh
17+
```
18+
19+
Manually test
20+
-------------
21+
22+
Install the App by:
23+
```
24+
$ ../gradlew installDebug
25+
```
26+
Then manually test it with the UI.
27+
28+
29+
Commandline test
30+
----------------
31+
32+
Run the test with arguments:
33+
```
34+
$ adb shell am instrument -w -e server_host <hostname or ip address> -e server_port 8030 -e server_host_override foo.test.google.fr -e use_tls true -e use_test_ca true -e test_case all io.grpc.android.integrationtest/.TesterInstrumentation
35+
```
36+
37+
If the test passed successfully, it will output:
38+
```
39+
INSTRUMENTATION_RESULT: grpc test result=Succeed!!!
40+
INSTRUMENTATION_CODE: 0
41+
```
42+
otherwise, output something like:
43+
```
44+
INSTRUMENTATION_RESULT: grpc test result=Failed... : <exception stacktrace if applicable>
45+
INSTRUMENTATION_CODE: 1
46+
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 22
5+
buildToolsVersion '22.0.1'
6+
7+
defaultConfig {
8+
applicationId "io.grpc.android.integrationtest"
9+
minSdkVersion 18
10+
targetSdkVersion 22
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
compile 'com.android.support:appcompat-v7:22.1.1'
24+
compile 'com.google.android.gms:play-services-base:7.3.0'
25+
compile 'com.google.code.findbugs:jsr305:3.0.0'
26+
compile 'com.google.guava:guava:18.0'
27+
compile 'com.squareup.okhttp:okhttp:2.2.0'
28+
testCompile 'junit:junit:4.12'
29+
// You need to build grpc-java to obtain these libraries below.
30+
compile 'io.grpc:grpc-core:0.8.0-SNAPSHOT'
31+
compile 'io.grpc:grpc-protobuf-nano:0.8.0-SNAPSHOT'
32+
compile 'io.grpc:grpc-okhttp:0.8.0-SNAPSHOT'
33+
compile 'io.grpc:grpc-stub:0.8.0-SNAPSHOT'
34+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/thagikura/android-sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="io.grpc.android.integrationtest" >
4+
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
7+
<application
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:theme="@style/Base.V7.Theme.AppCompat.Light" >
12+
<activity
13+
android:name=".TesterActivity"
14+
android:label="@string/app_name" >
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN" />
17+
18+
<category android:name="android.intent.category.LAUNCHER" />
19+
</intent-filter>
20+
</activity>
21+
22+
<meta-data
23+
android:name="com.google.android.gms.version"
24+
android:value="@integer/google_play_services_version" />
25+
</application>
26+
27+
<instrumentation android:functionalTest="true"
28+
android:label="@string/app_name"
29+
android:name=".TesterInstrumentation"
30+
android:targetPackage="io.grpc.android.integrationtest" />
31+
32+
</manifest>

android-interop-testing/app/src/main/java/generated/io/grpc/android/integrationtest/EmptyProtos.java

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)