blob: bc0f05a5ecf8f2c94c12b95d18128151f97b9bd8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.download;
import android.app.Notification;
import android.content.Context;
import java.util.ArrayList;
import java.util.List;
/**
* Mock class to DownloadNotificationService for testing purpose.
*/
public class MockDownloadNotificationService extends DownloadNotificationService {
private final List<Integer> mNotificationIds = new ArrayList<Integer>();
private boolean mPaused = false;
private Context mContext;
void setContext(Context context) {
mContext = context;
}
@Override
public void pauseAllDownloads() {
super.pauseAllDownloads();
mPaused = true;
}
@Override
void updateNotification(int id, Notification notification) {
mNotificationIds.add(id);
}
public boolean isPaused() {
return mPaused;
}
public List<Integer> getNotificationIds() {
return mNotificationIds;
}
@Override
public void cancelNotification(int downloadId) {
mNotificationIds.remove(Integer.valueOf(downloadId));
}
@Override
public Context getApplicationContext() {
return mContext == null ? super.getApplicationContext() : mContext;
}
}
|