blob: 41bc27d0e5b4e07b962392bd375164b1ee97181e [file] [log] [blame]
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +09001/*
2 * Copyright (C) 2009 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 android.test.mock;
18
19import android.content.ContentProviderOperation;
20import android.content.ContentProviderResult;
21import android.content.ContentValues;
22import android.content.EntityIterator;
23import android.content.IContentProvider;
Jeff Brown75ea64f2012-01-25 19:37:13 -080024import android.content.ICancelationSignal;
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090025import android.content.res.AssetFileDescriptor;
26import android.database.Cursor;
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090027import android.net.Uri;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080028import android.os.Bundle;
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090029import android.os.IBinder;
30import android.os.ParcelFileDescriptor;
31import android.os.RemoteException;
32
Dianne Hackborn23fdaf62010-08-06 12:16:55 -070033import java.io.FileNotFoundException;
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090034import java.util.ArrayList;
35
36/**
37 * Mock implementation of IContentProvider. All methods are non-functional and throw
38 * {@link java.lang.UnsupportedOperationException}. Tests can extend this class to
39 * implement behavior needed for tests.
40 *
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080041 * @hide - @hide because this exposes bulkQuery() and call(), which must also be hidden.
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090042 */
43public class MockIContentProvider implements IContentProvider {
44 public int bulkInsert(Uri url, ContentValues[] initialValues) {
45 throw new UnsupportedOperationException("unimplemented mock method");
46 }
47
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090048 @SuppressWarnings("unused")
49 public int delete(Uri url, String selection, String[] selectionArgs)
50 throws RemoteException {
51 throw new UnsupportedOperationException("unimplemented mock method");
52 }
53
54 public String getType(Uri url) {
55 throw new UnsupportedOperationException("unimplemented mock method");
56 }
57
58 @SuppressWarnings("unused")
59 public Uri insert(Uri url, ContentValues initialValues) throws RemoteException {
60 throw new UnsupportedOperationException("unimplemented mock method");
61 }
62
63 public ParcelFileDescriptor openFile(Uri url, String mode) {
64 throw new UnsupportedOperationException("unimplemented mock method");
65 }
66
67 public AssetFileDescriptor openAssetFile(Uri uri, String mode) {
68 throw new UnsupportedOperationException("unimplemented mock method");
69 }
70
71 public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) {
72 throw new UnsupportedOperationException("unimplemented mock method");
73 }
74
75 public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs,
Jeff Brown75ea64f2012-01-25 19:37:13 -080076 String sortOrder, ICancelationSignal cancelationSignal) {
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090077 throw new UnsupportedOperationException("unimplemented mock method");
78 }
79
80 public EntityIterator queryEntities(Uri url, String selection, String[] selectionArgs,
81 String sortOrder) {
82 throw new UnsupportedOperationException("unimplemented mock method");
83 }
84
85 public int update(Uri url, ContentValues values, String selection, String[] selectionArgs)
86 throws RemoteException {
87 throw new UnsupportedOperationException("unimplemented mock method");
88 }
89
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080090 public Bundle call(String method, String request, Bundle args)
91 throws RemoteException {
92 throw new UnsupportedOperationException("unimplemented mock method");
93 }
94
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090095 public IBinder asBinder() {
96 throw new UnsupportedOperationException("unimplemented mock method");
97 }
Dianne Hackborn23fdaf62010-08-06 12:16:55 -070098
99 public String[] getStreamTypes(Uri url, String mimeTypeFilter) throws RemoteException {
100 throw new UnsupportedOperationException("unimplemented mock method");
101 }
102
103 public AssetFileDescriptor openTypedAssetFile(Uri url, String mimeType, Bundle opts)
104 throws RemoteException, FileNotFoundException {
105 throw new UnsupportedOperationException("unimplemented mock method");
106 }
Jeff Brown75ea64f2012-01-25 19:37:13 -0800107
108 @Override
109 public ICancelationSignal createCancelationSignal() throws RemoteException {
110 throw new UnsupportedOperationException("unimplemented mock method");
111 }
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +0900112}