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

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

Issue 420273006: [Android] Fix DeviceUtils.__str__ when no serial is provided. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 "adb -s 0123456789abcdef shell 'showmap 4321'", 1477 "adb -s 0123456789abcdef shell 'showmap 4321'",
1478 'cannot open /proc/4321/smaps: No such file or directory\r\n'): 1478 'cannot open /proc/4321/smaps: No such file or directory\r\n'):
1479 self.assertEqual({}, self.device.GetMemoryUsageForPid(4321)) 1479 self.assertEqual({}, self.device.GetMemoryUsageForPid(4321))
1480 1480
1481 1481
1482 class DeviceUtilsStrTest(DeviceUtilsOldImplTest): 1482 class DeviceUtilsStrTest(DeviceUtilsOldImplTest):
1483 def testStr_noAdbCalls(self): 1483 def testStr_noAdbCalls(self):
1484 with self.assertNoAdbCalls(): 1484 with self.assertNoAdbCalls():
1485 self.assertEqual('0123456789abcdef', str(self.device)) 1485 self.assertEqual('0123456789abcdef', str(self.device))
1486 1486
1487 def testStr_noSerial(self):
1488 self.device = device_utils.DeviceUtils(None)
1489 with self.assertCalls('adb get-serialno', '0123456789abcdef'):
1490 self.assertEqual('0123456789abcdef', str(self.device))
1491
1492 def testStr_noSerial_noDevices(self):
1493 self.device = device_utils.DeviceUtils(None)
1494 with self.assertCalls('adb get-serialno', 'unknown'), (
1495 self.assertRaises(device_errors.NoDevicesError)):
1496 str(self.device)
1497
1487 1498
1488 if __name__ == '__main__': 1499 if __name__ == '__main__':
1489 logging.getLogger().setLevel(logging.DEBUG) 1500 logging.getLogger().setLevel(logging.DEBUG)
1490 unittest.main(verbosity=2) 1501 unittest.main(verbosity=2)
1491 1502
OLDNEW
« no previous file with comments | « build/android/pylib/device/device_utils.py ('k') | chrome/test/chromedriver/test/test_environment.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698