aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-03-21 01:41:26 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-03-21 01:41:26 +0000
commitffe2bb61f30e889c15ca84f77a5efa3a3f0c53d7 (patch)
treeb00c20d8c8344fc92fe0b2ef5b8e5d110b5aa4b7
parent23497aec1bf6df93dfa388d330cba01518d1af06 (diff)
parent3cbcaf1f6c2d350495b10b737cfb54d0bf03833c (diff)
downloadcsuite-ffe2bb61f30e889c15ca84f77a5efa3a3f0c53d7.tar.gz
Snap for 9781156 from 3cbcaf1f6c2d350495b10b737cfb54d0bf03833c to udc-d1-release
Change-Id: I6f634827615eceea6696d1906a9d695e940dbcc8
-rw-r--r--test_scripts/src/main/java/com/android/webview/lib/WebviewInstallerToolPreparer.java4
-rw-r--r--test_scripts/src/main/java/com/android/webview/lib/WebviewUtils.java23
-rw-r--r--test_scripts/src/main/java/com/android/webview/tests/WebviewAppLaunchTest.java2
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) {