blob: a1c6dabca55cb639f866f66de3035c6587007f96 [file] [log] [blame]
Steve McKaybbeba522016-01-13 17:17:39 -08001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.documentsui.services;
18
19import static junit.framework.Assert.assertTrue;
20
21import android.app.Notification;
22import android.app.Notification.Builder;
23import android.content.Context;
24import android.os.RemoteException;
25
26import com.android.documentsui.R;
27import com.android.documentsui.model.DocumentInfo;
28import com.android.documentsui.model.DocumentStack;
29
30public class TestJob extends Job {
31
32 private boolean mStarted;
33
34 TestJob(
35 Context service, Context appContext, Listener listener,
36 int operationType, String id, DocumentStack stack) {
37 super(service, appContext, listener, operationType, id, stack);
38 }
39
40 @Override
41 void start() throws RemoteException {
42 mStarted = true;
43 }
44
45 void assertStarted() {
46 assertTrue(mStarted);
47 }
48
Steve McKaybbeba522016-01-13 17:17:39 -080049 void fail(DocumentInfo doc) {
50 onFileFailed(doc);
51 }
52
53 @Override
54 Notification getSetupNotification() {
55 return getSetupNotification(service.getString(R.string.copy_preparing));
56 }
57
58 @Override
59 Notification getFailureNotification() {
60 // the "copy" stuff was just convenient and available :)
61 return getFailureNotification(
62 R.plurals.copy_error_notification_title, R.drawable.ic_menu_copy);
63 }
64
65 @Override
Tomasz Mikolajewskidd2b31c2016-01-22 16:22:51 +090066 Notification getWarningNotification() {
67 throw new UnsupportedOperationException();
68 }
69
70 @Override
Steve McKaybbeba522016-01-13 17:17:39 -080071 Builder createProgressBuilder() {
72 // the "copy" stuff was just convenient and available :)
73 return super.createProgressBuilder(
74 service.getString(R.string.copy_notification_title),
75 R.drawable.ic_menu_copy,
76 service.getString(android.R.string.cancel),
77 R.drawable.ic_cab_cancel);
78 }
79}