summaryrefslogtreecommitdiffstats
path: root/tests/tests/content/src/android/content/cts/ContentProviderCursorWindowTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tests/content/src/android/content/cts/ContentProviderCursorWindowTest.java')
-rw-r--r--tests/tests/content/src/android/content/cts/ContentProviderCursorWindowTest.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/tests/content/src/android/content/cts/ContentProviderCursorWindowTest.java b/tests/tests/content/src/android/content/cts/ContentProviderCursorWindowTest.java
index 004b193bda1..636b44074d9 100644
--- a/tests/tests/content/src/android/content/cts/ContentProviderCursorWindowTest.java
+++ b/tests/tests/content/src/android/content/cts/ContentProviderCursorWindowTest.java
@@ -17,24 +17,32 @@
package android.content.cts;
import android.database.Cursor;
+import android.database.CursorWindowAllocationException;
import android.database.sqlite.SQLiteException;
import android.net.Uri;
import android.test.AndroidTestCase;
import android.util.Log;
-import java.io.IOException;
-
/**
* Test {@link CursorWindowContentProvider} .
*/
public class ContentProviderCursorWindowTest extends AndroidTestCase {
private static final String TAG = "ContentProviderCursorWindowTest";
- public void testQuery() throws IOException {
- Cursor cursor = getContext().getContentResolver().query(
- Uri.parse("content://cursorwindow.provider/hello"),
- null, null, null, null
- );
+ public void testQuery() {
+ // First check if the system has a patch for enforcing protected Parcel data
+ Cursor cursor;
+ try {
+ cursor = getContext().getContentResolver().query(
+ Uri.parse("content://cursorwindow.provider/hello"),
+ null, null, null, null);
+ } catch (CursorWindowAllocationException expected) {
+ Log.i(TAG, "Expected exception: " + expected);
+ return;
+ }
+
+ // If the system has no patch for protected Parcel data,
+ // it should still fail while reading from the cursor
try {
cursor.moveToFirst();