Build 1.0_r1(from source)

android.test.mock
Class MockContentResolver

java.lang.Object
  extended by android.content.ContentResolver
      extended by android.test.mock.MockContentResolver

public class MockContentResolver
extends ContentResolver

A mock ContentResolver class that isolates the test code from the real content system. All methods are non-functional and throw UnsupportedOperationException.

This only isolates the test code in ways that have proven useful so far. More should be added as they become a problem.


Field Summary
(package private)  Map<String,ContentProvider> mProviders
           
 
Fields inherited from class android.content.ContentResolver
CURSOR_DIR_BASE_TYPE, CURSOR_ITEM_BASE_TYPE, SCHEME_ANDROID_RESOURCE, SCHEME_CONTENT, SCHEME_FILE, SYNC_EXTRAS_ACCOUNT, SYNC_EXTRAS_DISCARD_LOCAL_DELETIONS, SYNC_EXTRAS_EXPEDITED, SYNC_EXTRAS_FORCE, SYNC_EXTRAS_OVERRIDE_TOO_MANY_DELETIONS, SYNC_EXTRAS_UPLOAD
 
Constructor Summary
MockContentResolver()
           
 
Method Summary
protected  IContentProvider acquireProvider(Context context, String name)
           
 void addProvider(String name, ContentProvider provider)
           
 void notifyChange(Uri uri, ContentObserver observer, boolean syncToNetwork)
          Notify registered observers that a row was updated.
 boolean releaseProvider(IContentProvider provider)
           
 
Methods inherited from class android.content.ContentResolver
acquireProvider, acquireProvider, bulkInsert, cancelSync, delete, getType, insert, notifyChange, openFileDescriptor, openInputStream, openOutputStream, query, registerContentObserver, startSync, unregisterContentObserver, update, validateSyncExtrasBundle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mProviders

Map<String,ContentProvider> mProviders
Constructor Detail

MockContentResolver

public MockContentResolver()
Method Detail

addProvider

public void addProvider(String name,
                        ContentProvider provider)

acquireProvider

protected IContentProvider acquireProvider(Context context,
                                           String name)
Specified by:
acquireProvider in class ContentResolver

releaseProvider

public boolean releaseProvider(IContentProvider provider)
Specified by:
releaseProvider in class ContentResolver

notifyChange

public void notifyChange(Uri uri,
                         ContentObserver observer,
                         boolean syncToNetwork)
Description copied from class: ContentResolver
Notify registered observers that a row was updated. To register, call registerContentObserver(). By default, CursorAdapter objects will get this notification.

Overrides:
notifyChange in class ContentResolver
observer - The observer that originated the change, may be null
syncToNetwork - If true, attempt to sync the change to the network.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature