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

Unified Diff: telemetry/telemetry/core/cros_interface.py

Issue 2063993002: Implement GetDeviceTypeName on cros. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: . Created 4 years, 6 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
« no previous file with comments | « no previous file | telemetry/telemetry/core/cros_interface_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/core/cros_interface.py
diff --git a/telemetry/telemetry/core/cros_interface.py b/telemetry/telemetry/core/cros_interface.py
index 021f8ac939055a293d1299b527cdc643d0937e52..9a82c8b863d641d6eec211cbc7f1fc081baa53e7 100644
--- a/telemetry/telemetry/core/cros_interface.py
+++ b/telemetry/telemetry/core/cros_interface.py
@@ -506,6 +506,19 @@ class CrOSInterface(object):
def IsRunningOnVM(self):
return self.SysVendor() == 'QEMU'
+ def LsbReleaseValue(self, key, default):
+ """/etc/lsb-release is a file with key=value pairs."""
+ lines = self.GetFileContents('/etc/lsb-release').split('\n')
+ for l in lines:
+ m = re.match(r'([^=]*)=(.*)', l)
+ if m and m.group(1) == key:
+ return m.group(2)
+ return default
+
+ def GetDeviceTypeName(self):
+ """DEVICETYPE in /etc/lsb-release is CHROMEBOOK, CHROMEBIT, etc."""
+ return self.LsbReleaseValue(key='DEVICETYPE', default='CHROMEBOOK')
+
def RestartUI(self, clear_enterprise_policy):
logging.info('(Re)starting the ui (logs the user out)')
if clear_enterprise_policy:
« no previous file with comments | « no previous file | telemetry/telemetry/core/cros_interface_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698