| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.download; | 5 package org.chromium.chrome.browser.download; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.content.Intent; | 8 import android.content.Intent; |
| 9 import android.content.SharedPreferences; | 9 import android.content.SharedPreferences; |
| 10 import android.os.IBinder; | 10 import android.os.IBinder; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 /** | 92 /** |
| 93 * Tests adding and cancelling notifications. | 93 * Tests adding and cancelling notifications. |
| 94 */ | 94 */ |
| 95 @SmallTest | 95 @SmallTest |
| 96 @Feature({"Download"}) | 96 @Feature({"Download"}) |
| 97 public void testAddingAndCancelingNotifications() { | 97 public void testAddingAndCancelingNotifications() { |
| 98 setupService(); | 98 setupService(); |
| 99 startNotificationService(); | 99 startNotificationService(); |
| 100 DownloadNotificationService service = bindNotificationService(); | 100 DownloadNotificationService service = bindNotificationService(); |
| 101 service.notifyDownloadProgress(1, "test", -1, 1L, 1L); | 101 service.notifyDownloadProgress(1, "test", -1, 1L, 1L, true); |
| 102 assertEquals(1, getService().getNotificationIds().size()); | 102 assertEquals(1, getService().getNotificationIds().size()); |
| 103 assertTrue(getService().getNotificationIds().contains(1)); | 103 assertTrue(getService().getNotificationIds().contains(1)); |
| 104 | 104 |
| 105 service.notifyDownloadSuccessful(2, "test2", null); | 105 service.notifyDownloadSuccessful(2, "test2", null); |
| 106 assertEquals(2, getService().getNotificationIds().size()); | 106 assertEquals(2, getService().getNotificationIds().size()); |
| 107 assertTrue(getService().getNotificationIds().contains(2)); | 107 assertTrue(getService().getNotificationIds().contains(2)); |
| 108 | 108 |
| 109 service.notifyDownloadFailed(3, "test3"); | 109 service.notifyDownloadFailed(3, "test3"); |
| 110 assertEquals(3, getService().getNotificationIds().size()); | 110 assertEquals(3, getService().getNotificationIds().size()); |
| 111 assertTrue(getService().getNotificationIds().contains(3)); | 111 assertTrue(getService().getNotificationIds().contains(3)); |
| 112 | 112 |
| 113 service.cancelNotification(1); | 113 service.cancelNotification(1); |
| 114 assertEquals(2, getService().getNotificationIds().size()); | 114 assertEquals(2, getService().getNotificationIds().size()); |
| 115 assertFalse(!getService().getNotificationIds().contains(1)); | 115 assertFalse(!getService().getNotificationIds().contains(1)); |
| 116 } | 116 } |
| 117 } | 117 } |
| OLD | NEW |