List of usage examples for android.test.mock MockApplication MockApplication
public MockApplication()
From source file:com.microsoft.live.TestUtils.java
public static LiveAuthClient newMockLiveAuthClient() { return new LiveAuthClient(new MockApplication() { @Override//from www . j ava 2 s .com public Context getApplicationContext() { return this; } }, "someclientid"); }
From source file:com.uphyca.testing.junit3.support.v4.FragmentUnitTestCase.java
private void attachActivity(Object lastNonConfigurationInstance) throws Exception { if (mActivityAttached) { return;/* w w w. j a va 2 s . c om*/ } IBinder token = null; if (mApplication == null) { setApplication(new MockApplication()); } if (mActivity == null) { setActivity(new MockFragmentActivity()); } ComponentName cn = new ComponentName(mActivity.getClass().getPackage().getName(), mActivity.getClass().getName()); Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(cn); ActivityInfo info = new ActivityInfo(); CharSequence title = mActivity.getClass().getName(); mMockParent = new MockParent(); String id = null; ActivityTrojanHorse.callAttach(getInstrumentation(), mActivity, mFragmentContext, token, mApplication, intent, info, title, mMockParent, id, lastNonConfigurationInstance); mActivityAttached = true; }