• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2013 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# pylint: disable=W0613
6
7# pylint: disable=W0212
8class OSVersion(str):
9  def __new__(cls, friendly_name, sortable_name, *args, **kwargs):
10    version = str.__new__(cls, friendly_name)
11    version._sortable_name = sortable_name
12    return version
13
14  def __lt__(self, other):
15    return self._sortable_name < other._sortable_name
16
17  def __gt__(self, other):
18    return self._sortable_name > other._sortable_name
19
20  def __le__(self, other):
21    return self._sortable_name <= other._sortable_name
22
23  def __ge__(self, other):
24    return self._sortable_name >= other._sortable_name
25
26
27XP =           OSVersion('xp',            5.1)
28VISTA =        OSVersion('vista',         6.0)
29WIN7 =         OSVersion('win7',          6.1)
30WIN8 =         OSVersion('win8',          6.2)
31
32LEOPARD =      OSVersion('leopard',      10.5)
33SNOWLEOPARD =  OSVersion('snowleopard',  10.6)
34LION =         OSVersion('lion',         10.7)
35MOUNTAINLION = OSVersion('mountainlion', 10.8)
36MAVERICKS =    OSVersion('mavericks',    10.9)
37
38
39class PlatformBackend(object):
40  def IsRawDisplayFrameRateSupported(self):
41    return False
42
43  def StartRawDisplayFrameRateMeasurement(self):
44    raise NotImplementedError()
45
46  def StopRawDisplayFrameRateMeasurement(self):
47    raise NotImplementedError()
48
49  def GetRawDisplayFrameRateMeasurements(self):
50    raise NotImplementedError()
51
52  def SetFullPerformanceModeEnabled(self, enabled):
53    pass
54
55  def CanMonitorThermalThrottling(self):
56    return False
57
58  def IsThermallyThrottled(self):
59    raise NotImplementedError()
60
61  def HasBeenThermallyThrottled(self):
62    raise NotImplementedError()
63
64  def GetSystemCommitCharge(self):
65    raise NotImplementedError()
66
67  def GetSystemTotalPhysicalMemory(self):
68    raise NotImplementedError()
69
70  def GetCpuStats(self, pid):
71    return {}
72
73  def GetCpuTimestamp(self):
74    return {}
75
76  def PurgeUnpinnedMemory(self):
77    pass
78
79  def GetMemoryStats(self, pid):
80    return {}
81
82  def GetIOStats(self, pid):
83    return {}
84
85  def GetChildPids(self, pid):
86    raise NotImplementedError()
87
88  def GetCommandLine(self, pid):
89    raise NotImplementedError()
90
91  def GetOSName(self):
92    raise NotImplementedError()
93
94  def GetOSVersionName(self):
95    raise NotImplementedError()
96
97  def CanFlushIndividualFilesFromSystemCache(self):
98    raise NotImplementedError()
99
100  def FlushEntireSystemCache(self):
101    raise NotImplementedError()
102
103  def FlushSystemCacheForDirectory(self, directory, ignoring=None):
104    raise NotImplementedError()
105
106  def FlushDnsCache(self):
107    pass
108
109  def LaunchApplication(
110      self, application, parameters=None, elevate_privilege=False):
111    raise NotImplementedError()
112
113  def IsApplicationRunning(self, application):
114    raise NotImplementedError()
115
116  def CanLaunchApplication(self, application):
117    return False
118
119  def InstallApplication(self, application):
120    raise NotImplementedError()
121
122  def CanCaptureVideo(self):
123    return False
124
125  def StartVideoCapture(self, min_bitrate_mbps):
126    raise NotImplementedError()
127
128  @property
129  def is_video_capture_running(self):
130    return False
131
132  def StopVideoCapture(self):
133    raise NotImplementedError()
134
135  def CanMonitorPower(self):
136    return False
137
138  def StartMonitoringPower(self, browser):
139    raise NotImplementedError()
140
141  def StopMonitoringPower(self):
142    raise NotImplementedError()
143