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

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

Issue 1288993002: Revert of [Android] Remove android_commands and android_testrunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 battery_utils.py 7 Unit tests for the contents of battery_utils.py
8 """ 8 """
9 9
10 # pylint: disable=W0613 10 # pylint: disable=W0613
11 11
12 import logging 12 import logging
13 import os 13 import os
14 import sys 14 import sys
15 import unittest 15 import unittest
16 16
17 from pylib import constants 17 from pylib import constants
18 from pylib.device import battery_utils 18 from pylib.device import battery_utils
19 from pylib.device import device_errors 19 from pylib.device import device_errors
20 from pylib.device import device_utils 20 from pylib.device import device_utils
21 from pylib.device import device_utils_test 21 from pylib.device import device_utils_test
22 from pylib.utils import mock_calls 22 from pylib.utils import mock_calls
23 23
24 # RunCommand from third_party/android_testrunner/run_command.py is mocked
25 # below, so its path needs to be in sys.path.
26 sys.path.append(os.path.join(
27 constants.DIR_SOURCE_ROOT, 'third_party', 'android_testrunner'))
28
24 sys.path.append(os.path.join( 29 sys.path.append(os.path.join(
25 constants.DIR_SOURCE_ROOT, 'third_party', 'pymock')) 30 constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
26 import mock # pylint: disable=F0401 31 import mock # pylint: disable=F0401
27 32
28 _DUMPSYS_OUTPUT = [ 33 _DUMPSYS_OUTPUT = [
29 '9,0,i,uid,1000,test_package1', 34 '9,0,i,uid,1000,test_package1',
30 '9,0,i,uid,1001,test_package2', 35 '9,0,i,uid,1001,test_package2',
31 '9,1000,l,pwi,uid,1', 36 '9,1000,l,pwi,uid,1',
32 '9,1001,l,pwi,uid,2' 37 '9,1001,l,pwi,uid,2'
33 ] 38 ]
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 ['9,1000,l,pwi,uid,0.0327']), 570 ['9,1000,l,pwi,uid,0.0327']),
566 (self.call.device.RunShellCommand( 571 (self.call.device.RunShellCommand(
567 ['dumpsys', 'battery', 'reset'], check_return=True), [])): 572 ['dumpsys', 'battery', 'reset'], check_return=True), [])):
568 with self.assertRaises(device_errors.CommandFailedError): 573 with self.assertRaises(device_errors.CommandFailedError):
569 self.battery._ClearPowerData() 574 self.battery._ClearPowerData()
570 575
571 576
572 if __name__ == '__main__': 577 if __name__ == '__main__':
573 logging.getLogger().setLevel(logging.DEBUG) 578 logging.getLogger().setLevel(logging.DEBUG)
574 unittest.main(verbosity=2) 579 unittest.main(verbosity=2)
OLDNEW
« no previous file with comments | « build/android/pylib/android_commands_unittest.py ('k') | build/android/pylib/device/decorators.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698