diff options
author | Dmitri Plotnikov <dplotnikov@google.com> | 2009-09-23 11:40:44 -0700 |
---|---|---|
committer | Dmitri Plotnikov <dplotnikov@google.com> | 2009-09-23 14:36:15 -0700 |
commit | bffeabdf3dcf58f963ad1bb4d3e6e51f3ac16cfd (patch) | |
tree | daddbc243486259584e60dbc048dc565417b6853 /tests | |
parent | a5d05d90333a70d471d78e82caeb5cfa2e4d4c59 (diff) | |
download | ContactsProvider-bffeabdf3dcf58f963ad1bb4d3e6e51f3ac16cfd.tar.gz |
[Issue 2110703] Using triggers to update aggregate contact presence status
Change-Id: Ib1f55ddb926ebafd43c7776cad1db10217fc1bfc
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/providers/contacts/ContactsProvider2Test.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java index ad7f885b..edd689ab 100644 --- a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java +++ b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java @@ -748,6 +748,40 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test { assertPresence(c, Im.PROTOCOL_GOOGLE_TALK, null, Presence.AWAY, "Away"); assertFalse(c.moveToNext()); c.close(); + + long contactId = queryContactId(rawContactId); + Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId); + + ContentValues values = new ContentValues(); + values.put(Presence.PRESENCE_STATUS, Presence.AVAILABLE); + values.put(Presence.PRESENCE_CUSTOM_STATUS, "Away"); + assertStoredValuesWithProjection(contactUri, values); + } + + public void testPresenceUpdateAndDelete() { + long rawContactId = createRawContact(); + insertImHandle(rawContactId, Im.PROTOCOL_AIM, null, "aim"); + + long contactId = queryContactId(rawContactId); + Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId); + + ContentValues values = new ContentValues(); + values.putNull(Presence.PRESENCE_STATUS); + values.putNull(Presence.PRESENCE_CUSTOM_STATUS); + assertStoredValuesWithProjection(contactUri, values); + + Uri presenceUri = + insertPresence(Im.PROTOCOL_AIM, null, "aim", Presence.AVAILABLE, "Available"); + long presenceId = ContentUris.parseId(presenceUri); + + values.put(Presence.PRESENCE_STATUS, Presence.AVAILABLE); + values.put(Presence.PRESENCE_CUSTOM_STATUS, "Available"); + assertStoredValuesWithProjection(contactUri, values); + + mResolver.delete(Presence.CONTENT_URI, Presence._ID + "=" + presenceId, null); + values.putNull(Presence.PRESENCE_STATUS); + values.putNull(Presence.PRESENCE_CUSTOM_STATUS); + assertStoredValuesWithProjection(contactUri, values); } private void assertPresence(Cursor c, int protocol, String customProtocol, int status, |