Search in sources :

Example 6 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class AccessibilityManagerTest method testIsEnabled.

@LargeTest
public void testIsEnabled() throws Exception {
    // configure the mock service behavior
    IAccessibilityManager mockServiceInterface = mMockServiceInterface;
    expect(mockServiceInterface.addClient(anyIAccessibilityManagerClient(), UserHandle.USER_OWNER)).andReturn(AccessibilityManager.STATE_FLAG_ACCESSIBILITY_ENABLED);
    replay(mockServiceInterface);
    // invoke the method under test
    AccessibilityManager manager = new AccessibilityManager(mContext, mockServiceInterface, UserHandle.USER_OWNER);
    boolean isEnabledServiceEnabled = manager.isEnabled();
    // check expected result
    assertTrue("Must be enabled since the mock service is enabled", isEnabledServiceEnabled);
    // disable accessibility
    manager.getClient().setState(0);
    // wait for the asynchronous IBinder call to complete
    Thread.sleep(TIMEOUT_BINDER_CALL);
    // invoke the method under test
    boolean isEnabledServcieDisabled = manager.isEnabled();
    // check expected result
    assertFalse("Must be disabled since the mock service is disabled", isEnabledServcieDisabled);
    // verify the mock service was properly called
    verify(mockServiceInterface);
}
Also used : IAccessibilityManager(android.view.accessibility.IAccessibilityManager) AccessibilityManager(android.view.accessibility.AccessibilityManager) IAccessibilityManager(android.view.accessibility.IAccessibilityManager) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 7 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class MountServiceTests method testMountAndUnmountObbNormal.

@LargeTest
public void testMountAndUnmountObbNormal() {
    StorageManager sm = getStorageManager();
    final File outFile = getFilePath("test1.obb");
    mountObb(sm, R.raw.test1, outFile, OnObbStateChangeListener.MOUNTED);
    mountObb(sm, R.raw.test1, outFile, OnObbStateChangeListener.ERROR_ALREADY_MOUNTED);
    final String mountPath = checkMountedPath(sm, outFile);
    final File mountDir = new File(mountPath);
    assertTrue("OBB mounted path should be a directory", mountDir.isDirectory());
    unmountObb(sm, outFile, OnObbStateChangeListener.UNMOUNTED);
}
Also used : StorageManager(android.os.storage.StorageManager) File(java.io.File) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 8 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class TestContext method testAuthorityPersistence.

