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

Side by Side Diff: build/android/pylib/device/device_utils_test.py

Issue 1077173002: [Android] Tune DeviceUtils commands that are prone to large outputs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: perezju comments Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """ 6 """
7 Unit tests for the contents of device_utils.py (mostly DeviceUtils). 7 Unit tests for the contents of device_utils.py (mostly DeviceUtils).
8 """ 8 """
9 9
10 # pylint: disable=C0321 10 # pylint: disable=C0321
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 with self.assertCalls( 613 with self.assertCalls(
614 (self.call.adb.Shell(cmd), self.ShellError('', None)), 614 (self.call.adb.Shell(cmd), self.ShellError('', None)),
615 (mock.call.pylib.utils.device_temp_file.DeviceTempFile(self.adb), 615 (mock.call.pylib.utils.device_temp_file.DeviceTempFile(self.adb),
616 temp_file), 616 temp_file),
617 (self.call.adb.Shell(cmd_redirect)), 617 (self.call.adb.Shell(cmd_redirect)),
618 (self.call.device.ReadFile(mock.ANY), 'something')): 618 (self.call.device.ReadFile(mock.ANY), 'something')):
619 self.assertEquals(['something'], 619 self.assertEquals(['something'],
620 self.device.RunShellCommand(cmd, check_return=True)) 620 self.device.RunShellCommand(cmd, check_return=True))
621 621
622 622
623 class DeviceUtilsRunPipedShellCommandTest(DeviceUtilsTest):
624
625 def testRunPipedShellCommand_success(self):
626 with self.assertCall(
627 self.call.device.RunShellCommand(
628 'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"'),
629 ['This line contains foo', 'PIPESTATUS: 0 0']):
630 self.assertEquals(['This line contains foo'],
631 self.device._RunPipedShellCommand('ps | grep foo'))
632
633 def testRunPipedShellCommand_firstCommandFails(self):
634 with self.assertCall(
635 self.call.device.RunShellCommand(
636 'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"'),
637 ['PIPESTATUS: 1 0']):
638 with self.assertRaises(device_errors.AdbShellCommandFailedError) as ec:
639 self.device._RunPipedShellCommand('ps | grep foo')
640 self.assertEquals([1, 0], ec.exception.status)
641
642 def testRunPipedShellCommand_secondCommandFails(self):
643 with self.assertCall(
644 self.call.device.RunShellCommand(
645 'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"'),
646 ['PIPESTATUS: 0 1']):
647 with self.assertRaises(device_errors.AdbShellCommandFailedError) as ec:
648 self.device._RunPipedShellCommand('ps | grep foo')
649 self.assertEquals([0, 1], ec.exception.status)
650
651 def testRunPipedShellCommand_outputCutOff(self):
652 with self.assertCall(
653 self.call.device.RunShellCommand(
654 'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"'),
655 ['foo.bar'] * 256 + ['foo.ba']):
656 with self.assertRaises(device_errors.AdbShellCommandFailedError) as ec:
657 self.device._RunPipedShellCommand('ps | grep foo')
658 self.assertIs(None, ec.exception.status)
659
660
623 class DeviceUtilsGetDevicePieWrapper(DeviceUtilsTest): 661 class DeviceUtilsGetDevicePieWrapper(DeviceUtilsTest):
624 662
625 def testGetDevicePieWrapper_jb(self): 663 def testGetDevicePieWrapper_jb(self):
626 with self.assertCall( 664 with self.assertCall(
627 self.call.device.build_version_sdk(), 665 self.call.device.build_version_sdk(),
628 constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN): 666 constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN):
629 self.assertEqual('', self.device.GetDevicePieWrapper()) 667 self.assertEqual('', self.device.GetDevicePieWrapper())
630 668
631 def testGetDevicePieWrapper_ics(self): 669 def testGetDevicePieWrapper_ics(self):
632 with self.assertCalls( 670 with self.assertCalls(
633 (self.call.device.build_version_sdk(), 671 (self.call.device.build_version_sdk(),
634 constants.ANDROID_SDK_VERSION_CODES.ICE_CREAM_SANDWICH), 672 constants.ANDROID_SDK_VERSION_CODES.ICE_CREAM_SANDWICH),
635 (mock.call.pylib.constants.GetOutDirectory(), '/foo/bar'), 673 (mock.call.pylib.constants.GetOutDirectory(), '/foo/bar'),
636 (mock.call.os.path.exists(mock.ANY), True), 674 (mock.call.os.path.exists(mock.ANY), True),
637 (self.call.adb.Push(mock.ANY, mock.ANY), '')): 675 (self.call.adb.Push(mock.ANY, mock.ANY), '')):
638 self.assertNotEqual('', self.device.GetDevicePieWrapper()) 676 self.assertNotEqual('', self.device.GetDevicePieWrapper())
639 677
640 678
641 @mock.patch('time.sleep', mock.Mock()) 679 @mock.patch('time.sleep', mock.Mock())
642 class DeviceUtilsKillAllTest(DeviceUtilsTest): 680 class DeviceUtilsKillAllTest(DeviceUtilsTest):
643 681
644 def testKillAll_noMatchingProcesses(self): 682 def testKillAll_noMatchingProcesses(self):
645 with self.assertCall(self.call.adb.Shell('ps'), 683 with self.assertCall(self.call.device.GetPids('test_process'), []):
646 'USER PID PPID VSIZE RSS WCHAN PC NAME\n'):
647 with self.assertRaises(device_errors.CommandFailedError): 684 with self.assertRaises(device_errors.CommandFailedError):
648 self.device.KillAll('test_process') 685 self.device.KillAll('test_process')
649 686
650 def testKillAll_nonblocking(self): 687 def testKillAll_nonblocking(self):
651 with self.assertCalls( 688 with self.assertCalls(
652 (self.call.adb.Shell('ps'), 689 (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
653 'USER PID PPID VSIZE RSS WCHAN PC NAME\n'
654 'u0_a1 1234 174 123456 54321 ffffffff 456789ab some.process\n'),
655 (self.call.adb.Shell('kill -9 1234'), '')): 690 (self.call.adb.Shell('kill -9 1234'), '')):
656 self.assertEquals(1, 691 self.assertEquals(
657 self.device.KillAll('some.process', blocking=False)) 692 1, self.device.KillAll('some.process', blocking=False))
658 693
659 def testKillAll_blocking(self): 694 def testKillAll_blocking(self):
660 with self.assertCalls( 695 with self.assertCalls(
661 (self.call.adb.Shell('ps'), 696 (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
662 'USER PID PPID VSIZE RSS WCHAN PC NAME\n'
663 'u0_a1 1234 174 123456 54321 ffffffff 456789ab some.process\n'),
664 (self.call.adb.Shell('kill -9 1234'), ''), 697 (self.call.adb.Shell('kill -9 1234'), ''),
665 (self.call.adb.Shell('ps'), 698 (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
666 'USER PID PPID VSIZE RSS WCHAN PC NAME\n' 699 (self.call.device.GetPids('some.process'), [])):
667 'u0_a1 1234 174 123456 54321 ffffffff 456789ab some.process\n'), 700 self.assertEquals(
668 (self.call.adb.Shell('ps'), 701 1, self.device.KillAll('some.process', blocking=True))
669 'USER PID PPID VSIZE RSS WCHAN PC NAME\n')):
670 self.assertEquals(1,
671 self.device.KillAll('some.process', blocking=True))
672 702
673 def testKillAll_root(self): 703 def testKillAll_root(self):
674 with self.assertCalls( 704 with self.assertCalls(
675 (self.call.adb.Shell('ps'), 705 (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
676 'USER PID PPID VSIZE RSS WCHAN PC NAME\n'
677 'u0_a1 1234 174 123456 54321 ffffffff 456789ab some.process\n'),
678 (self.call.device.NeedsSU(), True), 706 (self.call.device.NeedsSU(), True),
679 (self.call.adb.Shell("su -c sh -c 'kill -9 1234'"), '')): 707 (self.call.adb.Shell("su -c sh -c 'kill -9 1234'"), '')):
680 self.assertEquals(1, 708 self.assertEquals(
681 self.device.KillAll('some.process', as_root=True)) 709 1, self.device.KillAll('some.process', as_root=True))
682 710
683 def testKillAll_sigterm(self): 711 def testKillAll_sigterm(self):
684 with self.assertCalls( 712 with self.assertCalls(
685 (self.call.adb.Shell('ps'), 713 (self.call.device.GetPids('some.process'), {'some.process': '1234'}),
686 'USER PID PPID VSIZE RSS WCHAN PC NAME\n'
687 'u0_a1 1234 174 123456 54321 ffffffff 456789ab some.process\n'),
688 (self.call.adb.Shell('kill -15 1234'), '')): 714 (self.call.adb.Shell('kill -15 1234'), '')):
689 self.assertEquals(1, 715 self.assertEquals(
690 self.device.KillAll('some.process', signum=signal.SIGTERM)) 716 1, self.device.KillAll('some.process', signum=signal.SIGTERM))
691 717
692 718
693 class DeviceUtilsStartActivityTest(DeviceUtilsTest): 719 class DeviceUtilsStartActivityTest(DeviceUtilsTest):
694 720
695 def testStartActivity_actionOnly(self): 721 def testStartActivity_actionOnly(self):
696 test_intent = intent.Intent(action='android.intent.action.VIEW') 722 test_intent = intent.Intent(action='android.intent.action.VIEW')
697 with self.assertCall( 723 with self.assertCall(
698 self.call.adb.Shell('am start ' 724 self.call.adb.Shell('am start '
699 '-a android.intent.action.VIEW'), 725 '-a android.intent.action.VIEW'),
700 'Starting: Intent { act=android.intent.action.VIEW }'): 726 'Starting: Intent { act=android.intent.action.VIEW }'):
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 with self.assertRaises(device_errors.CommandFailedError): 1134 with self.assertRaises(device_errors.CommandFailedError):
1109 self.device._ReadFileWithPull('/path/to/device/file') 1135 self.device._ReadFileWithPull('/path/to/device/file')
1110 1136
1111 def testReadFile_exists(self): 1137 def testReadFile_exists(self):
1112 with self.assertCalls( 1138 with self.assertCalls(
1113 (self.call.device.RunShellCommand( 1139 (self.call.device.RunShellCommand(
1114 ['ls', '-l', '/read/this/test/file'], 1140 ['ls', '-l', '/read/this/test/file'],
1115 as_root=False, check_return=True), 1141 as_root=False, check_return=True),
1116 ['-rw-rw---- root foo 256 1970-01-01 00:00 file']), 1142 ['-rw-rw---- root foo 256 1970-01-01 00:00 file']),
1117 (self.call.device.RunShellCommand( 1143 (self.call.device.RunShellCommand(
1118 ['cat', '/read/this/test/file'], as_root=False, check_return=True), 1144 ['cat', '/read/this/test/file'],
1145 as_root=False, check_return=True),
1119 ['this is a test file'])): 1146 ['this is a test file'])):
1120 self.assertEqual('this is a test file\n', 1147 self.assertEqual('this is a test file\n',
1121 self.device.ReadFile('/read/this/test/file')) 1148 self.device.ReadFile('/read/this/test/file'))
1122 1149
1123 def testReadFile_doesNotExist(self): 1150 def testReadFile_doesNotExist(self):
1124 with self.assertCall( 1151 with self.assertCall(
1125 self.call.device.RunShellCommand( 1152 self.call.device.RunShellCommand(
1126 ['ls', '-l', '/this/file/does.not.exist'], 1153 ['ls', '-l', '/this/file/does.not.exist'],
1127 as_root=False, check_return=True), 1154 as_root=False, check_return=True),
1128 self.CommandError('File does not exist')): 1155 self.CommandError('File does not exist')):
1129 with self.assertRaises(device_errors.CommandFailedError): 1156 with self.assertRaises(device_errors.CommandFailedError):
1130 self.device.ReadFile('/this/file/does.not.exist') 1157 self.device.ReadFile('/this/file/does.not.exist')
1131 1158
1159 def testReadFile_zeroSize(self):
1160 with self.assertCalls(
1161 (self.call.device.RunShellCommand(
1162 ['ls', '-l', '/this/file/has/zero/size'],
1163 as_root=False, check_return=True),
1164 ['-r--r--r-- root foo 0 1970-01-01 00:00 zero_size_file']),
1165 (self.call.device._ReadFileWithPull('/this/file/has/zero/size'),
1166 'but it has contents\n')):
1167 self.assertEqual('but it has contents\n',
1168 self.device.ReadFile('/this/file/has/zero/size'))
1169
1132 def testReadFile_withSU(self): 1170 def testReadFile_withSU(self):
1133 with self.assertCalls( 1171 with self.assertCalls(
1134 (self.call.device.RunShellCommand( 1172 (self.call.device.RunShellCommand(
1135 ['ls', '-l', '/this/file/can.be.read.with.su'], 1173 ['ls', '-l', '/this/file/can.be.read.with.su'],
1136 as_root=True, check_return=True), 1174 as_root=True, check_return=True),
1137 ['-rw------- root root 256 1970-01-01 00:00 can.be.read.with.su']), 1175 ['-rw------- root root 256 1970-01-01 00:00 can.be.read.with.su']),
1138 (self.call.device.RunShellCommand( 1176 (self.call.device.RunShellCommand(
1139 ['cat', '/this/file/can.be.read.with.su'], 1177 ['cat', '/this/file/can.be.read.with.su'],
1140 as_root=True, check_return=True), 1178 as_root=True, check_return=True),
1141 ['this is a test file', 'read with su'])): 1179 ['this is a test file', 'read with su'])):
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 with self.assertCalls( 1418 with self.assertCalls(
1381 (self.call.adb.Shell('setprop test.property new_value'), ''), 1419 (self.call.adb.Shell('setprop test.property new_value'), ''),
1382 (self.call.adb.Shell('getprop test.property'), 'old_value')): 1420 (self.call.adb.Shell('getprop test.property'), 'old_value')):
1383 with self.assertRaises(device_errors.CommandFailedError): 1421 with self.assertRaises(device_errors.CommandFailedError):
1384 self.device.SetProp('test.property', 'new_value', check=True) 1422 self.device.SetProp('test.property', 'new_value', check=True)
1385 1423
1386 1424
1387 class DeviceUtilsGetPidsTest(DeviceUtilsTest): 1425 class DeviceUtilsGetPidsTest(DeviceUtilsTest):
1388 1426
1389 def testGetPids_noMatches(self): 1427 def testGetPids_noMatches(self):
1390 with self.assertCall(self.call.adb.Shell('ps'), 1428 with self.assertCall(
1391 'USER PID PPID VSIZE RSS WCHAN PC NAME\n' 1429 self.call.device._RunPipedShellCommand(
1392 'user 1000 100 1024 1024 ffffffff 00000000 no.match\n'): 1430 "'ps | grep -F does.not.match'", check_return=False),
1431 []):
1393 self.assertEqual({}, self.device.GetPids('does.not.match')) 1432 self.assertEqual({}, self.device.GetPids('does.not.match'))
1394 1433
1395 def testGetPids_oneMatch(self): 1434 def testGetPids_oneMatch(self):
1396 with self.assertCall(self.call.adb.Shell('ps'), 1435 with self.assertCall(
1397 'USER PID PPID VSIZE RSS WCHAN PC NAME\n' 1436 self.call.device._RunPipedShellCommand(
1398 'user 1000 100 1024 1024 ffffffff 00000000 not.a.match\n' 1437 "'ps | grep -F one.match'", check_return=False),
1399 'user 1001 100 1024 1024 ffffffff 00000000 one.match\n'): 1438 ['user 1001 100 1024 1024 ffffffff 00000000 one.match']):
1400 self.assertEqual({'one.match': '1001'}, self.device.GetPids('one.match')) 1439 self.assertEqual({'one.match': '1001'}, self.device.GetPids('one.match'))
1401 1440
1402 def testGetPids_mutlipleMatches(self): 1441 def testGetPids_mutlipleMatches(self):
1403 with self.assertCall(self.call.adb.Shell('ps'), 1442 with self.assertCall(
1404 'USER PID PPID VSIZE RSS WCHAN PC NAME\n' 1443 self.call.device._RunPipedShellCommand(
1405 'user 1000 100 1024 1024 ffffffff 00000000 not\n' 1444 "'ps | grep -F match'", check_return=False),
1406 'user 1001 100 1024 1024 ffffffff 00000000 one.match\n' 1445 ['user 1001 100 1024 1024 ffffffff 00000000 one.match',
1407 'user 1002 100 1024 1024 ffffffff 00000000 two.match\n' 1446 'user 1002 100 1024 1024 ffffffff 00000000 two.match',
1408 'user 1003 100 1024 1024 ffffffff 00000000 three.match\n'): 1447 'user 1003 100 1024 1024 ffffffff 00000000 three.match']):
1409 self.assertEqual( 1448 self.assertEqual(
1410 {'one.match': '1001', 'two.match': '1002', 'three.match': '1003'}, 1449 {'one.match': '1001', 'two.match': '1002', 'three.match': '1003'},
1411 self.device.GetPids('match')) 1450 self.device.GetPids('match'))
1412 1451
1413 def testGetPids_exactMatch(self): 1452 def testGetPids_exactMatch(self):
1414 with self.assertCall(self.call.adb.Shell('ps'), 1453 with self.assertCall(
1415 'USER PID PPID VSIZE RSS WCHAN PC NAME\n' 1454 self.call.device._RunPipedShellCommand(
1416 'user 1000 100 1024 1024 ffffffff 00000000 not.exact.match\n' 1455 "'ps | grep -F exact.match'", check_return=False),
1417 'user 1234 100 1024 1024 ffffffff 00000000 exact.match\n'): 1456 ['user 1000 100 1024 1024 ffffffff 00000000 not.exact.match',
1457 'user 1234 100 1024 1024 ffffffff 00000000 exact.match']):
1418 self.assertEqual( 1458 self.assertEqual(
1419 {'not.exact.match': '1000', 'exact.match': '1234'}, 1459 {'not.exact.match': '1000', 'exact.match': '1234'},
1420 self.device.GetPids('exact.match')) 1460 self.device.GetPids('exact.match'))
1421 1461
1422 1462
1423 class DeviceUtilsTakeScreenshotTest(DeviceUtilsTest): 1463 class DeviceUtilsTakeScreenshotTest(DeviceUtilsTest):
1424 1464
1425 def testTakeScreenshot_fileNameProvided(self): 1465 def testTakeScreenshot_fileNameProvided(self):
1426 with self.assertCalls( 1466 with self.assertCalls(
1427 (mock.call.pylib.utils.device_temp_file.DeviceTempFile( 1467 (mock.call.pylib.utils.device_temp_file.DeviceTempFile(
1428 self.adb, suffix='.png'), 1468 self.adb, suffix='.png'),
1429 MockTempFile('/tmp/path/temp-123.png')), 1469 MockTempFile('/tmp/path/temp-123.png')),
1430 (self.call.adb.Shell('/system/bin/screencap -p /tmp/path/temp-123.png'), 1470 (self.call.adb.Shell('/system/bin/screencap -p /tmp/path/temp-123.png'),
1431 ''), 1471 ''),
1432 self.call.device.PullFile('/tmp/path/temp-123.png', 1472 self.call.device.PullFile('/tmp/path/temp-123.png',
1433 '/test/host/screenshot.png')): 1473 '/test/host/screenshot.png')):
1434 self.device.TakeScreenshot('/test/host/screenshot.png') 1474 self.device.TakeScreenshot('/test/host/screenshot.png')
1435 1475
1436 1476
1437 class DeviceUtilsGetMemoryUsageForPidTest(DeviceUtilsTest): 1477 class DeviceUtilsGetMemoryUsageForPidTest(DeviceUtilsTest):
1438 1478
1439 def setUp(self): 1479 def setUp(self):
1440 super(DeviceUtilsGetMemoryUsageForPidTest, self).setUp() 1480 super(DeviceUtilsGetMemoryUsageForPidTest, self).setUp()
1441 1481
1442 def testGetMemoryUsageForPid_validPid(self): 1482 def testGetMemoryUsageForPid_validPid(self):
1443 with self.assertCalls( 1483 with self.assertCalls(
1444 (self.call.device.RunShellCommand( 1484 (self.call.device._RunPipedShellCommand(
1445 ['showmap', '1234'], as_root=True, check_return=True), 1485 'showmap 1234 | grep TOTAL', as_root=True, check_return=False),
1446 ['100 101 102 103 104 105 106 107 TOTAL']), 1486 ['100 101 102 103 104 105 106 107 TOTAL']),
1447 (self.call.device.ReadFile('/proc/1234/status', as_root=True), 1487 (self.call.device.ReadFile('/proc/1234/status', as_root=True),
1448 'VmHWM: 1024 kB\n')): 1488 'VmHWM: 1024 kB\n')):
1449 self.assertEqual( 1489 self.assertEqual(
1450 { 1490 {
1451 'Size': 100, 1491 'Size': 100,
1452 'Rss': 101, 1492 'Rss': 101,
1453 'Pss': 102, 1493 'Pss': 102,
1454 'Shared_Clean': 103, 1494 'Shared_Clean': 103,
1455 'Shared_Dirty': 104, 1495 'Shared_Dirty': 104,
1456 'Private_Clean': 105, 1496 'Private_Clean': 105,
1457 'Private_Dirty': 106, 1497 'Private_Dirty': 106,
1458 'VmHWM': 1024 1498 'VmHWM': 1024
1459 }, 1499 },
1460 self.device.GetMemoryUsageForPid(1234)) 1500 self.device.GetMemoryUsageForPid(1234))
1461 1501
1462 def testGetMemoryUsageForPid_noSmaps(self): 1502 def testGetMemoryUsageForPid_noSmaps(self):
1463 with self.assertCalls( 1503 with self.assertCalls(
1464 (self.call.device.RunShellCommand( 1504 (self.call.device._RunPipedShellCommand(
1465 ['showmap', '4321'], as_root=True, check_return=True), 1505 'showmap 4321 | grep TOTAL', as_root=True, check_return=False),
1466 ['cannot open /proc/4321/smaps: No such file or directory']), 1506 ['cannot open /proc/4321/smaps: No such file or directory']),
1467 (self.call.device.ReadFile('/proc/4321/status', as_root=True), 1507 (self.call.device.ReadFile('/proc/4321/status', as_root=True),
1468 'VmHWM: 1024 kb\n')): 1508 'VmHWM: 1024 kb\n')):
1469 self.assertEquals({'VmHWM': 1024}, self.device.GetMemoryUsageForPid(4321)) 1509 self.assertEquals({'VmHWM': 1024}, self.device.GetMemoryUsageForPid(4321))
1470 1510
1471 def testGetMemoryUsageForPid_noStatus(self): 1511 def testGetMemoryUsageForPid_noStatus(self):
1472 with self.assertCalls( 1512 with self.assertCalls(
1473 (self.call.device.RunShellCommand( 1513 (self.call.device._RunPipedShellCommand(
1474 ['showmap', '4321'], as_root=True, check_return=True), 1514 'showmap 4321 | grep TOTAL', as_root=True, check_return=False),
1475 ['100 101 102 103 104 105 106 107 TOTAL']), 1515 ['100 101 102 103 104 105 106 107 TOTAL']),
1476 (self.call.device.ReadFile('/proc/4321/status', as_root=True), 1516 (self.call.device.ReadFile('/proc/4321/status', as_root=True),
1477 self.CommandError())): 1517 self.CommandError())):
1478 self.assertEquals( 1518 self.assertEquals(
1479 { 1519 {
1480 'Size': 100, 1520 'Size': 100,
1481 'Rss': 101, 1521 'Rss': 101,
1482 'Pss': 102, 1522 'Pss': 102,
1483 'Shared_Clean': 103, 1523 'Shared_Clean': 103,
1484 'Shared_Dirty': 104, 1524 'Shared_Dirty': 104,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 self.assertEqual(client_cache_one, {'test': 1}) 1580 self.assertEqual(client_cache_one, {'test': 1})
1541 self.assertEqual(client_cache_two, {'test': 1}) 1581 self.assertEqual(client_cache_two, {'test': 1})
1542 self.device._ClearCache() 1582 self.device._ClearCache()
1543 self.assertEqual(client_cache_one, {}) 1583 self.assertEqual(client_cache_one, {})
1544 self.assertEqual(client_cache_two, {}) 1584 self.assertEqual(client_cache_two, {})
1545 1585
1546 if __name__ == '__main__': 1586 if __name__ == '__main__':
1547 logging.getLogger().setLevel(logging.DEBUG) 1587 logging.getLogger().setLevel(logging.DEBUG)
1548 unittest.main(verbosity=2) 1588 unittest.main(verbosity=2)
1549 1589
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698