use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.
the class AuthenticatorTest method testGetAccountRemovalAllowed.
/***
* Test the getAccountRemovalAllowed() method.
*/
@SmallTest
@Suppress
public final void testGetAccountRemovalAllowed() {
final TestStatus testStatus = new TestStatus();
Authenticator authenticator = new Authenticator(getContext(), new MainApplication() {
public void removeUserData() {
/*
* Test that the dummy mWakeListener.notifyOfWakeupAlarm() has
* been called, otherwise the test must fail.
*/
testStatus.setPass(true);
}
});
Bundle bundle = null;
try {
bundle = authenticator.getAccountRemovalAllowed(null, null);
} catch (NetworkErrorException e) {
fail("Unexpected NetworkErrorException");
}
/** Test if removeUserData() was called. **/
assertTrue("Expecting the removeUserData() dummy method to have " + "been called", testStatus.isPass());
assertEquals("Expected a KEY_BOOLEAN_RESULT boolean", true, bundle.getBoolean(AccountManager.KEY_BOOLEAN_RESULT));
}
use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.
the class ChatDbUtilsTest method setUp.
/***
* Set up the DatabaseHelper.
*/
public final void setUp() {
createApplication();
MainApplication mainApplication = getApplication();
if (mainApplication == null) {
throw (new RuntimeException("ChatDbUtilsTest.setUp() " + "Unable to create main application"));
}
mDatabaseHelper = mainApplication.getDatabase();
}
use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.
the class TimeOutWatcherTest method setUp.
protected void setUp() throws Exception {
super.setUp();
mApplication = (MainApplication) Instrumentation.newApplication(MainApplication.class, getInstrumentation().getTargetContext());
mApplication.onCreate();
mWatcher = new TimeOutWatcher();
}
use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.
the class PeopleServiceTest method lazyLoadPeopleService.
private synchronized boolean lazyLoadPeopleService() {
if (mPeopleService != null) {
return true;
}
try {
mApplication = (MainApplication) Instrumentation.newApplication(MainApplication.class, // Not good enough, must be Target Context??
getSystemContext());
Log.e(LOG_TAG, "Test 1 [" + testContext(getContext()) + "]");
Log.e(LOG_TAG, "Test 2 [" + testContext(getSystemContext()) + "]");
Log.e(LOG_TAG, "Test 3 [" + testContext(mApplication.getApplicationContext()) + "]");
Log.e(LOG_TAG, "Test 4 [" + testContext(mApplication) + "]");
Instrumentation i = new Instrumentation();
i.getTargetContext();
Log.e(LOG_TAG, "Test 5 [" + testContext(i.getTargetContext()) + "]");
//Tests: maybe have to get getInstrumentation().getTargetContext() ??
//Log.e(LOG_TAG, "Test 5 ["+testContext(getInstrumentation().getTargetContext())+"]");
mApplication.onCreate();
//Call before startService()
setApplication(mApplication);
} catch (ClassNotFoundException e) {
Log.e(LOG_TAG, "ClassNotFoundException " + e.toString());
} catch (IllegalAccessException e) {
Log.e(LOG_TAG, "IllegalAccessException " + e.toString());
} catch (InstantiationException e) {
Log.e(LOG_TAG, "InstantiationException " + e.toString());
}
// Explicitly start the service.
Intent serviceIntent = new Intent();
serviceIntent.setClassName("com.vodafone360.people", "com.vodafone360.people.service.RemoteService");
startService(serviceIntent);
mPeopleService = mApplication.getServiceInterface();
if (mPeopleService == null) {
return false;
}
mEventWatcherThread = new Thread(new Runnable() {
@Override
public void run() {
eventWatcherThreadMain();
}
});
mEventWatcherThread.start();
while (!mEventThreadStarted) {
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
// Add service handler.
mPeopleService.addEventCallback(mHandler);
// Restart thread.
mTestConn.startThread();
return true;
}
use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.
the class EngineManager method createSyncMeEngine.
/**
* Create instance of SyncMeEngine.
*/
private synchronized void createSyncMeEngine() {
final MainApplication app = (MainApplication) mService.getApplication();
mSyncMeEngine = new SyncMeEngine(mService, mUiEventCallback, app.getDatabase());
addEngine(mSyncMeEngine);
}
Aggregations