aboutsummaryrefslogtreecommitdiff
path: root/android-interop-testing
diff options
context:
space:
mode:
authorEric Gribkoff <ericgribkoff@google.com>2017-06-12 12:10:41 -0700
committerGitHub <noreply@github.com>2017-06-12 12:10:41 -0700
commit9a5623da0efc8adc4396325538c11ae0cd8d0363 (patch)
treeb283d27c92fbeab3d91b1a60961999bdf297cf96 /android-interop-testing
parent49b9216e8368baef92f56c4fc2f29a6e457933a6 (diff)
downloadgrpc-grpc-java-9a5623da0efc8adc4396325538c11ae0cd8d0363.tar.gz
android-interop-testing: instrumented interop tests
Diffstat (limited to 'android-interop-testing')
-rw-r--r--android-interop-testing/app/build.gradle10
-rw-r--r--android-interop-testing/app/proguard-rules.pro1
-rw-r--r--android-interop-testing/app/src/androidTest/java/io/grpc/android/integrationtest/InteropTesterTest.java52
3 files changed, 61 insertions, 2 deletions
diff --git a/android-interop-testing/app/build.gradle b/android-interop-testing/app/build.gradle
index 9c193bddf..81239c588 100644
--- a/android-interop-testing/app/build.gradle
+++ b/android-interop-testing/app/build.gradle
@@ -11,6 +11,7 @@ android {
targetSdkVersion 22
versionCode 1
versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
@@ -55,14 +56,19 @@ protobuf {
}
dependencies {
- compile 'com.android.support:appcompat-v7:22.1.1'
+ compile 'com.android.support:appcompat-v7:22.2.1'
+ compile 'com.android.support:support-annotations:23.1.1'
compile 'com.google.android.gms:play-services-base:7.3.0'
- // You need to build grpc-java to obtain these libraries below.
+ // You need to build grpc-java to obtain the grpc libraries below.
compile 'io.grpc:grpc-protobuf-nano:1.5.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-okhttp:1.5.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-stub:1.5.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'io.grpc:grpc-testing:1.5.0-SNAPSHOT' // CURRENT_GRPC_VERSION
compile 'javax.annotation:javax.annotation-api:1.2'
+ compile 'junit:junit:4.12'
+
+ androidTestCompile 'com.android.support.test:rules:0.5'
+ androidTestCompile 'com.android.support.test:runner:0.5'
}
gradle.projectsEvaluated {
diff --git a/android-interop-testing/app/proguard-rules.pro b/android-interop-testing/app/proguard-rules.pro
index 635a13c37..46fb601f9 100644
--- a/android-interop-testing/app/proguard-rules.pro
+++ b/android-interop-testing/app/proguard-rules.pro
@@ -13,6 +13,7 @@
-dontwarn com.google.common.**
-dontwarn javax.naming.**
-dontwarn okio.**
+-dontwarn org.junit.**
-dontwarn org.mockito.**
-dontwarn sun.reflect.**
# Ignores: can't find referenced class javax.lang.model.element.Modifier
diff --git a/android-interop-testing/app/src/androidTest/java/io/grpc/android/integrationtest/InteropTesterTest.java b/android-interop-testing/app/src/androidTest/java/io/grpc/android/integrationtest/InteropTesterTest.java
new file mode 100644
index 000000000..15e2c26e2
--- /dev/null
+++ b/android-interop-testing/app/src/androidTest/java/io/grpc/android/integrationtest/InteropTesterTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2017, gRPC Authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.grpc.android.integrationtest;
+
+import static junit.framework.Assert.assertEquals;
+
+import android.support.test.runner.AndroidJUnit4;
+import com.google.common.util.concurrent.SettableFuture;
+import java.util.concurrent.TimeUnit;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class InteropTesterTest {
+ private final int TIMEOUT_SECONDS = 120;
+
+ @Test
+ public void interopTests() throws Exception {
+ final SettableFuture<String> resultFuture = SettableFuture.create();
+ new InteropTester(
+ "all",
+ TesterOkHttpChannelBuilder.build(
+ "grpc-test.sandbox.googleapis.com", 443, null, true, null, null),
+ new InteropTester.TestListener() {
+ @Override
+ public void onPreTest() {}
+
+ @Override
+ public void onPostTest(String result) {
+ resultFuture.set(result);
+ }
+ },
+ false)
+ .execute();
+ String result = resultFuture.get(TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ assertEquals(result, InteropTester.SUCCESS_MESSAGE);
+ }
+}