summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2015-04-28 12:32:16 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-28 12:32:16 +0000
commitb21ca3e611c5d298d3cca0d3c81af5bb89f3d5b0 (patch)
treee915bde9af66c9f2546f0936a20e4d1eb7e57fed
parentd553f8fbd6e3f9779fcda791c94d40100f17ec5c (diff)
parent1632b400abbe6f0b9ac6aeb61c2183c51611439f (diff)
downloadcts-master-soong.tar.gz
Merge "Add a test for null valued collection handling of Bundle#hasFileDescriptors"master-soong
-rw-r--r--tests/tests/os/src/android/os/cts/BundleTest.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/tests/os/src/android/os/cts/BundleTest.java b/tests/tests/os/src/android/os/cts/BundleTest.java
index 0db5fd0fe59..36326b36655 100644
--- a/tests/tests/os/src/android/os/cts/BundleTest.java
+++ b/tests/tests/os/src/android/os/cts/BundleTest.java
@@ -730,6 +730,26 @@ public class BundleTest extends AndroidTestCase {
assertTrue(mBundle.hasFileDescriptors());
}
+ public void testHasFileDescriptorsOnNullValuedCollection() {
+ assertFalse(mBundle.hasFileDescriptors());
+
+ mBundle.putParcelableArray("foo", new Parcelable[1]);
+ assertFalse(mBundle.hasFileDescriptors());
+ mBundle.clear();
+
+ SparseArray<Parcelable> sparseArray = new SparseArray<Parcelable>();
+ sparseArray.put(0, null);
+ mBundle.putSparseParcelableArray("bar", sparseArray);
+ assertFalse(mBundle.hasFileDescriptors());
+ mBundle.clear();
+
+ ArrayList<Parcelable> arrayList = new ArrayList<Parcelable>();
+ arrayList.add(null);
+ mBundle.putParcelableArrayList("baz", arrayList);
+ assertFalse(mBundle.hasFileDescriptors());
+ mBundle.clear();
+ }
+
public void testSetClassLoader() {
mBundle.setClassLoader(new MockClassLoader());
}