Search in sources :

Example 1 with LargeTest

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);
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ContentHandler(org.xml.sax.ContentHandler) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 2 with LargeTest

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);
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 3 with LargeTest

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);
}
Also used : AccessibilityEvent(android.view.accessibility.AccessibilityEvent) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 4 with LargeTest

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);
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 5 with LargeTest

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);
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Aggregations

LargeTest (android.test.suitebuilder.annotation.LargeTest)1579 AudioEffect (android.media.audiofx.AudioEffect)234 AudioTrack (android.media.AudioTrack)222 View (android.view.View)147 File (java.io.File)144 MediaVideoItem (android.media.videoeditor.MediaVideoItem)115 Uri (android.net.Uri)99 ListView (android.widget.ListView)72 Cursor (android.database.Cursor)69 Bitmap (android.graphics.Bitmap)62 Instrumentation (android.app.Instrumentation)61 MediaPlayer (android.media.MediaPlayer)60 WifiConfiguration (android.net.wifi.WifiConfiguration)53 SurfaceHolder (android.view.SurfaceHolder)50 MediaImageItem (android.media.videoeditor.MediaImageItem)49 IOException (java.io.IOException)48 AudioManager (android.media.AudioManager)42 LegacyVpnInfo (com.android.internal.net.LegacyVpnInfo)42 VpnProfile (com.android.internal.net.VpnProfile)42 Request (android.app.DownloadManager.Request)41