summaryrefslogtreecommitdiff
path: root/tests/testables
diff options
context:
space:
mode:
authorBeverly <beverlyt@google.com>2020-01-22 11:23:24 -0500
committerBeverly Tai <beverlyt@google.com>2020-01-22 18:53:47 +0000
commit433923a1d99900fb7dfaf050a05c51917f7724d3 (patch)
tree36b31e273075e068127de8a7b9aa998e6ee378be /tests/testables
parentc6eeb791ee834e3220f56bfdb27c4da56de53997 (diff)
Edit NEM tests to prevent flakiness
- Set the Assert's main looper as the TestableLooper's looper for all NEM tests - in NEM test, bind content synchronously, so the callback won't run on the 'real' main thread and will instead run on the TestableLooper's thread - Allow overriding already initialized dependencies in TestableDependency Test: atest SystemUITests Fixes: 147685528 Change-Id: Ic171bf29e33322f44aa14c40c29c0d9ffa542ade
Diffstat (limited to 'tests/testables')
-rw-r--r--tests/testables/src/android/testing/TestableLooper.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/testables/src/android/testing/TestableLooper.java b/tests/testables/src/android/testing/TestableLooper.java
index 8eac3ea13a23..fe0224a27c80 100644
--- a/tests/testables/src/android/testing/TestableLooper.java
+++ b/tests/testables/src/android/testing/TestableLooper.java
@@ -234,7 +234,9 @@ public class TestableLooper {
try {
mLooper = setAsMain ? Looper.getMainLooper() : createLooper();
mTestableLooper = new TestableLooper(mLooper, false);
- mTestableLooper.getLooper().getThread().setName(test.getClass().getName());
+ if (!setAsMain) {
+ mTestableLooper.getLooper().getThread().setName(test.getClass().getName());
+ }
} catch (Exception e) {
throw new RuntimeException(e);
}