@LargeTest
public void testAuthorityPersistence() throws Exception {
    final Account account1 = new Account("a@example.com", "example.type");
    final Account account2 = new Account("b@example.com", "example.type.2");
    final String authority1 = "testprovider1";
    final String authority2 = "testprovider2";
    final Bundle extras1 = new Bundle();
    extras1.putString("a", "1");
    final Bundle extras2 = new Bundle();
    extras2.putString("a", "2");
    extras2.putLong("b", 2);
    extras2.putInt("c", 1);
    extras2.putBoolean("d", true);
    extras2.putDouble("e", 1.2);
    extras2.putFloat("f", 4.5f);
    extras2.putParcelable("g", account1);
    final int period1 = 200;
    final int period2 = 1000;
    PeriodicSync sync1 = new PeriodicSync(account1, authority1, extras1, period1);
    PeriodicSync sync2 = new PeriodicSync(account1, authority1, extras2, period1);
    PeriodicSync sync3 = new PeriodicSync(account1, authority2, extras1, period1);
    PeriodicSync sync4 = new PeriodicSync(account1, authority2, extras2, period2);
    PeriodicSync sync5 = new PeriodicSync(account2, authority1, extras1, period1);
    MockContentResolver mockResolver = new MockContentResolver();
    SyncStorageEngine engine = SyncStorageEngine.newTestInstance(new TestContext(mockResolver, getContext()));
    removePeriodicSyncs(engine, account1, 0, authority1);
    removePeriodicSyncs(engine, account2, 0, authority1);
    removePeriodicSyncs(engine, account1, 0, authority2);
    removePeriodicSyncs(engine, account2, 0, authority2);
    engine.setMasterSyncAutomatically(false, 0);
    engine.setIsSyncable(account1, 0, authority1, 1);
    engine.setSyncAutomatically(account1, 0, authority1, true);
    engine.setIsSyncable(account2, 0, authority1, 1);
    engine.setSyncAutomatically(account2, 0, authority1, true);
    engine.setIsSyncable(account1, 0, authority2, 1);
    engine.setSyncAutomatically(account1, 0, authority2, false);
    engine.setIsSyncable(account2, 0, authority2, 0);
    engine.setSyncAutomatically(account2, 0, authority2, true);
    engine.addPeriodicSync(sync1.account, 0, sync1.authority, sync1.extras, sync1.period);
    engine.addPeriodicSync(sync2.account, 0, sync2.authority, sync2.extras, sync2.period);
    engine.addPeriodicSync(sync3.account, 0, sync3.authority, sync3.extras, sync3.period);
    engine.addPeriodicSync(sync4.account, 0, sync4.authority, sync4.extras, sync4.period);
    engine.addPeriodicSync(sync5.account, 0, sync5.authority, sync5.extras, sync5.period);
    engine.writeAllState();
    engine.clearAndReadState();
    List<PeriodicSync> syncs = engine.getPeriodicSyncs(account1, 0, authority1);
    assertEquals(2, syncs.size());
    assertEquals(sync1, syncs.get(0));
    assertEquals(sync2, syncs.get(1));
    syncs = engine.getPeriodicSyncs(account1, 0, authority2);
    assertEquals(2, syncs.size());
    assertEquals(sync3, syncs.get(0));
    assertEquals(sync4, syncs.get(1));
    syncs = engine.getPeriodicSyncs(account2, 0, authority1);
    assertEquals(1, syncs.size());
    assertEquals(sync5, syncs.get(0));
    assertEquals(true, engine.getSyncAutomatically(account1, 0, authority1));
    assertEquals(true, engine.getSyncAutomatically(account2, 0, authority1));
    assertEquals(false, engine.getSyncAutomatically(account1, 0, authority2));
    assertEquals(true, engine.getSyncAutomatically(account2, 0, authority2));
    assertEquals(1, engine.getIsSyncable(account1, 0, authority1));
    assertEquals(1, engine.getIsSyncable(account2, 0, authority1));
    assertEquals(1, engine.getIsSyncable(account1, 0, authority2));
    assertEquals(0, engine.getIsSyncable(account2, 0, authority2));
}
Also used : Account(android.accounts.Account) Bundle(android.os.Bundle) PeriodicSync(android.content.PeriodicSync) MockContentResolver(android.test.mock.MockContentResolver) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 9 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class OneEditTextActivityNotSelectedTests method testSoftKeyboardNoAutoPop.

@LargeTest
public void testSoftKeyboardNoAutoPop() {
    // Give the IME 2 seconds to appear.
    pause(2000);
    assertFalse(mImm.isAcceptingText());
    View rootView = ((OneEditTextActivityNotSelected) mTargetActivity).getRootView();
    View servedView = ((OneEditTextActivityNotSelected) mTargetActivity).getDefaultFocusedView();
    assertNotNull(rootView);
    assertNotNull(servedView);
    destructiveCheckImeInitialState(rootView, servedView);
    verifyEditTextAdjustment(servedView, rootView.getMeasuredHeight());
}
Also used : View(android.view.View) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 10 with LargeTest

use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.

the class OneEditTextActivitySelectedTests method testSoftKeyboardAutoPop.

@LargeTest
public void testSoftKeyboardAutoPop() {
    // Give the IME 2 seconds to appear.
    pause(2000);
    assertTrue(mImm.isAcceptingText());
    View rootView = ((OneEditTextActivitySelected) mTargetActivity).getRootView();
    View servedView = ((OneEditTextActivitySelected) mTargetActivity).getDefaultFocusedView();
    assertNotNull(rootView);
    assertNotNull(servedView);
    destructiveCheckImeInitialState(rootView, servedView);
    verifyEditTextAdjustment(servedView, rootView.getMeasuredHeight());
}
Also used : View(android.view.View) 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