diff options
author | Mukesh Agrawal <quiche@google.com> | 2017-04-24 19:41:45 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-04-24 19:41:46 +0000 |
commit | 07aebf0cd691a3041d0c32ba56a4ea3ad0bfd8fd (patch) | |
tree | e4e55a70e1866acb3f30dc48a39ad2e4f2afadba | |
parent | 0b31edb987c0552b75667e05f0d589937a16f1ad (diff) | |
parent | d9b2ef1b267206c2ef353aa352bdffdedefdd532 (diff) |
Merge "tests: don't crash on Log.wtf() in eng builds"
-rw-r--r-- | tests/wifitests/AndroidManifest.xml | 2 | ||||
-rwxr-xr-x | tests/wifitests/runtests.sh | 2 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/CustomTestRunner.java | 33 |
3 files changed, 35 insertions, 2 deletions
diff --git a/tests/wifitests/AndroidManifest.xml b/tests/wifitests/AndroidManifest.xml index 63b9542d9..dcb61c740 100644 --- a/tests/wifitests/AndroidManifest.xml +++ b/tests/wifitests/AndroidManifest.xml @@ -30,7 +30,7 @@ </activity> </application> - <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" + <instrumentation android:name="com.android.server.wifi.CustomTestRunner" android:targetPackage="com.android.server.wifi.test" android:label="Frameworks Wifi Tests"> </instrumentation> diff --git a/tests/wifitests/runtests.sh b/tests/wifitests/runtests.sh index 529a535e6..7a34bf7dc 100755 --- a/tests/wifitests/runtests.sh +++ b/tests/wifitests/runtests.sh @@ -42,4 +42,4 @@ adb install -r -g "$OUT/data/app/FrameworksWifiTests/FrameworksWifiTests.apk" adb shell am instrument -w "$@" \ -e notAnnotation com.android.server.wifi.DisabledForUpdateToAnyMatcher \ - 'com.android.server.wifi.test/android.support.test.runner.AndroidJUnitRunner' + 'com.android.server.wifi.test/com.android.server.wifi.CustomTestRunner' diff --git a/tests/wifitests/src/com/android/server/wifi/CustomTestRunner.java b/tests/wifitests/src/com/android/server/wifi/CustomTestRunner.java new file mode 100644 index 000000000..d51f16e36 --- /dev/null +++ b/tests/wifitests/src/com/android/server/wifi/CustomTestRunner.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * 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 com.android.server.wifi; + +import android.os.Bundle; +import android.support.test.runner.AndroidJUnitRunner; +import android.util.Log; + +import static org.mockito.Mockito.mock; + +public class CustomTestRunner extends AndroidJUnitRunner { + @Override + public void onCreate(Bundle arguments) { + // Override the default TerribleFailureHandler, as that handler might terminate + // the process (if we're on an eng build). + Log.setWtfHandler(mock(Log.TerribleFailureHandler.class)); + super.onCreate(arguments); + } +} |