diff options
Diffstat (limited to 'tests/src/com/android/providers/downloads/FakeSystemFacade.java')
-rw-r--r-- | tests/src/com/android/providers/downloads/FakeSystemFacade.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/src/com/android/providers/downloads/FakeSystemFacade.java b/tests/src/com/android/providers/downloads/FakeSystemFacade.java index d35b558b..297c1d3a 100644 --- a/tests/src/com/android/providers/downloads/FakeSystemFacade.java +++ b/tests/src/com/android/providers/downloads/FakeSystemFacade.java @@ -8,8 +8,10 @@ import android.test.AssertionFailedError; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Queue; public class FakeSystemFacade implements SystemFacade { long mTimeMillis = 0; @@ -19,6 +21,7 @@ public class FakeSystemFacade implements SystemFacade { List<Intent> mBroadcastsSent = new ArrayList<Intent>(); Map<Integer,Notification> mActiveNotifications = new HashMap<Integer,Notification>(); List<Notification> mCanceledNotifications = new ArrayList<Notification>(); + Queue<Thread> mStartedThreads = new LinkedList<Thread>(); void incrementTimeMillis(long delta) { mTimeMillis += delta; @@ -72,4 +75,15 @@ public class FakeSystemFacade implements SystemFacade { cancelNotification(id); } } + + @Override + public void startThread(Thread thread) { + mStartedThreads.add(thread); + } + + public void runAllThreads() { + while (!mStartedThreads.isEmpty()) { + mStartedThreads.poll().run(); + } + } } |