Search in sources :

Example 91 with MediumTest

use of android.test.suitebuilder.annotation.MediumTest in project standup-timer by jwood.

the class MeetingTest method test_delete_all_by_team.

@MediumTest
public void test_delete_all_by_team() {
    Team team = new Team("Test Team");
    new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    new Meeting(team, new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    assertFalse(Meeting.findAllByTeam(team, mContext).isEmpty());
    Meeting.deleteAllByTeam(team, mContext);
    assertTrue(Meeting.findAllByTeam(team, mContext).isEmpty());
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 92 with MediumTest

use of android.test.suitebuilder.annotation.MediumTest in project standup-timer by jwood.

the class MeetingTest method test_save_a_meeting.

@MediumTest
public void test_save_a_meeting() {
    Meeting meeting = new Meeting(new Team("Test Team"), new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120);
    meeting = meeting.save(mContext);
    assertNotNull(meeting.getId());
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 93 with MediumTest

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

the class AccessibilityManagerTest method testGetAccessibilityServiceList.

@MediumTest
public void testGetAccessibilityServiceList() throws Exception {
    // create a list of installed accessibility services the mock service returns
    List<AccessibilityServiceInfo> expectedServices = new ArrayList<AccessibilityServiceInfo>();
    AccessibilityServiceInfo accessibilityServiceInfo = new AccessibilityServiceInfo();
    accessibilityServiceInfo.packageNames = new String[] { "foo.bar" };
    expectedServices.add(accessibilityServiceInfo);
    // configure the mock service behavior
    IAccessibilityManager mockServiceInterface = mMockServiceInterface;
    expect(mockServiceInterface.addClient(anyIAccessibilityManagerClient(), UserHandle.USER_OWNER)).andReturn(AccessibilityManager.STATE_FLAG_ACCESSIBILITY_ENABLED);
    expect(mockServiceInterface.getInstalledAccessibilityServiceList(UserHandle.USER_OWNER)).andReturn(expectedServices);
    replay(mockServiceInterface);
    // invoke the method under test
    AccessibilityManager manager = new AccessibilityManager(mContext, mockServiceInterface, UserHandle.USER_OWNER);
    List<AccessibilityServiceInfo> receivedServices = manager.getInstalledAccessibilityServiceList();
    // check expected result (list equals() compares it contents as well)
    assertEquals("All expected services must be returned", receivedServices, expectedServices);
    // verify the mock service was properly called
    verify(mockServiceInterface);
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) IAccessibilityManager(android.view.accessibility.IAccessibilityManager) AccessibilityManager(android.view.accessibility.AccessibilityManager) IAccessibilityManager(android.view.accessibility.IAccessibilityManager) ArrayList(java.util.ArrayList) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 94 with MediumTest

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

the class TestContext method testAuthorityRenaming.

@MediumTest
public void testAuthorityRenaming() throws Exception {
    final Account account1 = new Account("acc1", "type1");
    final Account account2 = new Account("acc2", "type2");
    final String authorityContacts = "contacts";
    final String authorityCalendar = "calendar";
    final String authorityOther = "other";
    final String authorityContactsNew = "com.android.contacts";
    final String authorityCalendarNew = "com.android.calendar";
    MockContentResolver mockResolver = new MockContentResolver();
    final TestContext testContext = new TestContext(mockResolver, getContext());
    byte[] accountsFileData = ("<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n" + "<accounts>\n" + "<authority id=\"0\" account=\"acc1\" type=\"type1\" authority=\"contacts\" />\n" + "<authority id=\"1\" account=\"acc1\" type=\"type1\" authority=\"calendar\" />\n" + "<authority id=\"2\" account=\"acc1\" type=\"type1\" authority=\"other\" />\n" + "<authority id=\"3\" account=\"acc2\" type=\"type2\" authority=\"contacts\" />\n" + "<authority id=\"4\" account=\"acc2\" type=\"type2\" authority=\"calendar\" />\n" + "<authority id=\"5\" account=\"acc2\" type=\"type2\" authority=\"other\" />\n" + "<authority id=\"6\" account=\"acc2\" type=\"type2\" enabled=\"false\"" + " authority=\"com.android.calendar\" />\n" + "<authority id=\"7\" account=\"acc2\" type=\"type2\" enabled=\"false\"" + " authority=\"com.android.contacts\" />\n" + "</accounts>\n").getBytes();
    File syncDir = new File(new File(testContext.getFilesDir(), "system"), "sync");
    syncDir.mkdirs();
    AtomicFile accountInfoFile = new AtomicFile(new File(syncDir, "accounts.xml"));
    FileOutputStream fos = accountInfoFile.startWrite();
    fos.write(accountsFileData);
    accountInfoFile.finishWrite(fos);
    SyncStorageEngine engine = SyncStorageEngine.newTestInstance(testContext);
    assertEquals(false, engine.getSyncAutomatically(account1, 0, authorityContacts));
    assertEquals(false, engine.getSyncAutomatically(account1, 0, authorityCalendar));
    assertEquals(true, engine.getSyncAutomatically(account1, 0, authorityOther));
    assertEquals(true, engine.getSyncAutomatically(account1, 0, authorityContactsNew));
    assertEquals(true, engine.getSyncAutomatically(account1, 0, authorityCalendarNew));
    assertEquals(false, engine.getSyncAutomatically(account2, 0, authorityContacts));
    assertEquals(false, engine.getSyncAutomatically(account2, 0, authorityCalendar));
    assertEquals(true, engine.getSyncAutomatically(account2, 0, authorityOther));
    assertEquals(false, engine.getSyncAutomatically(account2, 0, authorityContactsNew));
    assertEquals(false, engine.getSyncAutomatically(account2, 0, authorityCalendarNew));
}
Also used : Account(android.accounts.Account) AtomicFile(com.android.internal.os.AtomicFile) FileOutputStream(java.io.FileOutputStream) MockContentResolver(android.test.mock.MockContentResolver) File(java.io.File) AtomicFile(com.android.internal.os.AtomicFile) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 95 with MediumTest

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

the class TestContext method testListenForTicklesParsing.

@MediumTest
public void testListenForTicklesParsing() throws Exception {
    byte[] accountsFileData = ("<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n" + "<accounts>\n" + "<listenForTickles user=\"0\" enabled=\"false\" />" + "<listenForTickles user=\"1\" enabled=\"true\" />" + "<authority id=\"0\" user=\"0\" account=\"account1\" type=\"type1\" authority=\"auth1\" />\n" + "<authority id=\"1\" user=\"1\" account=\"account1\" type=\"type1\" authority=\"auth1\" />\n" + "</accounts>\n").getBytes();
    MockContentResolver mockResolver = new MockContentResolver();
    final TestContext testContext = new TestContext(mockResolver, getContext());
    File syncDir = getSyncDir();
    syncDir.mkdirs();
    AtomicFile accountInfoFile = new AtomicFile(new File(syncDir, "accounts.xml"));
    FileOutputStream fos = accountInfoFile.startWrite();
    fos.write(accountsFileData);
    accountInfoFile.finishWrite(fos);
    SyncStorageEngine engine = SyncStorageEngine.newTestInstance(testContext);
    assertEquals(false, engine.getMasterSyncAutomatically(0));
    assertEquals(true, engine.getMasterSyncAutomatically(1));
    assertEquals(true, engine.getMasterSyncAutomatically(2));
}
Also used : AtomicFile(com.android.internal.os.AtomicFile) FileOutputStream(java.io.FileOutputStream) MockContentResolver(android.test.mock.MockContentResolver) File(java.io.File) AtomicFile(com.android.internal.os.AtomicFile) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

MediumTest (android.test.suitebuilder.annotation.MediumTest)996 View (android.view.View)246 ListView (android.widget.ListView)150 Cursor (android.database.Cursor)116 Handler (android.os.Handler)116 Suppress (android.test.suitebuilder.annotation.Suppress)69 TextView (android.widget.TextView)67 ContentValues (android.content.ContentValues)63 ServiceStatus (com.vodafone360.people.service.ServiceStatus)60 SQLiteCursor (android.database.sqlite.SQLiteCursor)54 SQLiteStatement (android.database.sqlite.SQLiteStatement)49 IOException (java.io.IOException)49 UiThreadTest (android.test.UiThreadTest)48 LogRec (com.android.internal.util.StateMachine.LogRec)42 ContentResolver (android.content.ContentResolver)37 Intent (android.content.Intent)36 Message (android.os.Message)36 GridView (android.widget.GridView)36 InputStream (java.io.InputStream)36 ByteArrayInputStream (java.io.ByteArrayInputStream)35