| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import posixpath | 7 import posixpath |
| 8 import re | 8 import re |
| 9 import subprocess | 9 import subprocess |
| 10 import tempfile | 10 import tempfile |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 def IsAosp(self): | 167 def IsAosp(self): |
| 168 description = self._device.GetProp('ro.build.description', cache=True) | 168 description = self._device.GetProp('ro.build.description', cache=True) |
| 169 if description is not None: | 169 if description is not None: |
| 170 return 'aosp' in description | 170 return 'aosp' in description |
| 171 return False | 171 return False |
| 172 | 172 |
| 173 | 173 |
| 174 def GetRemotePort(self, port): | 174 def GetRemotePort(self, port): |
| 175 return forwarder.Forwarder.DevicePortForHostPort(port) or 0 | 175 return forwarder.Forwarder.DevicePortForHostPort(port) or 0 |
| 176 | 176 |
| 177 def CreatePortForwarder(self, port_pair, use_remote_port_forwarding): |
| 178 # use_remote_port_forwarding is ignored as it is always true for |
| 179 # Android device. |
| 180 return self.forwarder_factory.Create(port_pair) |
| 181 |
| 182 def IsRemoteDevice(self): |
| 183 # Android device is connected via adb which is on remote. |
| 184 return True |
| 185 |
| 177 def IsDisplayTracingSupported(self): | 186 def IsDisplayTracingSupported(self): |
| 178 return bool(self.GetOSVersionName() >= 'J') | 187 return bool(self.GetOSVersionName() >= 'J') |
| 179 | 188 |
| 180 def StartDisplayTracing(self): | 189 def StartDisplayTracing(self): |
| 181 assert not self._surface_stats_collector | 190 assert not self._surface_stats_collector |
| 182 # Clear any leftover data from previous timed out tests | 191 # Clear any leftover data from previous timed out tests |
| 183 self._raw_display_frame_rate_measurements = [] | 192 self._raw_display_frame_rate_measurements = [] |
| 184 self._surface_stats_collector = \ | 193 self._surface_stats_collector = \ |
| 185 surface_stats_collector.SurfaceStatsCollector(self._device) | 194 surface_stats_collector.SurfaceStatsCollector(self._device) |
| 186 self._surface_stats_collector.Start() | 195 self._surface_stats_collector.Start() |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 for process in psutil.process_iter(): | 853 for process in psutil.process_iter(): |
| 845 try: | 854 try: |
| 846 if psutil.version_info >= (2, 0): | 855 if psutil.version_info >= (2, 0): |
| 847 if 'adb' in process.name(): | 856 if 'adb' in process.name(): |
| 848 process.cpu_affinity([0]) | 857 process.cpu_affinity([0]) |
| 849 else: | 858 else: |
| 850 if 'adb' in process.name: | 859 if 'adb' in process.name: |
| 851 process.set_cpu_affinity([0]) | 860 process.set_cpu_affinity([0]) |
| 852 except (psutil.NoSuchProcess, psutil.AccessDenied): | 861 except (psutil.NoSuchProcess, psutil.AccessDenied): |
| 853 logging.warn('Failed to set adb process CPU affinity') | 862 logging.warn('Failed to set adb process CPU affinity') |
| OLD | NEW |