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

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

Issue 1254843002: telemetry: Fix killing the perf profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring. Created 5 years, 5 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 6699673431d3f4150e5ecdd60b762333e2c17993..172dd55a409d67abe009dc061714d9b9aa9ef1c5 100755
--- a/build/android/pylib/device/device_utils_test.py
+++ b/build/android/pylib/device/device_utils_test.py
@@ -823,33 +823,39 @@ class DeviceUtilsRunPipedShellCommandTest(DeviceUtilsTest):
class DeviceUtilsKillAllTest(DeviceUtilsTest):
def testKillAll_noMatchingProcessesFailure(self):
- with self.assertCall(self.call.device.GetPids('test_process'), {}):
+ with self.assertCall(self.call.device._GetProcessPidPairs('test_process'),
+ []):
with self.assertRaises(device_errors.CommandFailedError):
self.device.KillAll('test_process')
def testKillAll_noMatchingProcessesQuiet(self):
- with self.assertCall(self.call.device.GetPids('test_process'), {}):
+ with self.assertCall(self.call.device._GetProcessPidPairs('test_process'),
+ []):
self.assertEqual(0, self.device.KillAll('test_process', quiet=True))
def testKillAll_nonblocking(self):
with self.assertCalls(
- (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
+ (self.call.device._GetProcessPidPairs('some.process'),
+ [('some.process', '1234')]),
(self.call.adb.Shell('kill -9 1234'), '')):
self.assertEquals(
1, self.device.KillAll('some.process', blocking=False))
def testKillAll_blocking(self):
with self.assertCalls(
- (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
+ (self.call.device._GetProcessPidPairs('some.process'),
+ [('some.process', '1234')]),
(self.call.adb.Shell('kill -9 1234'), ''),
- (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
- (self.call.device.GetPids('some.process'), [])):
+ (self.call.device._GetProcessPidPairs('some.process'),
+ [('some.process', '1234')]),
+ (self.call.device._GetProcessPidPairs('some.process'), [])):
self.assertEquals(
1, self.device.KillAll('some.process', blocking=True))
def testKillAll_root(self):
with self.assertCalls(
- (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
+ (self.call.device._GetProcessPidPairs('some.process'),
+ [('some.process', '1234')]),
(self.call.device.NeedsSU(), True),
(self.call.adb.Shell("su -c sh -c 'kill -9 1234'"), '')):
self.assertEquals(
@@ -857,11 +863,20 @@ class DeviceUtilsKillAllTest(DeviceUtilsTest):
def testKillAll_sigterm(self):
with self.assertCalls(
- (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
+ (self.call.device._GetProcessPidPairs('some.process'),
+ [('some.process', '1234')]),
(self.call.adb.Shell('kill -15 1234'), '')):
self.assertEquals(
1, self.device.KillAll('some.process', signum=device_signal.SIGTERM))
+ def testKillAll_multipleInstances(self):
+ with self.assertCalls(
+ (self.call.device._GetProcessPidPairs('some.process'),
+ [('some.process', '1234'), ('some.process', '4567')]),
+ (self.call.adb.Shell('kill -15 1234 4567'), '')):
+ self.assertEquals(
+ 2, self.device.KillAll('some.process', signum=device_signal.SIGTERM))
+
class DeviceUtilsStartActivityTest(DeviceUtilsTest):

Powered by Google App Engine
This is Rietveld 408576698