summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDmitri Plotnikov <dplotnikov@google.com>2009-08-10 18:10:09 -0700
committerDmitri Plotnikov <dplotnikov@google.com>2009-08-10 18:10:09 -0700
commit73776ffd5c00e94db987ee30864e9c7a8396d22d (patch)
tree6631415d9036780fa291b915982f8f96f3de1d1d /tests
parent94021b213e4db367f60b30fcbfe9019e28571784 (diff)
downloadpackages_providers_ContactsProvider-73776ffd5c00e94db987ee30864e9c7a8396d22d.zip
packages_providers_ContactsProvider-73776ffd5c00e94db987ee30864e9c7a8396d22d.tar.gz
packages_providers_ContactsProvider-73776ffd5c00e94db987ee30864e9c7a8396d22d.tar.bz2
DIRTY flag on Contacts will no longer be set if the query has the ?mark_as_dirty=true parameter.
Sync adapters should be able to set their own data on the Data row without triggering another round of syncing.
Diffstat (limited to 'tests')
-rw-r--r--tests/assets/expected_groups.txt2
-rw-r--r--tests/assets/expected_raw_contacts.txt3
-rw-r--r--tests/src/com/android/providers/contacts/ContactsProvider2Test.java24
-rw-r--r--tests/src/com/android/providers/contacts/GroupsTest.java12
4 files changed, 30 insertions, 11 deletions
diff --git a/tests/assets/expected_groups.txt b/tests/assets/expected_groups.txt
index 0f2e325..5ff878f 100644
--- a/tests/assets/expected_groups.txt
+++ b/tests/assets/expected_groups.txt
@@ -53,7 +53,7 @@
53 _id=4
54 account_name=android.contacts.test.eclair@gmail.com
55 account_type=com.google.GAIA
-56 dirty=1
+56 dirty=0
57 group_visible=1
58 notes=null
59 res_package=null
diff --git a/tests/assets/expected_raw_contacts.txt b/tests/assets/expected_raw_contacts.txt
index ff6c954..46ddfd9 100644
--- a/tests/assets/expected_raw_contacts.txt
+++ b/tests/assets/expected_raw_contacts.txt
@@ -55,7 +55,7 @@
55 account_name=android.contacts.test.eclair@gmail.com
56 account_type=com.google.GAIA
57 deleted=1
-58 dirty=1
+58 dirty=0
59 sourceid=http://www.google.com/m8/feeds/contacts/android.contacts.test.eclair@gmail.com/base/20d08a710c3df43d
60 version=1
61 sync1=null
@@ -63,3 +63,4 @@
63 sync3=null
64 sync4=null
65 }
+
diff --git a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java
index 6ffb9ab..0bb9857 100644
--- a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java
+++ b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java
@@ -22,7 +22,6 @@ import android.content.ContentValues;
import android.content.Entity;
import android.content.EntityIterator;
import android.database.Cursor;
-import android.database.DatabaseUtils;
import android.net.Uri;
import android.os.RemoteException;
import android.provider.ContactsContract;
@@ -345,7 +344,6 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test {
values.put(Groups.ACCOUNT_TYPE, "b");
values.put(Groups.SOURCE_ID, "c");
values.put(Groups.VERSION, 42);
- values.put(Groups.DIRTY, 1);
values.put(Groups.GROUP_VISIBLE, 1);
values.put(Groups.TITLE, "d");
values.put(Groups.TITLE_RES, 1234);
@@ -360,6 +358,7 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test {
Uri rowUri = mResolver.insert(Groups.CONTENT_URI, values);
+ values.put(Groups.DIRTY, 1);
assertStoredValues(rowUri, values);
}
@@ -708,18 +707,25 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test {
null));
}
- public void testRawContactDirtySetOnChange() {
- Uri uri = ContentUris.withAppendedId(ContactsContract.RawContacts.CONTENT_URI,
- createRawContact(mAccount));
- assertDirty(uri, true);
- clearDirty(uri);
- assertDirty(uri, false);
+ public void testMarkAsDirtyParameter() {
+ long rawContactId = createRawContact(mAccount);
+ Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
+
+ Uri uri = insertStructuredName(rawContactId, "John", "Doe");
+ clearDirty(rawContactUri);
+ Uri updateUri = uri.buildUpon().appendQueryParameter(Data.MARK_AS_DIRTY, "0").build();
+
+ ContentValues values = new ContentValues();
+ values.put(StructuredName.FAMILY_NAME, "Dough");
+ mResolver.update(updateUri, values, null, null);
+ assertStoredValues(uri, StructuredName.FAMILY_NAME, "Dough");
+ assertDirty(rawContactUri, false);
}
public void testRawContactDirtyAndVersion() {
final long rawContactId = createRawContact(mAccount);
Uri uri = ContentUris.withAppendedId(ContactsContract.RawContacts.CONTENT_URI, rawContactId);
- assertDirty(uri, true);
+ assertDirty(uri, false);
long version = getVersion(uri);
ContentValues values = new ContentValues();
diff --git a/tests/src/com/android/providers/contacts/GroupsTest.java b/tests/src/com/android/providers/contacts/GroupsTest.java
index d47f9ba..e4ea14f 100644
--- a/tests/src/com/android/providers/contacts/GroupsTest.java
+++ b/tests/src/com/android/providers/contacts/GroupsTest.java
@@ -144,6 +144,18 @@ public class GroupsTest extends BaseContactsProvider2Test {
assertDirty(uri, false);
}
+ public void testMarkAsDirtyParameter() {
+ Uri uri = ContentUris.withAppendedId(Groups.CONTENT_URI,
+ createGroup(mAccount, "gsid1", "title1"));
+ clearDirty(uri);
+ Uri updateUri = uri.buildUpon().appendQueryParameter(Groups.MARK_AS_DIRTY, "0").build();
+
+ ContentValues values = new ContentValues();
+ values.put(Groups.NOTES, "New notes");
+ mResolver.update(updateUri, values, null, null);
+ assertDirty(uri, false);
+ }
+
public void testGroupDirtyClearedWhenSetExplicitly() {
Uri uri = ContentUris.withAppendedId(Groups.CONTENT_URI,
createGroup(mAccount, "gsid1", "title1"));