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

Unified Diff: tools/telemetry/telemetry/core/platform/android_sysfs_platform_unittest.py

Issue 470803006: [Telemetry] Android power moniotrs extend SysfsPowerMonitor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved platform files and made other Android monitors extend sysfs. 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/platform/android_sysfs_platform_unittest.py
diff --git a/tools/telemetry/telemetry/core/platform/android_sysfs_platform_unittest.py b/tools/telemetry/telemetry/core/platform/android_sysfs_platform_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..06dccf86b41420aa78ee4e54c4a0fa81eab1f01e
--- /dev/null
+++ b/tools/telemetry/telemetry/core/platform/android_sysfs_platform_unittest.py
@@ -0,0 +1,33 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import unittest
+
+from telemetry.core.platform import android_sysfs_platform
+
+
+class AndroidSysfsPlatformTest(unittest.TestCase):
+ cstate = {
+ 'cpu0': 'C0\nC1\n103203424\n5342040\n300\n500\n1403232500',
+ 'cpu1': 'C0\n124361858\n300\n1403232500'
+ }
+ expected_cstate = {
+ 'cpu0': {
+ 'WFI': 103203424,
+ 'C0': 1403232391454536,
+ 'C1': 5342040
+ },
+ 'cpu1': {
+ 'WFI': 124361858,
+ 'C0': 1403232375638142
+ }
+ }
+ def testAndroidParseCpuStates(self):
+ # Use mock start and end times to allow for the test to calculate C0.
+ results = android_sysfs_platform.AndroidSysfsPlatform.ParseStateSample(
+ self.cstate)
+ for cpu in results:
+ for state in results[cpu]:
+ self.assertAlmostEqual(results[cpu][state],
+ self.expected_cstate[cpu][state])

Powered by Google App Engine
This is Rietveld 408576698