Loading tests/functional/com/android/documentsui/FileCopyUiTest.java +17 −8 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.IntentFilter; import android.content.res.Resources; import android.content.res.Resources; import android.net.Uri; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Bundle; import android.os.RemoteException; import android.os.RemoteException; import android.os.SystemClock; import android.os.SystemClock; Loading Loading @@ -78,9 +77,11 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { mErrorReason = intent.getStringExtra( mErrorReason = intent.getStringExtra( TestNotificationService.EXTRA_ERROR_REASON); TestNotificationService.EXTRA_ERROR_REASON); } } if (mCountDownLatch != null) { mCountDownLatch.countDown(); mCountDownLatch.countDown(); } } } } } }; }; private CountDownLatch mCountDownLatch; private CountDownLatch mCountDownLatch; Loading @@ -101,6 +102,8 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { private int mPreTestStayAwakeValue; private int mPreTestStayAwakeValue; private String mDeviceLabel; public FileCopyUiTest() { public FileCopyUiTest() { super(FilesActivity.class); super(FilesActivity.class); } } Loading @@ -124,6 +127,11 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { Settings.Global.STAY_ON_WHILE_PLUGGED_IN); Settings.Global.STAY_ON_WHILE_PLUGGED_IN); device.executeShellCommand("settings put global stay_on_while_plugged_in 3"); device.executeShellCommand("settings put global stay_on_while_plugged_in 3"); mDeviceLabel = Settings.Global.getString(context.getContentResolver(), Settings.Global.DEVICE_NAME); // If null or empty, use default name. mDeviceLabel = TextUtils.isEmpty(mDeviceLabel) ? "Internal Storage" : mDeviceLabel; // If Internal Storage is not shown, turn on. // If Internal Storage is not shown, turn on. State state = ((FilesActivity) getActivity()).getDisplayState(); State state = ((FilesActivity) getActivity()).getDisplayState(); if (!state.showAdvanced) { if (!state.showAdvanced) { Loading Loading @@ -161,7 +169,7 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { @Override @Override public void tearDown() throws Exception { public void tearDown() throws Exception { // Delete created files // Delete created files deleteDocuments(Build.MODEL); deleteDocuments(mDeviceLabel); deleteDocuments(mSdCardLabel); deleteDocuments(mSdCardLabel); if (mIsVirtualSdCard) { if (mIsVirtualSdCard) { Loading @@ -172,6 +180,7 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { + mPreTestStayAwakeValue); + mPreTestStayAwakeValue); context.unregisterReceiver(mReceiver); context.unregisterReceiver(mReceiver); mCountDownLatch = null; try { try { bots.notifications.setNotificationAccess(getActivity(), false); bots.notifications.setNotificationAccess(getActivity(), false); } catch (Exception e) { } catch (Exception e) { Loading Loading @@ -389,24 +398,24 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { @HugeLongTest @HugeLongTest public void testCopyDocuments_FromSdCard() throws Exception { public void testCopyDocuments_FromSdCard() throws Exception { createDocuments(mSdCardLabel, mSdCardRoot, mStorageDocsHelper); createDocuments(mSdCardLabel, mSdCardRoot, mStorageDocsHelper); copyFiles(mSdCardLabel, Build.MODEL); copyFiles(mSdCardLabel, mDeviceLabel); // Check that original folder exists // Check that original folder exists bots.roots.openRoot(mSdCardLabel); bots.roots.openRoot(mSdCardLabel); bots.directory.assertDocumentsPresent(TARGET_FOLDER); bots.directory.assertDocumentsPresent(TARGET_FOLDER); // Check that copied files exist // Check that copied files exist assertFilesCopied(Build.MODEL, mPrimaryRoot, mStorageDocsHelper); assertFilesCopied(mDeviceLabel, mPrimaryRoot, mStorageDocsHelper); } } // Copy Internal Storage -> SD Card // // Copy Internal Storage -> SD Card // @HugeLongTest @HugeLongTest public void testCopyDocuments_ToSdCard() throws Exception { public void testCopyDocuments_ToSdCard() throws Exception { createDocuments(Build.MODEL, mPrimaryRoot, mStorageDocsHelper); createDocuments(mDeviceLabel, mPrimaryRoot, mStorageDocsHelper); copyFiles(Build.MODEL, mSdCardLabel); copyFiles(mDeviceLabel, mSdCardLabel); // Check that original folder exists // Check that original folder exists bots.roots.openRoot(Build.MODEL); bots.roots.openRoot(mDeviceLabel); bots.directory.assertDocumentsPresent(TARGET_FOLDER); bots.directory.assertDocumentsPresent(TARGET_FOLDER); // Check that copied files exist // Check that copied files exist Loading tests/functional/com/android/documentsui/FileDeleteUiTest.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -66,9 +66,11 @@ public class FileDeleteUiTest extends ActivityTest<FilesActivity> { mErrorReason = intent.getStringExtra( mErrorReason = intent.getStringExtra( TestNotificationService.EXTRA_ERROR_REASON); TestNotificationService.EXTRA_ERROR_REASON); } } if (mCountDownLatch != null) { mCountDownLatch.countDown(); mCountDownLatch.countDown(); } } } } } }; }; private CountDownLatch mCountDownLatch; private CountDownLatch mCountDownLatch; Loading Loading @@ -111,10 +113,8 @@ public class FileDeleteUiTest extends ActivityTest<FilesActivity> { @Override @Override public void tearDown() throws Exception { public void tearDown() throws Exception { mCountDownLatch.countDown(); mCountDownLatch = null; context.unregisterReceiver(mReceiver); context.unregisterReceiver(mReceiver); mCountDownLatch = null; try { try { bots.notifications.setNotificationAccess(getActivity(), false); bots.notifications.setNotificationAccess(getActivity(), false); } catch (Exception e) { } catch (Exception e) { Loading Loading
tests/functional/com/android/documentsui/FileCopyUiTest.java +17 −8 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.IntentFilter; import android.content.res.Resources; import android.content.res.Resources; import android.net.Uri; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Bundle; import android.os.RemoteException; import android.os.RemoteException; import android.os.SystemClock; import android.os.SystemClock; Loading Loading @@ -78,9 +77,11 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { mErrorReason = intent.getStringExtra( mErrorReason = intent.getStringExtra( TestNotificationService.EXTRA_ERROR_REASON); TestNotificationService.EXTRA_ERROR_REASON); } } if (mCountDownLatch != null) { mCountDownLatch.countDown(); mCountDownLatch.countDown(); } } } } } }; }; private CountDownLatch mCountDownLatch; private CountDownLatch mCountDownLatch; Loading @@ -101,6 +102,8 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { private int mPreTestStayAwakeValue; private int mPreTestStayAwakeValue; private String mDeviceLabel; public FileCopyUiTest() { public FileCopyUiTest() { super(FilesActivity.class); super(FilesActivity.class); } } Loading @@ -124,6 +127,11 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { Settings.Global.STAY_ON_WHILE_PLUGGED_IN); Settings.Global.STAY_ON_WHILE_PLUGGED_IN); device.executeShellCommand("settings put global stay_on_while_plugged_in 3"); device.executeShellCommand("settings put global stay_on_while_plugged_in 3"); mDeviceLabel = Settings.Global.getString(context.getContentResolver(), Settings.Global.DEVICE_NAME); // If null or empty, use default name. mDeviceLabel = TextUtils.isEmpty(mDeviceLabel) ? "Internal Storage" : mDeviceLabel; // If Internal Storage is not shown, turn on. // If Internal Storage is not shown, turn on. State state = ((FilesActivity) getActivity()).getDisplayState(); State state = ((FilesActivity) getActivity()).getDisplayState(); if (!state.showAdvanced) { if (!state.showAdvanced) { Loading Loading @@ -161,7 +169,7 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { @Override @Override public void tearDown() throws Exception { public void tearDown() throws Exception { // Delete created files // Delete created files deleteDocuments(Build.MODEL); deleteDocuments(mDeviceLabel); deleteDocuments(mSdCardLabel); deleteDocuments(mSdCardLabel); if (mIsVirtualSdCard) { if (mIsVirtualSdCard) { Loading @@ -172,6 +180,7 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { + mPreTestStayAwakeValue); + mPreTestStayAwakeValue); context.unregisterReceiver(mReceiver); context.unregisterReceiver(mReceiver); mCountDownLatch = null; try { try { bots.notifications.setNotificationAccess(getActivity(), false); bots.notifications.setNotificationAccess(getActivity(), false); } catch (Exception e) { } catch (Exception e) { Loading Loading @@ -389,24 +398,24 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { @HugeLongTest @HugeLongTest public void testCopyDocuments_FromSdCard() throws Exception { public void testCopyDocuments_FromSdCard() throws Exception { createDocuments(mSdCardLabel, mSdCardRoot, mStorageDocsHelper); createDocuments(mSdCardLabel, mSdCardRoot, mStorageDocsHelper); copyFiles(mSdCardLabel, Build.MODEL); copyFiles(mSdCardLabel, mDeviceLabel); // Check that original folder exists // Check that original folder exists bots.roots.openRoot(mSdCardLabel); bots.roots.openRoot(mSdCardLabel); bots.directory.assertDocumentsPresent(TARGET_FOLDER); bots.directory.assertDocumentsPresent(TARGET_FOLDER); // Check that copied files exist // Check that copied files exist assertFilesCopied(Build.MODEL, mPrimaryRoot, mStorageDocsHelper); assertFilesCopied(mDeviceLabel, mPrimaryRoot, mStorageDocsHelper); } } // Copy Internal Storage -> SD Card // // Copy Internal Storage -> SD Card // @HugeLongTest @HugeLongTest public void testCopyDocuments_ToSdCard() throws Exception { public void testCopyDocuments_ToSdCard() throws Exception { createDocuments(Build.MODEL, mPrimaryRoot, mStorageDocsHelper); createDocuments(mDeviceLabel, mPrimaryRoot, mStorageDocsHelper); copyFiles(Build.MODEL, mSdCardLabel); copyFiles(mDeviceLabel, mSdCardLabel); // Check that original folder exists // Check that original folder exists bots.roots.openRoot(Build.MODEL); bots.roots.openRoot(mDeviceLabel); bots.directory.assertDocumentsPresent(TARGET_FOLDER); bots.directory.assertDocumentsPresent(TARGET_FOLDER); // Check that copied files exist // Check that copied files exist Loading
tests/functional/com/android/documentsui/FileDeleteUiTest.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -66,9 +66,11 @@ public class FileDeleteUiTest extends ActivityTest<FilesActivity> { mErrorReason = intent.getStringExtra( mErrorReason = intent.getStringExtra( TestNotificationService.EXTRA_ERROR_REASON); TestNotificationService.EXTRA_ERROR_REASON); } } if (mCountDownLatch != null) { mCountDownLatch.countDown(); mCountDownLatch.countDown(); } } } } } }; }; private CountDownLatch mCountDownLatch; private CountDownLatch mCountDownLatch; Loading Loading @@ -111,10 +113,8 @@ public class FileDeleteUiTest extends ActivityTest<FilesActivity> { @Override @Override public void tearDown() throws Exception { public void tearDown() throws Exception { mCountDownLatch.countDown(); mCountDownLatch = null; context.unregisterReceiver(mReceiver); context.unregisterReceiver(mReceiver); mCountDownLatch = null; try { try { bots.notifications.setNotificationAccess(getActivity(), false); bots.notifications.setNotificationAccess(getActivity(), false); } catch (Exception e) { } catch (Exception e) { Loading