Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: build/android/pylib/device/device_utils_test.py

Issue 1167693002: remove stale test data on the device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove stale data from device Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/android/pylib/device/device_utils_test.py
diff --git a/build/android/pylib/device/device_utils_test.py b/build/android/pylib/device/device_utils_test.py
index 317e81e83b619ea83afa8b93c9cab6767a8c1159..90d1143ee1a84059d4df60713268b1a01cab8dc6 100755
--- a/build/android/pylib/device/device_utils_test.py
+++ b/build/android/pylib/device/device_utils_test.py
@@ -510,9 +510,10 @@ class DeviceUtilsInstallTest(DeviceUtilsTest):
'this.is.a.test.package'),
(self.call.device.GetApplicationPath('this.is.a.test.package'),
'/fake/data/app/this.is.a.test.package.apk'),
- (self.call.device._GetChangedFilesImpl(
+ (self.call.device._GetChangedAndStaleFiles(
'/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk'),
- [('/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk')]),
+ ([('/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk')],
+ [])),
self.call.adb.Uninstall('this.is.a.test.package'),
self.call.adb.Install('/fake/test/app.apk', reinstall=False)):
self.device.Install('/fake/test/app.apk', retries=0)
@@ -523,9 +524,10 @@ class DeviceUtilsInstallTest(DeviceUtilsTest):
'this.is.a.test.package'),
(self.call.device.GetApplicationPath('this.is.a.test.package'),
'/fake/data/app/this.is.a.test.package.apk'),
- (self.call.device._GetChangedFilesImpl(
+ (self.call.device._GetChangedAndStaleFiles(
'/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk'),
- [('/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk')]),
+ ([('/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk')],
+ [])),
self.call.adb.Install('/fake/test/app.apk', reinstall=True)):
self.device.Install('/fake/test/app.apk', reinstall=True, retries=0)
@@ -535,9 +537,9 @@ class DeviceUtilsInstallTest(DeviceUtilsTest):
'this.is.a.test.package'),
(self.call.device.GetApplicationPath('this.is.a.test.package'),
'/fake/data/app/this.is.a.test.package.apk'),
- (self.call.device._GetChangedFilesImpl(
+ (self.call.device._GetChangedAndStaleFiles(
'/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk'),
- [])):
+ ([],[]))):
self.device.Install('/fake/test/app.apk', retries=0)
def testInstall_fails(self):
@@ -1155,6 +1157,25 @@ class DeviceUtilsPushChangedFilesZippedTest(DeviceUtilsTest):
[('/test/host/path/file1', '/test/device/path/file1'),
('/test/host/path/file2', '/test/device/path/file2')])
+class DeviceUtilsDeleteStaleFilesTest(DeviceUtilsTest):
+
+ def testDeleteStaleFiles_emtpy(self):
+ files = []
+ with self.assertCalls():
+ self.device._DeleteStaleFiles(files)
+
+ def testDeleteStaleFiles_single(self):
+ files = ['/test/device/path/file1']
+ with self.assertCalls((self.call.adb.Shell(
+ 'rm /test/device/path/file1'), '')):
+ self.device._DeleteStaleFiles(files)
+
+ def testDeleteStaleFiles_multiple(self):
+ files = ['/test/device/path/file1', '/test/device/path/file2']
+ with self.assertCalls(
+ (self.call.adb.Shell('rm /test/device/path/file1'), ''),
+ (self.call.adb.Shell('rm /test/device/path/file2'), '')):
+ self.device._DeleteStaleFiles(files)
class DeviceUtilsFileExistsTest(DeviceUtilsTest):

Powered by Google App Engine
This is Rietveld 408576698