diff options
author | Ken Shirriff <kens@google.com> | 2009-07-28 16:15:38 -0700 |
---|---|---|
committer | Ken Shirriff <kens@google.com> | 2009-07-28 16:20:48 -0700 |
commit | 04cc0e121f0f9fb236150be5e9afa1b8d0105026 (patch) | |
tree | 58774e68ee417c11a73d192afd8e1cd6c57c2d50 /test-runner/android | |
parent | 27700ef16b9058a3cfa4010a18d843888ef4b07d (diff) | |
download | frameworks_base-04cc0e121f0f9fb236150be5e9afa1b8d0105026.zip frameworks_base-04cc0e121f0f9fb236150be5e9afa1b8d0105026.tar.gz frameworks_base-04cc0e121f0f9fb236150be5e9afa1b8d0105026.tar.bz2 |
Fix broken calendar tests.
The tests end up in the widget code, which calls getResources(). This needs to
be supported by the mock.
bug=1985641
Diffstat (limited to 'test-runner/android')
-rw-r--r-- | test-runner/android/test/ProviderTestCase2.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test-runner/android/test/ProviderTestCase2.java b/test-runner/android/test/ProviderTestCase2.java index ac17ebf..a923d2a 100644 --- a/test-runner/android/test/ProviderTestCase2.java +++ b/test-runner/android/test/ProviderTestCase2.java @@ -3,6 +3,7 @@ package android.test; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.Context; +import android.content.res.Resources; import android.test.mock.MockContext; import android.test.mock.MockContentResolver; import android.database.DatabaseUtils; @@ -26,6 +27,14 @@ public abstract class ProviderTestCase2<T extends ContentProvider> extends Andro private IsolatedContext mProviderContext; private MockContentResolver mResolver; + private class MockContext2 extends MockContext { + + @Override + public Resources getResources() { + return getContext().getResources(); + } + } + public ProviderTestCase2(Class<T> providerClass, String providerAuthority) { mProviderClass = providerClass; mProviderAuthority = providerAuthority; @@ -47,7 +56,7 @@ public abstract class ProviderTestCase2<T extends ContentProvider> extends Andro mResolver = new MockContentResolver(); final String filenamePrefix = "test."; RenamingDelegatingContext targetContextWrapper = new RenamingDelegatingContext( - new MockContext(), // The context that most methods are delegated to + new MockContext2(), // The context that most methods are delegated to getContext(), // The context that file methods are delegated to filenamePrefix); mProviderContext = new IsolatedContext(mResolver, targetContextWrapper); |