Fix for failing SecurityPolicyTests.

This fixes the following exception.

java.lang.UnsupportedOperationException
        at android.test.mock.MockContext.getApplicationContext(MockContext.java:82)

Bug 2725552

Change-Id: Iaca177defe5f5e836211c58270379da056fa64e0
This commit is contained in:
Makoto Onuki 2010-06-04 15:26:11 -07:00
parent afa85bb102
commit 0fb092b389

View File

@ -62,7 +62,9 @@ public class SecurityPolicyTests extends ProviderTestCase2<EmailProvider> {
}
/**
* Private context wrapper used to add back getPackageName() for these tests
* Private context wrapper used to add back getPackageName() for these tests.
*
* This class also implements {@link Context} method(s) that is called during tests.
*/
private static class MockContext2 extends ContextWrapper {
@ -73,6 +75,11 @@ public class SecurityPolicyTests extends ProviderTestCase2<EmailProvider> {
mRealContext = realContext;
}
@Override
public Context getApplicationContext() {
return this;
}
@Override
public String getPackageName() {
return mRealContext.getPackageName();