/** * Create a contact. Delete it. And assert that the contact record is no longer present. * * @return The contact id and raw contact id that was created. */ private DatabaseAsserts.ContactIdPair assertContactCreateDelete() { DatabaseAsserts.ContactIdPair ids = DatabaseAsserts.assertAndCreateContact(mResolver); SystemClock.sleep(1); ContactUtil.delete(mResolver, ids.mContactId); assertFalse(ContactUtil.recordExistsForContactId(mResolver, ids.mContactId)); return ids; }
public void testContactUpdate_updatesContactUpdatedTimestamp() { DatabaseAsserts.ContactIdPair ids = DatabaseAsserts.assertAndCreateContact(mResolver); long baseTime = ContactUtil.queryContactLastUpdatedTimestamp(mResolver, ids.mContactId); ContentValues values = new ContentValues(); values.put(ContactsContract.Contacts.STARRED, 1); SystemClock.sleep(1); ContactUtil.update(mResolver, ids.mContactId, values); long newTime = ContactUtil.queryContactLastUpdatedTimestamp(mResolver, ids.mContactId); assertTrue(newTime > baseTime); // Clean up RawContactUtil.delete(mResolver, ids.mRawContactId, true); }