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

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: 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..c77c1977ec8dcc560cbfdbbe0895c2a132238713 100755
--- a/build/android/pylib/device/device_utils_test.py
+++ b/build/android/pylib/device/device_utils_test.py
@@ -823,33 +823,40 @@ 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.GetPids('test_process', multiple_instances=True), {}):
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.GetPids('test_process', multiple_instances=True), {}):
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.GetPids('some.process', multiple_instances=True),
+ {'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.GetPids('some.process', multiple_instances=True),
+ {'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.GetPids('some.process', multiple_instances=True),
+ {'some.process': ['1234']}),
+ (self.call.device.GetPids('some.process', multiple_instances=True),
+ {})):
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.GetPids('some.process', multiple_instances=True),
+ {'some.process': ['1234']}),
(self.call.device.NeedsSU(), True),
(self.call.adb.Shell("su -c sh -c 'kill -9 1234'"), '')):
self.assertEquals(
@@ -857,11 +864,20 @@ class DeviceUtilsKillAllTest(DeviceUtilsTest):
def testKillAll_sigterm(self):
with self.assertCalls(
- (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
+ (self.call.device.GetPids('some.process', multiple_instances=True),
+ {'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.GetPids('some.process', multiple_instances=True),
+ {'some.process': ['1234', '4567']}),
+ (self.call.adb.Shell('kill -15 1234 4567'), '')):
+ self.assertEquals(
+ 2, self.device.KillAll('some.process', signum=device_signal.SIGTERM))
+
class DeviceUtilsStartActivityTest(DeviceUtilsTest):
@@ -1667,7 +1683,7 @@ class DeviceUtilsGetPidsTest(DeviceUtilsTest):
['user 1001 100 1024 1024 ffffffff 00000000 one.match']):
self.assertEqual({'one.match': '1001'}, self.device.GetPids('one.match'))
- def testGetPids_mutlipleMatches(self):
+ def testGetPids_multipleMatches(self):
with self.assertCall(
self.call.device._RunPipedShellCommand('ps | grep -F match'),
['user 1001 100 1024 1024 ffffffff 00000000 one.match',
@@ -1693,6 +1709,15 @@ class DeviceUtilsGetPidsTest(DeviceUtilsTest):
self.assertEqual(
{'my$process': '1234'}, self.device.GetPids('my$process'))
+ def testGetPids_multipleInstances(self):
+ with self.assertCall(
+ self.call.device._RunPipedShellCommand("ps | grep -F process"),
+ ['user 1234 100 1024 1024 ffffffff 00000000 process',
+ 'user 4567 100 1024 1024 ffffffff 00000000 process']):
+ self.assertEqual(
+ {'process': ['1234', '4567']},
+ self.device.GetPids('process', multiple_instances=True))
+
class DeviceUtilsTakeScreenshotTest(DeviceUtilsTest):

Powered by Google App Engine
This is Rietveld 408576698