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

Side by Side Diff: infra/services/devicemon/test/device_metrics_test.py

Issue 1993443002: Delete devicemon; moving to sysmon. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « infra/services/devicemon/test/__init__.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import unittest
6
7 from infra.services.devicemon import device_metrics
8 from infra_libs import ts_mon
9
10 from devil.android import device_utils
11
12
13 class DeviceMetricsTest(unittest.TestCase):
14 def setUp(self):
15 ts_mon.reset_for_unittest()
16
17 def test_cpu_temp(self):
18 device = device_utils.DeviceUtils('fake_serial')
19 # todo: mock device interactions
20 device_metrics.set_cpu_temp(device, {'device_id': 'fake_serial'})
21 cpu_temp = device_metrics.cpu_temp_metric.get({'device_id': 'fake_serial'})
22
23 self.assertEqual(0, cpu_temp)
24
25 def test_battery_temp(self):
26 device = device_utils.DeviceUtils('fake_serial')
27 # todo: mock device interactions
28 device_metrics.set_battery_temp(device, {})
29 battery_temp = device_metrics.battery_temp_metric.get({})
30
31 self.assertEqual(0, battery_temp)
32
33 def test_battery_charge(self):
34 device = device_utils.DeviceUtils('fake_serial')
35 # todo: mock device interactions
36 device_metrics.set_battery_charge(device, {})
37 battery_charge = device_metrics.battery_charge_metric.get({})
38
39 self.assertEqual(0, battery_charge)
40
41 def test_device_status(self):
42 device = device_utils.DeviceUtils('fake_serial')
43 # todo: mock device interactions
44 device_metrics.set_device_status(device, {}, status='on_fire')
45 device_status = device_metrics.device_status_metric.get({})
46
47 self.assertEqual('on_fire', device_status)
48
49 # todo: more tests(!!) once the device interaction is implemented
50
51
52 if __name__ == '__main__':
53 unittest.main()
OLDNEW
« no previous file with comments | « infra/services/devicemon/test/__init__.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698