Revert "Remove failing UsesLibrary.testUsesLibrary test."
This reverts commit 821a2c99bf3d64b427c0bf1dc8e16d5ac86192ee.
Merged-In: I3989f3e550a6bfb2997a565e483b382265d64e3e
Change-Id: I919e9e8c91c9d24c1d6566dc5ac337c0c51aab23
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/UsesLibraryHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/UsesLibraryHostTest.java
index ebd6f5e..c8e608e 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/UsesLibraryHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/UsesLibraryHostTest.java
@@ -64,6 +64,12 @@
getDevice().uninstallPackage(PKG);
}
+ public void testUsesLibrary() throws Exception {
+ assertNull(getDevice().installPackage(
+ MigrationHelper.getTestFile(mCtsBuild, APK), false, false));
+ runDeviceTests(PKG, ".UsesLibraryTest", "testUsesLibrary");
+ }
+
public void testMissingLibrary() throws Exception {
assertNull(getDevice().installPackage(
MigrationHelper.getTestFile(mCtsBuild, APK), false, false));
diff --git a/hostsidetests/appsecurity/test-apps/UsesLibraryApp/src/com/android/cts/useslibrary/UsesLibraryTest.java b/hostsidetests/appsecurity/test-apps/UsesLibraryApp/src/com/android/cts/useslibrary/UsesLibraryTest.java
index c7b8f8b..0a1f012 100644
--- a/hostsidetests/appsecurity/test-apps/UsesLibraryApp/src/com/android/cts/useslibrary/UsesLibraryTest.java
+++ b/hostsidetests/appsecurity/test-apps/UsesLibraryApp/src/com/android/cts/useslibrary/UsesLibraryTest.java
@@ -34,6 +34,17 @@
public class UsesLibraryTest extends InstrumentationTestCase {
private static final String TAG = "UsesLibraryTest";
+ public void testUsesLibrary() throws Exception {
+ ClassLoader loader = getClass().getClassLoader();
+ if (loader instanceof BaseDexClassLoader) {
+ Object[] dexElements = getDexElementsFromClassLoader((BaseDexClassLoader) loader);
+ for (Object dexElement : dexElements) {
+ DexFile dexFile = getDexFileFromDexElement(dexElement);
+ assertTrue(isDexFileBackedByOatFile(dexFile));
+ }
+ }
+ }
+
public void testMissingLibrary() throws Exception {
ClassLoader loader = getClass().getClassLoader();
if (loader instanceof BaseDexClassLoader) {