summaryrefslogtreecommitdiff
path: root/tests/PhotoPicker/src/android/photopicker/cts/RemoteVideoPreviewTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/PhotoPicker/src/android/photopicker/cts/RemoteVideoPreviewTest.java')
-rw-r--r--tests/PhotoPicker/src/android/photopicker/cts/RemoteVideoPreviewTest.java28
1 files changed, 8 insertions, 20 deletions
diff --git a/tests/PhotoPicker/src/android/photopicker/cts/RemoteVideoPreviewTest.java b/tests/PhotoPicker/src/android/photopicker/cts/RemoteVideoPreviewTest.java
index 48c4a1dabfa..67661d93171 100644
--- a/tests/PhotoPicker/src/android/photopicker/cts/RemoteVideoPreviewTest.java
+++ b/tests/PhotoPicker/src/android/photopicker/cts/RemoteVideoPreviewTest.java
@@ -15,10 +15,9 @@
*/
package android.photopicker.cts;
-import static android.photopicker.cts.PhotoPickerCloudUtils.disableCloudMediaAndClearAllowedCloudProviders;
+
+import static android.photopicker.cts.PhotoPickerCloudUtils.disableDeviceConfigSync;
import static android.photopicker.cts.PhotoPickerCloudUtils.enableCloudMediaAndSetAllowedCloudProviders;
-import static android.photopicker.cts.PhotoPickerCloudUtils.getAllowedProvidersDeviceConfig;
-import static android.photopicker.cts.PhotoPickerCloudUtils.isCloudMediaEnabled;
import static android.photopicker.cts.PickerProviderMediaGenerator.syncCloudProvider;
import static android.photopicker.cts.util.PhotoPickerFilesUtils.deleteMedia;
import static android.photopicker.cts.util.PhotoPickerUiUtils.REGEX_PACKAGE_NAME;
@@ -77,7 +76,7 @@ import java.util.List;
@RunWith(AndroidJUnit4.class)
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.S)
public class RemoteVideoPreviewTest extends PhotoPickerBaseTest {
-
+ private static final String TAG = RemoteVideoPreviewTest.class.getSimpleName();
private MediaGenerator mCloudPrimaryMediaGenerator;
private final List<Uri> mUriList = new ArrayList<>();
@@ -92,19 +91,14 @@ public class RemoteVideoPreviewTest extends PhotoPickerBaseTest {
private CloudMediaSurfaceControllerImpl mSurfaceControllerListener;
// This is required to assert the order in which the APIs are called.
private InOrder mAssertInOrder;
- private static boolean sCloudMediaPreviouslyEnabled;
- private static String sPreviouslyAllowedCloudProviders;
@Nullable
- private static String sPreviouslySetCloudProvider;
+ private static DeviceStatePreserver sDeviceStatePreserver;
@BeforeClass
public static void setUpBeforeClass() throws IOException {
- // Store the current CMP configs, so that we can reset them at the end of the test.
- sCloudMediaPreviouslyEnabled = isCloudMediaEnabled();
- if (sCloudMediaPreviouslyEnabled) {
- sPreviouslyAllowedCloudProviders = getAllowedProvidersDeviceConfig();
- }
- sPreviouslySetCloudProvider = getCurrentCloudProvider();
+ sDeviceStatePreserver = new DeviceStatePreserver(sDevice);
+ sDeviceStatePreserver.saveCurrentCloudProviderState();
+ disableDeviceConfigSync();
// This is a self-instrumentation test, so both "target" package name and "own" package name
// should be the same (android.photopicker.cts).
@@ -113,13 +107,7 @@ public class RemoteVideoPreviewTest extends PhotoPickerBaseTest {
@AfterClass
public static void tearDownClass() throws Exception {
- // Reset CloudMedia configs.
- if (sCloudMediaPreviouslyEnabled) {
- enableCloudMediaAndSetAllowedCloudProviders(sPreviouslyAllowedCloudProviders);
- } else {
- disableCloudMediaAndClearAllowedCloudProviders();
- }
- setCloudProvider(sPreviouslySetCloudProvider);
+ sDeviceStatePreserver.restoreCloudProviderState();
}
@Before