diff options
author | Marc Blank <mblank@google.com> | 2011-11-09 11:20:18 -0800 |
---|---|---|
committer | Marc Blank <mblank@google.com> | 2011-11-20 13:44:35 -0800 |
commit | 151bc93f5ff1da031ff0500ab460c2aac79f7416 (patch) | |
tree | c0dd174a7ac64c2447fa9ec0bff9e2edb2f95394 /tests | |
parent | 5248e794032538829c8cf82a3b811709b9a04094 (diff) | |
download | android_packages_apps_Exchange-151bc93f5ff1da031ff0500ab460c2aac79f7416.tar.gz android_packages_apps_Exchange-151bc93f5ff1da031ff0500ab460c2aac79f7416.tar.bz2 android_packages_apps_Exchange-151bc93f5ff1da031ff0500ab460c2aac79f7416.zip |
Handle binder transaction failures in CalendarSyncAdapter
* Created a facility for handling the newly implemented
TransactionTooLargeException that the framework can throw if
we send a too-large batch of data to a content provider.
* For now, we're just using this with CalendarSyncAdapter,
which is where we've seen problems in the past, and in
the referenced bug.
* The test account hits the exception, and then appars to
successfully finish syncing the calendar
Bug: 5516422
Change-Id: I3c7ce3ada940464d1ee1f69bd6192640ebbd8fa3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/exchange/adapter/CalendarSyncAdapterTests.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/src/com/android/exchange/adapter/CalendarSyncAdapterTests.java b/tests/src/com/android/exchange/adapter/CalendarSyncAdapterTests.java index 4bb93f6a..2e2f5530 100644 --- a/tests/src/com/android/exchange/adapter/CalendarSyncAdapterTests.java +++ b/tests/src/com/android/exchange/adapter/CalendarSyncAdapterTests.java @@ -16,6 +16,7 @@ package com.android.exchange.adapter; +import com.android.exchange.adapter.AbstractSyncAdapter.Operation; import com.android.exchange.adapter.CalendarSyncAdapter.CalendarOperations; import com.android.exchange.adapter.CalendarSyncAdapter.EasCalendarSyncParser; import com.android.exchange.provider.MockProvider; @@ -38,6 +39,7 @@ import android.test.suitebuilder.annotation.MediumTest; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.GregorianCalendar; import java.util.List; import java.util.TimeZone; @@ -266,10 +268,12 @@ public class CalendarSyncAdapterTests extends SyncAdapterTestCase<CalendarSyncAd private int countInsertOperationsForTable(CalendarOperations ops, String tableName) { int cnt = 0; - for (ContentProviderOperation op: ops) { - List<String> segments = op.getUri().getPathSegments(); + for (Operation op: ops) { + ContentProviderOperation cpo = + AbstractSyncAdapter.operationToContentProviderOperation(op, 0); + List<String> segments = cpo.getUri().getPathSegments(); if (segments.get(0).equalsIgnoreCase(tableName) && - op.getType() == ContentProviderOperation.TYPE_INSERT) { + cpo.getType() == ContentProviderOperation.TYPE_INSERT) { cnt++; } } @@ -420,7 +424,11 @@ public class CalendarSyncAdapterTests extends SyncAdapterTestCase<CalendarSyncAd EasCalendarSyncParser p = event.getParser(); p.addEvent(p.mOps, "1:1", update); // Send the CPO's to the mock provider - mMockResolver.applyBatch(MockProvider.AUTHORITY, p.mOps); + ArrayList<ContentProviderOperation> cpos = new ArrayList<ContentProviderOperation>(); + for (Operation op: p.mOps) { + cpos.add(AbstractSyncAdapter.operationToContentProviderOperation(op, 0)); + } + mMockResolver.applyBatch(MockProvider.AUTHORITY, cpos); return mMockResolver.query(MockProvider.uri(Attendees.CONTENT_URI), ATTENDEE_PROJECTION, null, null, null); } |