| 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 re | 7 import re |
| 8 import subprocess | 8 import subprocess |
| 9 import tempfile | 9 import tempfile |
| 10 | 10 |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 def IsAppRunning(self, process_name): | 522 def IsAppRunning(self, process_name): |
| 523 """Determine if the given process is running. | 523 """Determine if the given process is running. |
| 524 | 524 |
| 525 Args: | 525 Args: |
| 526 process_name: The full package name string of the process. | 526 process_name: The full package name string of the process. |
| 527 """ | 527 """ |
| 528 return bool(self._device.GetPids(process_name)) | 528 return bool(self._device.GetPids(process_name)) |
| 529 | 529 |
| 530 @property | 530 @property |
| 531 def supports_test_ca(self): | 531 def supports_test_ca(self): |
| 532 return True | 532 # TODO(nednguyen): figure out how to install certificate on Android M |
| 533 # crbug.com/593152 |
| 534 return self._device.build_version_sdk <= version_codes.LOLLIPOP |
| 533 | 535 |
| 534 def InstallTestCa(self, ca_cert_path): | 536 def InstallTestCa(self, ca_cert_path): |
| 535 """Install a randomly generated root CA on the android device. | 537 """Install a randomly generated root CA on the android device. |
| 536 | 538 |
| 537 This allows transparent HTTPS testing with WPR server without need | 539 This allows transparent HTTPS testing with WPR server without need |
| 538 to tweak application network stack. | 540 to tweak application network stack. |
| 539 | 541 |
| 540 Note: If this method fails with any exception, then RemoveTestCa will be | 542 Note: If this method fails with any exception, then RemoveTestCa will be |
| 541 automatically called by the network_controller_backend. | 543 automatically called by the network_controller_backend. |
| 542 """ | 544 """ |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 for process in psutil.process_iter(): | 765 for process in psutil.process_iter(): |
| 764 try: | 766 try: |
| 765 if psutil.version_info >= (2, 0): | 767 if psutil.version_info >= (2, 0): |
| 766 if 'adb' in process.name(): | 768 if 'adb' in process.name(): |
| 767 process.cpu_affinity([0]) | 769 process.cpu_affinity([0]) |
| 768 else: | 770 else: |
| 769 if 'adb' in process.name: | 771 if 'adb' in process.name: |
| 770 process.set_cpu_affinity([0]) | 772 process.set_cpu_affinity([0]) |
| 771 except (psutil.NoSuchProcess, psutil.AccessDenied): | 773 except (psutil.NoSuchProcess, psutil.AccessDenied): |
| 772 logging.warn('Failed to set adb process CPU affinity') | 774 logging.warn('Failed to set adb process CPU affinity') |
| OLD | NEW |