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

Side by Side Diff: telemetry/telemetry/internal/platform/android_platform_backend.py

Issue 3002933003: Enable installing test CA on Android & add test for it (Closed)
Patch Set: Specify key & cert files Created 3 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 unified diff | Download patch
OLDNEW
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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 def IsAppRunning(self, process_name): 539 def IsAppRunning(self, process_name):
540 """Determine if the given process is running. 540 """Determine if the given process is running.
541 541
542 Args: 542 Args:
543 process_name: The full package name string of the process. 543 process_name: The full package name string of the process.
544 """ 544 """
545 return bool(self._device.GetPids(process_name)) 545 return bool(self._device.GetPids(process_name))
546 546
547 @property 547 @property
548 def supports_test_ca(self): 548 def supports_test_ca(self):
549 # TODO(nednguyen): figure out how to install certificate on Android M 549 return True
550 # crbug.com/593152
551 # TODO(crbug.com/716084): enable support for test CA
552 # return self._device.build_version_sdk <= version_codes.LOLLIPOP_MR1
553 return False
554 550
555 def InstallTestCa(self): 551 def InstallTestCa(self):
556 """Install a randomly generated root CA on the android device. 552 """Install a randomly generated root CA on the android device.
557 553
558 This allows transparent HTTPS testing with WPR server without need 554 This allows transparent HTTPS testing with WPR server without need
559 to tweak application network stack. 555 to tweak application network stack.
560 556
561 Note: If this method fails with any exception, then RemoveTestCa will be 557 Note: If this method fails with any exception, then RemoveTestCa will be
562 automatically called by the network_controller_backend. 558 automatically called by the network_controller_backend.
563 """ 559 """
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 for process in psutil.process_iter(): 838 for process in psutil.process_iter():
843 try: 839 try:
844 if psutil.version_info >= (2, 0): 840 if psutil.version_info >= (2, 0):
845 if 'adb' in process.name(): 841 if 'adb' in process.name():
846 process.cpu_affinity([0]) 842 process.cpu_affinity([0])
847 else: 843 else:
848 if 'adb' in process.name: 844 if 'adb' in process.name:
849 process.set_cpu_affinity([0]) 845 process.set_cpu_affinity([0])
850 except (psutil.NoSuchProcess, psutil.AccessDenied): 846 except (psutil.NoSuchProcess, psutil.AccessDenied):
851 logging.warn('Failed to set adb process CPU affinity') 847 logging.warn('Failed to set adb process CPU affinity')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698