use of com.vodafone360.people.service.transport.IWakeupListener in project 360-Engine-for-Android by 360.
the class RemoteServiceTest method testStartAlarmHbThread.
/**
* Test starting the service with the ALARM_HB_THREAD Intent.
*
* @throws Exception Issue setting up the service.
*/
@MediumTest
public final void testStartAlarmHbThread() throws Exception {
/**
* Setup test preconditions (i.e. WorkerThread not running). *
*/
final TestStatus testStatus = new TestStatus();
setupService();
RemoteService remoteService = getService();
remoteService.registerCpuWakeupListener(new IWakeupListener() {
@Override
public void notifyOfWakeupAlarm() {
/*
* Test that the dummy mWakeListener.notifyOfWakeupAlarm() has
* been called, otherwise the test must fail.
*/
testStatus.setPass(true);
}
});
/**
* Perform test (i.e. trigger ALARM_HB_THREAD). *
*/
Intent alarmWorkerThreadIntent = new Intent(getContext(), RemoteService.class);
alarmWorkerThreadIntent.putExtra(RemoteService.ALARM_KEY, IWakeupListener.ALARM_HB_THREAD);
startService(alarmWorkerThreadIntent);
/**
* Test if notifyOfWakeupAlarm() was called. *
*/
assertTrue("Expecting the notifyOfWakeupAlarm() dummy method to have " + "been called", testStatus.isPass());
}
Aggregations