Merge "Update tests to use new InstallUtilsHost lib" am: ef3ada5831 am: 78d15ba6cb am: a6c710091a

Original change: https://android-review.googlesource.com/c/platform/packages/modules/NetworkStack/+/1519677

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I18c3e2dfe3b0400bf41e5dfe7c71fa654621495f
diff --git a/tests/hostdriven/Android.bp b/tests/hostdriven/Android.bp
index ec36424..3509f89 100644
--- a/tests/hostdriven/Android.bp
+++ b/tests/hostdriven/Android.bp
@@ -23,7 +23,7 @@
     ],
     static_libs: [
         "kotlin-test",
-        "module_test_util",
+        "cts-install-lib-host",
     ],
     test_suites: ["device-tests"],
     data: [":NetworkStack"],
diff --git a/tests/hostdriven/host/src/com/android/networkstack/hosttests/NetworkStackHostTests.kt b/tests/hostdriven/host/src/com/android/networkstack/hosttests/NetworkStackHostTests.kt
index bc1176f..a79de6a 100644
--- a/tests/hostdriven/host/src/com/android/networkstack/hosttests/NetworkStackHostTests.kt
+++ b/tests/hostdriven/host/src/com/android/networkstack/hosttests/NetworkStackHostTests.kt
@@ -16,7 +16,7 @@
 
 package com.android.networkstack.hosttests
 
-import com.android.tests.util.ModuleTestUtils
+import android.cts.install.lib.host.InstallUtilsHost
 import com.android.tradefed.device.ITestDevice
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner
 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test
@@ -42,8 +42,7 @@
 @RunWith(DeviceJUnit4ClassRunner::class)
 class NetworkStackHostTests : BaseHostJUnit4Test() {
 
-    private val mUtils = ModuleTestUtils(this)
-    private val mModuleApk = mUtils.getTestFile(APP_APK)
+    private val mModuleApk = InstallUtilsHost(this).getTestFile(APP_APK)
     private val mPackageName = AaptParser.parse(mModuleApk)?.packageName
             ?: throw IllegalStateException("Could not parse test package name")
     private val mDevice by lazy { getDevice() }
@@ -74,12 +73,10 @@
         assumeFalse(error != null && error.contains("Unknown option --staged"))
         assertNull(error, "Error installing module package: $error")
         try {
-            mUtils.waitForStagedSessionReady()
             applyUpdateAndCheckNetworkStackRegistered()
             assertNotEquals(initialUpdateTime, getLastUpdateTime(), "Update time did not change")
         } finally {
             assertCommandSucceeds("pm rollback-app $mPackageName")
-            mUtils.waitForStagedSessionReady()
             applyUpdateAndCheckNetworkStackRegistered()
         }
     }
diff --git a/tests/hostlib/Android.bp b/tests/hostlib/Android.bp
index 30b2fb5..9a88634 100644
--- a/tests/hostlib/Android.bp
+++ b/tests/hostlib/Android.bp
@@ -24,6 +24,6 @@
     ],
     static_libs: [
         "kotlin-test",
-        "module_test_util",
+        "cts-install-lib-host",
     ],
 }
\ No newline at end of file
diff --git a/tests/hostlib/src/com/android/testutils/host/DeflakeHostTestBase.kt b/tests/hostlib/src/com/android/testutils/host/DeflakeHostTestBase.kt
index e4cc2ff..3119db7 100644
--- a/tests/hostlib/src/com/android/testutils/host/DeflakeHostTestBase.kt
+++ b/tests/hostlib/src/com/android/testutils/host/DeflakeHostTestBase.kt
@@ -16,7 +16,7 @@
 
 package com.android.testutils.host
 
-import com.android.tests.util.ModuleTestUtils
+import android.cts.install.lib.host.InstallUtilsHost
 import com.android.tradefed.config.Option
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner
 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test
@@ -99,7 +99,7 @@
 
     @Test
     fun testDeflake() {
-        val apkFile = ModuleTestUtils(this).getTestFile(testApkFilename)
+        val apkFile = InstallUtilsHost(this).getTestFile(testApkFilename)
         val pkgName = AaptParser.parse(apkFile)?.packageName
                 ?: fail("Could not parse test package name")