Minor Telephony Unit test cleanup fixes
- Simplify Looper initialization code
- Don't catch and re-throw exceptions in
testWithTelephonyFeatureAndCompatChanges (hiding call stack)
- Use @Mock annotation instead of manual assignment
Bug: 365800992
Test: com.android.phone.PhoneInterfaceManagerTest
Flag: TEST_ONLY
Change-Id: I248cc4267ca543899bbe5f8473481c646130008a
diff --git a/tests/src/com/android/TelephonyTestBase.java b/tests/src/com/android/TelephonyTestBase.java
index d72d85e..2bc7bb9 100644
--- a/tests/src/com/android/TelephonyTestBase.java
+++ b/tests/src/com/android/TelephonyTestBase.java
@@ -51,19 +51,11 @@
@Before
public void setUp() throws Exception {
- mContext = spy(new TestContext());
- // Set up the looper if it does not exist on the test thread.
if (Looper.myLooper() == null) {
Looper.prepare();
- // Wait until the looper is not null anymore
- for(int i = 0; i < 5; i++) {
- if (Looper.myLooper() != null) {
- break;
- }
- Looper.prepare();
- Thread.sleep(100);
- }
}
+
+ mContext = spy(new TestContext());
}
@After