diff options
author | Rakib M. Hasan <rmhasan@google.com> | 2023-03-20 22:12:59 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-03-20 22:12:59 +0000 |
commit | 3cbcaf1f6c2d350495b10b737cfb54d0bf03833c (patch) | |
tree | b00c20d8c8344fc92fe0b2ef5b8e5d110b5aa4b7 | |
parent | 30b9afe65468a5013d089ff09d769aaeb7841051 (diff) | |
parent | 4ec83ec4e0c2d0ed3fc6733e8b7ad03e6d4b9d21 (diff) | |
download | csuite-3cbcaf1f6c2d350495b10b737cfb54d0bf03833c.tar.gz |
Webview: Retrieve the test device from the TestInformation instance am: 08ea0137c6 am: 8e63ce468a am: 5da47c3bc1 am: 4ec83ec4e0
Original change: https://android-review.googlesource.com/c/platform/test/app_compat/csuite/+/2494735
Change-Id: I21e46d36fe3d3561862a72f37368f94e9bac6b33
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
3 files changed, 14 insertions, 15 deletions
diff --git a/test_scripts/src/main/java/com/android/webview/lib/WebviewInstallerToolPreparer.java b/test_scripts/src/main/java/com/android/webview/lib/WebviewInstallerToolPreparer.java index 8cc82f2..349cd78 100644 --- a/test_scripts/src/main/java/com/android/webview/lib/WebviewInstallerToolPreparer.java +++ b/test_scripts/src/main/java/com/android/webview/lib/WebviewInstallerToolPreparer.java @@ -18,7 +18,6 @@ package com.android.webview.tests; import com.android.tradefed.config.Option; import com.android.tradefed.config.Option.Importance; -import com.android.tradefed.device.ITestDevice; import com.android.tradefed.invoker.TestInformation; import com.android.tradefed.targetprep.ITargetPreparer; import com.android.tradefed.targetprep.TargetSetupError; @@ -67,7 +66,6 @@ public class WebviewInstallerToolPreparer implements ITargetPreparer { public static CommandResult runWebviewInstallerToolCommand( TestInformation testInformation, - ITestDevice device, @Nullable String webviewVersion, @Nullable String releaseChannel, List<String> extraArgs) { @@ -80,7 +78,7 @@ public class WebviewInstallerToolPreparer implements ITargetPreparer { getWebviewInstallerToolPath(testInformation), "--non-next", "--serial", - device.getSerialNumber(), + testInformation.getDevice().getSerialNumber(), "-vvv", "--gsutil", Paths.get( diff --git a/test_scripts/src/main/java/com/android/webview/lib/WebviewUtils.java b/test_scripts/src/main/java/com/android/webview/lib/WebviewUtils.java index 0774b23..2d47066 100644 --- a/test_scripts/src/main/java/com/android/webview/lib/WebviewUtils.java +++ b/test_scripts/src/main/java/com/android/webview/lib/WebviewUtils.java @@ -17,7 +17,6 @@ package com.android.webview.tests; import com.android.tradefed.device.DeviceNotAvailableException; -import com.android.tradefed.device.ITestDevice; import com.android.tradefed.invoker.TestInformation; import com.android.tradefed.log.LogUtil.CLog; import com.android.tradefed.util.CommandResult; @@ -35,11 +34,9 @@ import java.util.Arrays; import java.util.List; public class WebviewUtils { - private ITestDevice mTestDevice; private TestInformation mTestInformation; - public WebviewUtils(ITestDevice device, TestInformation testInformation) { - mTestDevice = device; + public WebviewUtils(TestInformation testInformation) { mTestInformation = testInformation; } @@ -65,7 +62,7 @@ public class WebviewUtils { } CommandResult commandResult = WebviewInstallerToolPreparer.runWebviewInstallerToolCommand( - mTestInformation, mTestDevice, webviewVersion, releaseChannel, extraArgs); + mTestInformation, webviewVersion, releaseChannel, extraArgs); Assert.assertEquals( "The WebView installer tool failed to install WebView:\n" @@ -102,23 +99,27 @@ public class WebviewUtils { webviewPackage, preInstalledWebviewPackage); updateWebviewImplementation(preInstalledWebviewPackage.getPackageName()); - mTestDevice.executeAdbCommand("uninstall", webviewPackage.getPackageName()); + mTestInformation + .getDevice() + .executeAdbCommand("uninstall", webviewPackage.getPackageName()); printWebviewVersion(); } private void updateWebviewImplementation(String webviewPackageName) throws DeviceNotAvailableException { CommandResult res = - mTestDevice.executeShellV2Command( - String.format( - "cmd webviewupdate set-webview-implementation %s", - webviewPackageName)); + mTestInformation + .getDevice() + .executeShellV2Command( + String.format( + "cmd webviewupdate set-webview-implementation %s", + webviewPackageName)); Assert.assertEquals( "Failed to set webview update: " + res, res.getStatus(), CommandStatus.SUCCESS); } public WebviewPackage getCurrentWebviewPackage() throws DeviceNotAvailableException { - String dumpsys = mTestDevice.executeShellCommand("dumpsys webviewupdate"); + String dumpsys = mTestInformation.getDevice().executeShellCommand("dumpsys webviewupdate"); return WebviewPackage.buildFromDumpsys(dumpsys); } diff --git a/test_scripts/src/main/java/com/android/webview/tests/WebviewAppLaunchTest.java b/test_scripts/src/main/java/com/android/webview/tests/WebviewAppLaunchTest.java index c285308..a8f72d1 100644 --- a/test_scripts/src/main/java/com/android/webview/tests/WebviewAppLaunchTest.java +++ b/test_scripts/src/main/java/com/android/webview/tests/WebviewAppLaunchTest.java @@ -93,7 +93,7 @@ public class WebviewAppLaunchTest extends BaseHostJUnit4Test { mWebviewVersionToTest != null || mReleaseChannel != null); mApkInstaller = ApkInstaller.getInstance(getDevice()); - mWebviewUtils = new WebviewUtils(getDevice(), getTestInformation()); + mWebviewUtils = new WebviewUtils(getTestInformation()); mPreInstalledWebview = mWebviewUtils.getCurrentWebviewPackage(); for (File apkPath : mApkPaths) { |