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());
}
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());
}
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);
}
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));
}
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));
}
Aggregations