summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFred Quintana <fredq@google.com>2009-08-10 14:44:13 -0700
committerFred Quintana <fredq@google.com>2009-08-10 15:14:29 -0700
commit94021b213e4db367f60b30fcbfe9019e28571784 (patch)
treedf830e3830dbc6b81374298f65535d77d693998e /tests
parentd659078547c329b58f90d8809910a845d913dbc6 (diff)
downloadpackages_providers_ContactsProvider-94021b213e4db367f60b30fcbfe9019e28571784.zip
packages_providers_ContactsProvider-94021b213e4db367f60b30fcbfe9019e28571784.tar.gz
packages_providers_ContactsProvider-94021b213e4db367f60b30fcbfe9019e28571784.tar.bz2
add the deleted flag to the groups table
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/providers/contacts/ContactsProvider2Test.java1
-rw-r--r--tests/src/com/android/providers/contacts/GroupsTest.java27
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java
index c240a07..6ffb9ab 100644
--- a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java
+++ b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java
@@ -352,6 +352,7 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test {
values.put(Groups.NOTES, "e");
values.put(Groups.RES_PACKAGE, "f");
values.put(Groups.SYSTEM_ID, "g");
+ values.put(Groups.DELETED, 1);
values.put(Groups.SYNC1, "h");
values.put(Groups.SYNC2, "i");
values.put(Groups.SYNC3, "j");
diff --git a/tests/src/com/android/providers/contacts/GroupsTest.java b/tests/src/com/android/providers/contacts/GroupsTest.java
index 38715b5..d47f9ba 100644
--- a/tests/src/com/android/providers/contacts/GroupsTest.java
+++ b/tests/src/com/android/providers/contacts/GroupsTest.java
@@ -22,6 +22,7 @@ import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract.Groups;
import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
+import android.provider.ContactsContract;
import android.test.suitebuilder.annotation.LargeTest;
/**
@@ -156,6 +157,32 @@ public class GroupsTest extends BaseContactsProvider2Test {
assertDirty(uri, false);
}
+ public void testGroupDeletion1() {
+ long groupId = createGroup(mAccount, "g1", "gt1");
+ Uri uri = ContentUris.withAppendedId(Groups.CONTENT_URI, groupId);
+
+ assertEquals(1, getCount(uri, null, null));
+ mResolver.delete(uri, null, null);
+ assertEquals(1, getCount(uri, null, null));
+ assertStoredValues(uri, Groups.DELETED, "1");
+
+ Uri permanentDeletionUri =
+ uri.buildUpon().appendQueryParameter(Groups.DELETE_PERMANENTLY, "true").build();
+ mResolver.delete(permanentDeletionUri, null, null);
+ assertEquals(0, getCount(uri, null, null));
+ }
+
+ public void testGroupDeletion2() {
+ long groupId = createGroup(mAccount, "g1", "gt1");
+ Uri uri = ContentUris.withAppendedId(Groups.CONTENT_URI, groupId);
+
+ assertEquals(1, getCount(uri, null, null));
+ Uri permanentDeletionUri =
+ uri.buildUpon().appendQueryParameter(Groups.DELETE_PERMANENTLY, "true").build();
+ mResolver.delete(permanentDeletionUri, null, null);
+ assertEquals(0, getCount(uri, null, null));
+ }
+
public void testGroupVersionUpdates() {
Uri uri = ContentUris.withAppendedId(Groups.CONTENT_URI,
createGroup(mAccount, "gsid1", "title1"));