diff options
author | 2024-03-08 11:02:29 +0100 | |
---|---|---|
committer | 2024-03-08 11:02:29 +0100 | |
commit | 0a20da746eeb2884d43a90bd8e32ab7de59b4875 (patch) | |
tree | 38f819ca5524dad28e8b06ca07a3a8324a908460 | |
parent | ded43d4e21aa2511d4e12f73692e8d8c544e180b (diff) |
Fold [GoldenImagePathManager] into [GoldenPathManager] #cleanup
These are required changes sto be submitted together with ag/26486827.
Bug: 322324387
Test: Test-only change, covered by existing unit tests
Change-Id: I57ae2d524e60548997ef77e5de31e446e3e70d73
6 files changed, 40 insertions, 46 deletions
diff --git a/packages/CredentialManager/tests/robotests/screenshot/src/com/android/credentialmanager/CredentialManagerGoldenImagePathManager.kt b/packages/CredentialManager/tests/robotests/screenshot/src/com/android/credentialmanager/CredentialManagerGoldenPathManager.kt index 6aef24d846a9..9cfdffd55267 100644 --- a/packages/CredentialManager/tests/robotests/screenshot/src/com/android/credentialmanager/CredentialManagerGoldenImagePathManager.kt +++ b/packages/CredentialManager/tests/robotests/screenshot/src/com/android/credentialmanager/CredentialManagerGoldenPathManager.kt @@ -18,34 +18,34 @@ package com.android.credentialmanager import android.os.Build import androidx.test.platform.app.InstrumentationRegistry -import platform.test.screenshot.GoldenImagePathManager +import platform.test.screenshot.GoldenPathManager import platform.test.screenshot.PathConfig /** The assets path to be used by all CredentialManager screenshot tests. */ private const val ASSETS_PREFIX = "frameworks/base/packages/CredentialManager" private const val ASSETS_PATH = "${ASSETS_PREFIX}/tests/robotests/screenshot/customization/assets" -private const val ASSETS_PATH_ROBO = - "${ASSETS_PREFIX}/tests/robotests/customization/assets" +private const val ASSETS_PATH_ROBO = "${ASSETS_PREFIX}/tests/robotests/customization/assets" private val isRobolectric = Build.FINGERPRINT.contains("robolectric") -class CredentialManagerGoldenImagePathManager( - pathConfig: PathConfig, - assetsPathRelativeToBuildRoot: String = if (isRobolectric) ASSETS_PATH_ROBO else ASSETS_PATH -) : GoldenImagePathManager( +class CredentialManagerGoldenPathManager( + pathConfig: PathConfig, + assetsPathRelativeToBuildRoot: String = if (isRobolectric) ASSETS_PATH_ROBO else ASSETS_PATH +) : + GoldenPathManager( appContext = InstrumentationRegistry.getInstrumentation().context, assetsPathRelativeToBuildRoot = assetsPathRelativeToBuildRoot, deviceLocalPath = - InstrumentationRegistry.getInstrumentation() + InstrumentationRegistry.getInstrumentation() .targetContext .filesDir .absolutePath .toString() + "/credman_screenshots", pathConfig = pathConfig, -) { + ) { override fun toString(): String { // This string is appended to all actual/expected screenshots on the device, so make sure // it is a static value. - return "CredentialManagerGoldenImagePathManager" + return "CredentialManagerGoldenPathManager" } -}
\ No newline at end of file +} diff --git a/packages/CredentialManager/tests/robotests/screenshot/src/com/android/credentialmanager/GetCredScreenshotTest.kt b/packages/CredentialManager/tests/robotests/screenshot/src/com/android/credentialmanager/GetCredScreenshotTest.kt index 28d83ee157b6..b8432137b35e 100644 --- a/packages/CredentialManager/tests/robotests/screenshot/src/com/android/credentialmanager/GetCredScreenshotTest.kt +++ b/packages/CredentialManager/tests/robotests/screenshot/src/com/android/credentialmanager/GetCredScreenshotTest.kt @@ -60,7 +60,7 @@ class GetCredScreenshotTest(emulationSpec: DeviceEmulationSpec) { @get:Rule val screenshotRule = ComposeScreenshotTestRule( emulationSpec, - CredentialManagerGoldenImagePathManager(getEmulatedDevicePathConfig(emulationSpec)) + CredentialManagerGoldenPathManager(getEmulatedDevicePathConfig(emulationSpec)) ) @get:Rule val setFlagsRule: SetFlagsRule = SetFlagsRule() diff --git a/packages/SettingsLib/Spa/screenshot/src/com/android/settingslib/spa/screenshot/util/SettingsGoldenImagePathManager.kt b/packages/SettingsLib/Spa/screenshot/src/com/android/settingslib/spa/screenshot/util/SettingsGoldenPathManager.kt index f5fba7fb3cc8..d59076082c66 100644 --- a/packages/SettingsLib/Spa/screenshot/src/com/android/settingslib/spa/screenshot/util/SettingsGoldenImagePathManager.kt +++ b/packages/SettingsLib/Spa/screenshot/src/com/android/settingslib/spa/screenshot/util/SettingsGoldenPathManager.kt @@ -17,28 +17,25 @@ package com.android.settingslib.spa.screenshot.util import androidx.test.platform.app.InstrumentationRegistry -import platform.test.screenshot.GoldenImagePathManager +import platform.test.screenshot.GoldenPathManager import platform.test.screenshot.PathConfig -/** A [GoldenImagePathManager] that should be used for all Settings screenshot tests. */ -class SettingsGoldenImagePathManager( - pathConfig: PathConfig, - assetsPathRelativeToBuildRoot: String -) : - GoldenImagePathManager( +/** A [GoldenPathManager] that should be used for all Settings screenshot tests. */ +class SettingsGoldenPathManager(pathConfig: PathConfig, assetsPathRelativeToBuildRoot: String) : + GoldenPathManager( appContext = InstrumentationRegistry.getInstrumentation().context, assetsPathRelativeToBuildRoot = assetsPathRelativeToBuildRoot, deviceLocalPath = - InstrumentationRegistry.getInstrumentation() - .targetContext - .filesDir - .absolutePath - .toString() + "/settings_screenshots", + InstrumentationRegistry.getInstrumentation() + .targetContext + .filesDir + .absolutePath + .toString() + "/settings_screenshots", pathConfig = pathConfig, ) { override fun toString(): String { // This string is appended to all actual/expected screenshots on the device, so make sure // it is a static value. - return "SettingsGoldenImagePathManager" + return "SettingsGoldenPathManager" } } diff --git a/packages/SettingsLib/Spa/screenshot/src/com/android/settingslib/spa/screenshot/util/SettingsScreenshotTestRule.kt b/packages/SettingsLib/Spa/screenshot/src/com/android/settingslib/spa/screenshot/util/SettingsScreenshotTestRule.kt index ae85675ab1b8..16f6b5e773c9 100644 --- a/packages/SettingsLib/Spa/screenshot/src/com/android/settingslib/spa/screenshot/util/SettingsScreenshotTestRule.kt +++ b/packages/SettingsLib/Spa/screenshot/src/com/android/settingslib/spa/screenshot/util/SettingsScreenshotTestRule.kt @@ -44,7 +44,7 @@ class SettingsScreenshotTestRule( private val deviceEmulationRule = DeviceEmulationRule(emulationSpec) private val screenshotRule = ScreenshotTestRule( - SettingsGoldenImagePathManager( + SettingsGoldenPathManager( getEmulatedDevicePathConfig(emulationSpec), assetsPathRelativeToBuildRoot ) diff --git a/tests/InputScreenshotTest/src/android/input/screenshot/InputGoldenImagePathManager.kt b/tests/InputScreenshotTest/src/android/input/screenshot/InputGoldenPathManager.kt index 8faf22440828..9f14b136861f 100644 --- a/tests/InputScreenshotTest/src/android/input/screenshot/InputGoldenImagePathManager.kt +++ b/tests/InputScreenshotTest/src/android/input/screenshot/InputGoldenPathManager.kt @@ -17,28 +17,25 @@ package com.android.input.screenshot import androidx.test.platform.app.InstrumentationRegistry -import platform.test.screenshot.GoldenImagePathManager +import platform.test.screenshot.GoldenPathManager import platform.test.screenshot.PathConfig -/** A [GoldenImagePathManager] that should be used for all Input screenshot tests. */ -class InputGoldenImagePathManager( - pathConfig: PathConfig, - assetsPathRelativeToBuildRoot: String -) : - GoldenImagePathManager( - appContext = InstrumentationRegistry.getInstrumentation().context, - assetsPathRelativeToBuildRoot = assetsPathRelativeToBuildRoot, - deviceLocalPath = - InstrumentationRegistry.getInstrumentation() - .targetContext - .filesDir - .absolutePath - .toString() + "/input_screenshots", - pathConfig = pathConfig, - ) { +/** A [GoldenPathManager] that should be used for all Input screenshot tests. */ +class InputGoldenPathManager(pathConfig: PathConfig, assetsPathRelativeToBuildRoot: String) : + GoldenPathManager( + appContext = InstrumentationRegistry.getInstrumentation().context, + assetsPathRelativeToBuildRoot = assetsPathRelativeToBuildRoot, + deviceLocalPath = + InstrumentationRegistry.getInstrumentation() + .targetContext + .filesDir + .absolutePath + .toString() + "/input_screenshots", + pathConfig = pathConfig, + ) { override fun toString(): String { // This string is appended to all actual/expected screenshots on the device, so make sure // it is a static value. - return "InputGoldenImagePathManager" + return "InputGoldenPathManager" } -}
\ No newline at end of file +} diff --git a/tests/InputScreenshotTest/src/android/input/screenshot/InputScreenshotTestRule.kt b/tests/InputScreenshotTest/src/android/input/screenshot/InputScreenshotTestRule.kt index 75dab41d3609..2f408964fd8c 100644 --- a/tests/InputScreenshotTest/src/android/input/screenshot/InputScreenshotTestRule.kt +++ b/tests/InputScreenshotTest/src/android/input/screenshot/InputScreenshotTestRule.kt @@ -44,7 +44,7 @@ class InputScreenshotTestRule( private val deviceEmulationRule = DeviceEmulationRule(emulationSpec) private val screenshotRule = ScreenshotTestRule( - InputGoldenImagePathManager( + InputGoldenPathManager( getEmulatedDevicePathConfig(emulationSpec), assetsPathRelativeToBuildRoot ) |