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

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

Issue 1290173003: [Android] Reland of Remove android_commands and android_testrunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed: removed references from content/telemetry.isolate and TELEMETRY_DEPS 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
29 sys.path.append(os.path.join( 24 sys.path.append(os.path.join(
30 constants.DIR_SOURCE_ROOT, 'third_party', 'pymock')) 25 constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
31 import mock # pylint: disable=F0401 26 import mock # pylint: disable=F0401
32 27
33 _DUMPSYS_OUTPUT = [ 28 _DUMPSYS_OUTPUT = [
34 '9,0,i,uid,1000,test_package1', 29 '9,0,i,uid,1000,test_package1',
35 '9,0,i,uid,1001,test_package2', 30 '9,0,i,uid,1001,test_package2',
36 '9,1000,l,pwi,uid,1', 31 '9,1000,l,pwi,uid,1',
37 '9,1001,l,pwi,uid,2' 32 '9,1001,l,pwi,uid,2'
38 ] 33 ]
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 ['9,1000,l,pwi,uid,0.0327']), 565 ['9,1000,l,pwi,uid,0.0327']),
571 (self.call.device.RunShellCommand( 566 (self.call.device.RunShellCommand(
572 ['dumpsys', 'battery', 'reset'], check_return=True), [])): 567 ['dumpsys', 'battery', 'reset'], check_return=True), [])):
573 with self.assertRaises(device_errors.CommandFailedError): 568 with self.assertRaises(device_errors.CommandFailedError):
574 self.battery._ClearPowerData() 569 self.battery._ClearPowerData()
575 570
576 571
577 if __name__ == '__main__': 572 if __name__ == '__main__':
578 logging.getLogger().setLevel(logging.DEBUG) 573 logging.getLogger().setLevel(logging.DEBUG)
579 unittest.main(verbosity=2) 574 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