use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class SafeSaxTest method testPerformance.
@LargeTest
public void testPerformance() throws Exception {
InputStream in = mContext.getResources().openRawResource(R.raw.youtube);
byte[] xmlBytes;
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = in.read(buffer)) != -1) {
out.write(buffer, 0, length);
}
xmlBytes = out.toByteArray();
} finally {
in.close();
}
Log.i("***", "File size: " + (xmlBytes.length / 1024) + "k");
VideoAdapter videoAdapter = new VideoAdapter();
ContentHandler handler = newContentHandler(videoAdapter);
for (int i = 0; i < 2; i++) {
pureSaxTest(new ByteArrayInputStream(xmlBytes));
saxyModelTest(new ByteArrayInputStream(xmlBytes));
saxyModelTest(new ByteArrayInputStream(xmlBytes), handler);
}
}
use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityManagerServiceTest method testSendAccessibilityEvent_TwoServices_MatchingPackageAndEventType_OneDefault.
@LargeTest
public void testSendAccessibilityEvent_TwoServices_MatchingPackageAndEventType_OneDefault() throws Exception {
// set the accessibility setting value
ensureAccessibilityEnabled(mContext, true);
// enable the mock accessibility services
ensureOnlyMockServicesEnabled(mContext, true, true);
// configure the first mock service
MockAccessibilityService firstService = MyFirstMockAccessibilityService.sInstance;
AccessibilityServiceInfo firstInfo = MyFirstMockAccessibilityService.createDefaultInfo();
firstInfo.flags = AccessibilityServiceInfo.DEFAULT;
firstService.setServiceInfo(firstInfo);
// configure the second mock service
MockAccessibilityService secondService = MySecondMockAccessibilityService.sInstance;
secondService.setServiceInfo(MySecondMockAccessibilityService.createDefaultInfo());
// wait for the binder calls to #setService to complete
Thread.sleep(TIMEOUT_BINDER_CALL);
// create and populate an event to be sent
AccessibilityEvent sentEvent = AccessibilityEvent.obtain();
fullyPopulateDefaultAccessibilityEvent(sentEvent);
// set expectations for the first mock service
firstService.replay();
// set expectations for the second mock service
secondService.expectEvent(sentEvent);
secondService.replay();
// send the event
mManagerService.sendAccessibilityEvent(sentEvent, UserHandle.USER_OWNER);
// verify if all expected methods have been called
assertMockServiceVerifiedWithinTimeout(firstService);
assertMockServiceVerifiedWithinTimeout(secondService);
}
use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityManagerServiceTest method testSendAccessibilityEvent_OneService_MatchingPackageAndEventType.
@LargeTest
public void testSendAccessibilityEvent_OneService_MatchingPackageAndEventType() throws Exception {
// set the accessibility setting value
ensureAccessibilityEnabled(mContext, true);
// enable the mock accessibility service
ensureOnlyMockServicesEnabled(mContext, true, false);
// configure the mock service
MockAccessibilityService service = MyFirstMockAccessibilityService.sInstance;
service.setServiceInfo(MockAccessibilityService.createDefaultInfo());
// wait for the binder call to #setService to complete
Thread.sleep(TIMEOUT_BINDER_CALL);
// create and populate an event to be sent
AccessibilityEvent sentEvent = AccessibilityEvent.obtain();
fullyPopulateDefaultAccessibilityEvent(sentEvent);
// set expectations
service.expectEvent(sentEvent);
service.replay();
// send the event
mManagerService.sendAccessibilityEvent(sentEvent, UserHandle.USER_OWNER);
// verify if all expected methods have been called
assertMockServiceVerifiedWithinTimeout(service);
}
use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityManagerServiceTest method testSendAccessibilityEvent_OneService_NotifivationAfterTimeout.
@LargeTest
public void testSendAccessibilityEvent_OneService_NotifivationAfterTimeout() throws Exception {
// set the accessibility setting value
ensureAccessibilityEnabled(mContext, true);
// enable the mock accessibility service
ensureOnlyMockServicesEnabled(mContext, true, false);
// configure the mock service
MockAccessibilityService service = MyFirstMockAccessibilityService.sInstance;
AccessibilityServiceInfo info = MockAccessibilityService.createDefaultInfo();
info.notificationTimeout = TIMEOUT_TEST_NOTIFICATION_TIMEOUT;
service.setServiceInfo(info);
// wait for the binder call to #setService to complete
Thread.sleep(TIMEOUT_BINDER_CALL);
// create and populate the first event to be sent
AccessibilityEvent firstEvent = AccessibilityEvent.obtain();
fullyPopulateDefaultAccessibilityEvent(firstEvent);
// create and populate the second event to be sent
AccessibilityEvent secondEvent = AccessibilityEvent.obtain();
fullyPopulateDefaultAccessibilityEvent(secondEvent);
// set expectations
service.expectEvent(secondEvent);
service.replay();
// send the events
mManagerService.sendAccessibilityEvent(firstEvent, UserHandle.USER_OWNER);
mManagerService.sendAccessibilityEvent(secondEvent, UserHandle.USER_OWNER);
// wait for #sendAccessibilityEvent to reach the backing service
Thread.sleep(TIMEOUT_BINDER_CALL);
try {
service.verify();
fail("No events must be dispatched before the expiration of the notification timeout.");
} catch (IllegalStateException ise) {
/* expected */
}
// wait for the configured notification timeout to expire
Thread.sleep(TIMEOUT_TEST_NOTIFICATION_TIMEOUT);
// verify if all expected methods have been called
assertMockServiceVerifiedWithinTimeout(service);
}
use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityManagerServiceTest method testSendAccessibilityEvent_TwoServices_MatchingPackageAndEventType_TwoDefault.
@LargeTest
public void testSendAccessibilityEvent_TwoServices_MatchingPackageAndEventType_TwoDefault() throws Exception {
// set the accessibility setting value
ensureAccessibilityEnabled(mContext, true);
// enable the mock accessibility services
ensureOnlyMockServicesEnabled(mContext, true, true);
// configure the first mock service
MockAccessibilityService firstService = MyFirstMockAccessibilityService.sInstance;
AccessibilityServiceInfo firstInfo = MyFirstMockAccessibilityService.createDefaultInfo();
firstInfo.flags = AccessibilityServiceInfo.DEFAULT;
firstService.setServiceInfo(firstInfo);
// configure the second mock service
MockAccessibilityService secondService = MySecondMockAccessibilityService.sInstance;
AccessibilityServiceInfo secondInfo = MyFirstMockAccessibilityService.createDefaultInfo();
secondInfo.flags = AccessibilityServiceInfo.DEFAULT;
secondService.setServiceInfo(firstInfo);
// wait for the binder calls to #setService to complete
Thread.sleep(TIMEOUT_BINDER_CALL);
// create and populate an event to be sent
AccessibilityEvent sentEvent = AccessibilityEvent.obtain();
fullyPopulateDefaultAccessibilityEvent(sentEvent);
// set expectations for the first mock service
firstService.expectEvent(sentEvent);
firstService.replay();
// set expectations for the second mock service
secondService.replay();
// send the event
mManagerService.sendAccessibilityEvent(sentEvent, UserHandle.USER_OWNER);
// verify if all expected methods have been called
assertMockServiceVerifiedWithinTimeout(firstService);
assertMockServiceVerifiedWithinTimeout(secondService);
}
Aggregations