diff options
| author | 2021-01-14 13:23:45 -0800 | |
|---|---|---|
| committer | 2021-01-14 13:45:57 -0800 | |
| commit | fd8f27e1554c4bf85ffe7f45acb29b5b6b309e0c (patch) | |
| tree | 204939cf120f670ac8ffb6464f61a00c49f791f7 | |
| parent | 894acd9114193f0808501d252d6b0d1d6f572d57 (diff) | |
Add a unit test for isSealed()
Bug: 177424937
The Watchable* arrays in server/utils have an isSealed() method. Add
a unit test for the method.
Test: atest
* FrameworksServicesTests:WatcherTest
Change-Id: I3a2e5bd82e220f1a253065023d95aa927421b97b
| -rw-r--r-- | services/tests/servicestests/src/com/android/server/utils/WatcherTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/services/tests/servicestests/src/com/android/server/utils/WatcherTest.java b/services/tests/servicestests/src/com/android/server/utils/WatcherTest.java index 7c65dc03a57e..b40d59c14b8d 100644 --- a/services/tests/servicestests/src/com/android/server/utils/WatcherTest.java +++ b/services/tests/servicestests/src/com/android/server/utils/WatcherTest.java @@ -254,6 +254,8 @@ public class WatcherTest { tester.verify(15, "Tick after snapshot"); // Verify that the snapshot is sealed verifySealed(name, ()->arraySnap.put(INDEX_A, leafA)); + assertTrue(!array.isSealed()); + assertTrue(arraySnap.isSealed()); } // Recreate the snapshot since the test corrupted it. { @@ -355,6 +357,8 @@ public class WatcherTest { tester.verify(16, "Tick after snapshot"); // Verify that the array snapshot is sealed verifySealed(name, ()->arraySnap.add(leafB)); + assertTrue(!array.isSealed()); + assertTrue(arraySnap.isSealed()); } // Recreate the snapshot since the test corrupted it. { @@ -467,6 +471,8 @@ public class WatcherTest { tester.verify(20, "Tick after snapshot"); // Verify that the array snapshot is sealed verifySealed(name, ()->arraySnap.add(indexA, leafB)); + assertTrue(!array.isSealed()); + assertTrue(arraySnap.isSealed()); } // Recreate the snapshot since the test corrupted it. { @@ -586,6 +592,8 @@ public class WatcherTest { tester.verify(23, "Tick after snapshot"); // Verify that the array snapshot is sealed verifySealed(name, ()->arraySnap.put(INDEX_A, leafB)); + assertTrue(!array.isSealed()); + assertTrue(arraySnap.isSealed()); } // Recreate the snapshot since the test corrupted it. { @@ -649,6 +657,8 @@ public class WatcherTest { tester.verify(6, "Tick after snapshot"); // Verify that the array is sealed verifySealed(name, ()->arraySnap.put(INDEX_D, false)); + assertTrue(!array.isSealed()); + assertTrue(arraySnap.isSealed()); } // Verify copy-in/out { @@ -705,6 +715,8 @@ public class WatcherTest { tester.verify(6, "Tick after snapshot"); // Verify that the array is sealed verifySealed(name, ()->arraySnap.put(INDEX_D, 10)); + assertTrue(!array.isSealed()); + assertTrue(arraySnap.isSealed()); } // Verify copy-in/out { |