diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/providers/downloads/FakeSystemFacade.java | 5 | ||||
-rw-r--r-- | tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java | 13 |
2 files changed, 12 insertions, 6 deletions
diff --git a/tests/src/com/android/providers/downloads/FakeSystemFacade.java b/tests/src/com/android/providers/downloads/FakeSystemFacade.java index 6898efdb..481b5cba 100644 --- a/tests/src/com/android/providers/downloads/FakeSystemFacade.java +++ b/tests/src/com/android/providers/downloads/FakeSystemFacade.java @@ -4,6 +4,7 @@ import android.content.Intent; import android.content.pm.PackageManager.NameNotFoundException; import android.net.ConnectivityManager; import android.net.NetworkInfo; +import android.net.NetworkInfo.DetailedState; import java.util.ArrayList; import java.util.LinkedList; @@ -36,7 +37,9 @@ public class FakeSystemFacade implements SystemFacade { if (mActiveNetworkType == null) { return null; } else { - return new NetworkInfo(mActiveNetworkType, 0, null, null); + final NetworkInfo info = new NetworkInfo(mActiveNetworkType, 0, null, null); + info.setDetailedState(DetailedState.CONNECTED, null, null); + return info; } } diff --git a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java index 34a69df9..2661a1f2 100644 --- a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java +++ b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java @@ -17,6 +17,7 @@ package com.android.providers.downloads; import static com.google.testing.littlemock.LittleMock.anyInt; +import static com.google.testing.littlemock.LittleMock.anyString; import static com.google.testing.littlemock.LittleMock.atLeastOnce; import static com.google.testing.littlemock.LittleMock.isA; import static com.google.testing.littlemock.LittleMock.never; @@ -449,6 +450,8 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest { receiver.mSystemFacade = mSystemFacade; Intent intent = new Intent(Constants.ACTION_LIST); intent.setData(Uri.parse(Downloads.Impl.CONTENT_URI + "/" + download.mId)); + intent.putExtra(DownloadManager.EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS, + new long[] { download.mId }); receiver.onReceive(mContext, intent); assertEquals(1, mSystemFacade.mBroadcastsSent.size()); @@ -523,7 +526,7 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest { download.runUntilStatus(DownloadManager.STATUS_SUCCESSFUL); runService(); - verify(mNotifManager, never()).notify(anyInt(), isA(Notification.class)); + verify(mNotifManager, never()).notify(anyString(), anyInt(), isA(Notification.class)); // TODO: verify that it never cancels } @@ -536,8 +539,8 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest { runService(); // TODO: verify different notif types with tags - verify(mNotifManager, atLeastOnce()).notify(anyInt(), isA(Notification.class)); - verify(mNotifManager, times(1)).cancel(anyInt()); + verify(mNotifManager, atLeastOnce()).notify(anyString(), anyInt(), isA(Notification.class)); + verify(mNotifManager, times(1)).cancel(anyString(), anyInt()); } public void testNotificationVisibleComplete() throws Exception { @@ -549,8 +552,8 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest { runService(); // TODO: verify different notif types with tags - verify(mNotifManager, atLeastOnce()).notify(anyInt(), isA(Notification.class)); - verify(mNotifManager, times(1)).cancel(anyInt()); + verify(mNotifManager, atLeastOnce()).notify(anyString(), anyInt(), isA(Notification.class)); + verify(mNotifManager, times(1)).cancel(anyString(), anyInt()); } public void testRetryAfter() throws Exception { |