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

Side by Side Diff: telemetry/telemetry/internal/platform/cros_platform_backend_unittest.py

Issue 2988553002: Fixed errors related to bad-continuation pt.11 (Closed)
Patch Set: Fix additional errors Created 3 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 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import unittest 5 import unittest
6 6
7 from telemetry.internal.platform import cros_platform_backend 7 from telemetry.internal.platform import cros_platform_backend
8 8
9 9
10 class CrosPlatformBackendTest(unittest.TestCase): 10 class CrosPlatformBackendTest(unittest.TestCase):
11 initial_cstate = { 11 initial_cstate = {
12 'cpu0': 'POLL\nC1\nC2\nC3\n0\n138356189\n102416540\n' 12 'cpu0':
13 '17158209182\n0\n1\n500\n1000\n1403211341', 13 'POLL\nC1\nC2\nC3\n0\n138356189\n102416540\n'
14 'cpu1': 'POLL\nC1\nC2\nC3\n0\n107318149\n81786238\n' 14 '17158209182\n0\n1\n500\n1000\n1403211341',
15 '17348563431\n0\n1\n500\n1000\n1403211341' 15 'cpu1':
16 'POLL\nC1\nC2\nC3\n0\n107318149\n81786238\n'
17 '17348563431\n0\n1\n500\n1000\n1403211341'
16 } 18 }
17 expected_cstate = { 19 expected_cstate = {
18 'cpu0': { 20 'cpu0': {
19 'C0': 1403193942018089, 21 'C0': 1403193942018089,
20 'C1': 138356189, 22 'C1': 138356189,
21 'C2': 102416540, 23 'C2': 102416540,
22 'C3': 17158209182 24 'C3': 17158209182
23 }, 25 },
24 'cpu1': { 26 'cpu1': {
25 'C0': 1403193803332182, 27 'C0': 1403193803332182,
26 'C1': 107318149, 28 'C1': 107318149,
27 'C2': 81786238, 29 'C2': 81786238,
28 'C3': 17348563431 30 'C3': 17348563431
29 } 31 }
30 } 32 }
31 def testCrosParseCpuStates(self): 33 def testCrosParseCpuStates(self):
32 # Use mock start and end times to allow for the test to calculate C0. 34 # Use mock start and end times to allow for the test to calculate C0.
33 results = cros_platform_backend.CrosPlatformBackend.ParseCStateSample( 35 results = cros_platform_backend.CrosPlatformBackend.ParseCStateSample(
34 self.initial_cstate) 36 self.initial_cstate)
35 for cpu in results: 37 for cpu in results:
36 for state in results[cpu]: 38 for state in results[cpu]:
37 self.assertAlmostEqual(results[cpu][state], 39 self.assertAlmostEqual(results[cpu][state],
38 self.expected_cstate[cpu][state]) 40 self.expected_cstate[cpu][state])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698