mirror of https://github.com/grpc/grpc-java.git
[Android-interop-test] Fail the instrumentation if any exception is thrown during the channel initialization.
This commit is contained in:
parent
ee56c4940d
commit
944edc4601
|
|
@ -40,6 +40,7 @@ import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.lang.Throwable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -87,24 +88,30 @@ public class TesterInstrumentation extends Instrumentation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new InteropTester(testCase, host, port, serverHostOverride, useTls, testCa,
|
try {
|
||||||
androidSocketFactoryTls,
|
new InteropTester(testCase, host, port, serverHostOverride, useTls, testCa,
|
||||||
new InteropTester.TestListener() {
|
androidSocketFactoryTls,
|
||||||
@Override
|
new InteropTester.TestListener() {
|
||||||
public void onPreTest() {
|
@Override
|
||||||
}
|
public void onPreTest() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPostTest(String result) {
|
public void onPostTest(String result) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString("grpc test result", result);
|
bundle.putString("grpc test result", result);
|
||||||
if (InteropTester.SUCCESS_MESSAGE.equals(result)) {
|
if (InteropTester.SUCCESS_MESSAGE.equals(result)) {
|
||||||
finish(0, bundle);
|
finish(0, bundle);
|
||||||
} else {
|
} else {
|
||||||
finish(1, bundle);
|
finish(1, bundle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
).execute();
|
||||||
).execute();
|
} catch (Throwable t) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putString("Exception encountered", t.toString());
|
||||||
|
finish(1, bundle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue