Test for: NameNotFound exception
Bug: 220930052
Test: atest ChecksumsTest
Change-Id: Ifeb4d3d1c1c22c9f85728e2cd1cff1d6d1002ba3
diff --git a/tests/tests/content/src/android/content/pm/cts/ChecksumsTest.java b/tests/tests/content/src/android/content/pm/cts/ChecksumsTest.java
index 4ca3763..299bd04 100644
--- a/tests/tests/content/src/android/content/pm/cts/ChecksumsTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/ChecksumsTest.java
@@ -33,6 +33,7 @@
import static org.junit.Assert.assertTrue;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertThrows;
import android.app.UiAutomation;
import android.content.ComponentName;
@@ -187,6 +188,14 @@
}
@Test
+ public void testNameNotFound() throws Exception {
+ LocalListener receiver = new LocalListener();
+ PackageManager pm = getPackageManager();
+ assertThrows(PackageManager.NameNotFoundException.class,
+ () -> pm.requestChecksums(V4_PACKAGE_NAME, true, 0, TRUST_NONE, receiver));
+ }
+
+ @Test
public void testReadWriteChecksums() throws Exception {
// Read checksums from file and confirm they are the same as hardcoded.
checkStoredChecksums(TEST_FIXED_APK_DIGESTS, TEST_FIXED_APK_DIGESTS_FILE);