Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/download/MockDownloadNotificationService.java

Issue 2726423002: Fix DownloadNotificationService foreground state (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.app.Notification; 7 import android.app.Notification;
8 import android.content.Context; 8 import android.content.Context;
9 9
10 import org.chromium.base.ThreadUtils; 10 import org.chromium.base.ThreadUtils;
(...skipping 21 matching lines...) Expand all
32 @Override 32 @Override
33 public void startForeground() {} 33 public void startForeground() {}
34 34
35 @Override 35 @Override
36 public void cancelOffTheRecordDownloads() { 36 public void cancelOffTheRecordDownloads() {
37 super.cancelOffTheRecordDownloads(); 37 super.cancelOffTheRecordDownloads();
38 mPaused = true; 38 mPaused = true;
39 } 39 }
40 40
41 @Override 41 @Override
42 boolean hasDownloadNotifications(Integer notificationIdToIgnore) {
43 // Cancelling notifications here is synchronous, so we don't really have to worry about
44 // {@code notificationIdToIgnore}, but address it properly anyway.
45 if (mNotificationIds.size() == 1 && notificationIdToIgnore != null) {
46 return !mNotificationIds.contains(notificationIdToIgnore);
47 }
48
49 return !mNotificationIds.isEmpty();
50 }
51
52 @Override
53 void cancelSummaryNotification() {}
54
55 @Override
42 void updateNotification(int id, Notification notification) { 56 void updateNotification(int id, Notification notification) {
43 if (!mNotificationIds.contains(id)) { 57 if (!mNotificationIds.contains(id)) {
44 mNotificationIds.add(id); 58 mNotificationIds.add(id);
45 mLastNotificationId = id; 59 mLastNotificationId = id;
46 } 60 }
47 } 61 }
48 62
49 public boolean isPaused() { 63 public boolean isPaused() {
50 return mPaused; 64 return mPaused;
51 } 65 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 public void notifyDownloadCanceled(final String downloadGuid) { 128 public void notifyDownloadCanceled(final String downloadGuid) {
115 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 129 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
116 @Override 130 @Override
117 public void run() { 131 public void run() {
118 MockDownloadNotificationService.super.notifyDownloadCanceled(dow nloadGuid); 132 MockDownloadNotificationService.super.notifyDownloadCanceled(dow nloadGuid);
119 } 133 }
120 }); 134 });
121 } 135 }
122 } 136 }
123 137
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698