blob: b7733a4d55ebd3d0a1aaeec0d714be7e8049c11b [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;
24import android.content.res.AssetFileDescriptor;
25import android.database.Cursor;
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090026import android.net.Uri;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080027import android.os.Bundle;
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090028import android.os.IBinder;
29import android.os.ParcelFileDescriptor;
30import android.os.RemoteException;
31
Dianne Hackborn23fdaf62010-08-06 12:16:55 -070032import java.io.FileNotFoundException;
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090033import java.util.ArrayList;
34
35/**
36 * Mock implementation of IContentProvider. All methods are non-functional and throw
37 * {@link java.lang.UnsupportedOperationException}. Tests can extend this class to
38 * implement behavior needed for tests.
39 *
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080040 * @hide - @hide because this exposes bulkQuery() and call(), which must also be hidden.
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090041 */
42public class MockIContentProvider implements IContentProvider {
43 public int bulkInsert(Uri url, ContentValues[] initialValues) {
44 throw new UnsupportedOperationException("unimplemented mock method");
45 }
46
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090047 @SuppressWarnings("unused")
48 public int delete(Uri url, String selection, String[] selectionArgs)
49 throws RemoteException {
50 throw new UnsupportedOperationException("unimplemented mock method");
51 }
52
53 public String getType(Uri url) {
54 throw new UnsupportedOperationException("unimplemented mock method");
55 }
56
57 @SuppressWarnings("unused")
58 public Uri insert(Uri url, ContentValues initialValues) throws RemoteException {
59 throw new UnsupportedOperationException("unimplemented mock method");
60 }
61
62 public ParcelFileDescriptor openFile(Uri url, String mode) {
63 throw new UnsupportedOperationException("unimplemented mock method");
64 }
65
66 public AssetFileDescriptor openAssetFile(Uri uri, String mode) {
67 throw new UnsupportedOperationException("unimplemented mock method");
68 }
69
70 public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) {
71 throw new UnsupportedOperationException("unimplemented mock method");
72 }
73
74 public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs,
75 String sortOrder) {
76 throw new UnsupportedOperationException("unimplemented mock method");
77 }
78
79 public EntityIterator queryEntities(Uri url, String selection, String[] selectionArgs,
80 String sortOrder) {
81 throw new UnsupportedOperationException("unimplemented mock method");
82 }
83
84 public int update(Uri url, ContentValues values, String selection, String[] selectionArgs)
85 throws RemoteException {
86 throw new UnsupportedOperationException("unimplemented mock method");
87 }
88
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080089 public Bundle call(String method, String request, Bundle args)
90 throws RemoteException {
91 throw new UnsupportedOperationException("unimplemented mock method");
92 }
93
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090094 public IBinder asBinder() {
95 throw new UnsupportedOperationException("unimplemented mock method");
96 }
Dianne Hackborn23fdaf62010-08-06 12:16:55 -070097
98 public String[] getStreamTypes(Uri url, String mimeTypeFilter) throws RemoteException {
99 throw new UnsupportedOperationException("unimplemented mock method");
100 }
101
102 public AssetFileDescriptor openTypedAssetFile(Uri url, String mimeType, Bundle opts)
103 throws RemoteException, FileNotFoundException {
104 throw new UnsupportedOperationException("unimplemented mock method");
105 }
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +0900106}