| OLD | NEW |
| 1 # Copyright (C) 2012 Google Inc. All rights reserved. | 1 # Copyright (C) 2012 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 def _shut_down_http_server(self, pid): | 499 def _shut_down_http_server(self, pid): |
| 500 return self._host_port._shut_down_http_server(pid) | 500 return self._host_port._shut_down_http_server(pid) |
| 501 | 501 |
| 502 def _driver_class(self): | 502 def _driver_class(self): |
| 503 return ChromiumAndroidDriver | 503 return ChromiumAndroidDriver |
| 504 | 504 |
| 505 # Local private methods. | 505 # Local private methods. |
| 506 | 506 |
| 507 @staticmethod | 507 @staticmethod |
| 508 def _android_server_process_constructor(port, server_name, cmd_line, env=Non
e, more_logging=False): | 508 def _android_server_process_constructor(port, server_name, cmd_line, env=Non
e, more_logging=False): |
| 509 # We need universal_newlines=True, because 'adb shell' for some unknown
reason | |
| 510 # does newline conversion of unix-style LF into win-style CRLF (and we n
eed | |
| 511 # to convert that back). This can cause headaches elsewhere because | |
| 512 # server_process' stdout and stderr are now unicode file-like objects, | |
| 513 # not binary file-like objects like all of the other ports are. | |
| 514 # FIXME: crbug.com/496983. | |
| 515 return server_process.ServerProcess(port, server_name, cmd_line, env, | 509 return server_process.ServerProcess(port, server_name, cmd_line, env, |
| 516 universal_newlines=True, treat_no_da
ta_as_crash=True, more_logging=more_logging) | 510 treat_no_data_as_crash=True, more_lo
gging=more_logging) |
| 517 | 511 |
| 518 | 512 |
| 519 class AndroidPerf(SingleFileOutputProfiler): | 513 class AndroidPerf(SingleFileOutputProfiler): |
| 520 _cached_perf_host_path = None | 514 _cached_perf_host_path = None |
| 521 _have_searched_for_perf_host = False | 515 _have_searched_for_perf_host = False |
| 522 | 516 |
| 523 def __init__(self, host, executable_path, output_dir, device, symfs_path, ka
llsyms_path, identifier=None): | 517 def __init__(self, host, executable_path, output_dir, device, symfs_path, ka
llsyms_path, identifier=None): |
| 524 super(AndroidPerf, self).__init__(host, executable_path, output_dir, "da
ta", identifier) | 518 super(AndroidPerf, self).__init__(host, executable_path, output_dir, "da
ta", identifier) |
| 525 self._device = device | 519 self._device = device |
| 526 self._perf_process = None | 520 self._perf_process = None |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 | 868 |
| 875 if not self._port.get_option('disable_breakpad'): | 869 if not self._port.get_option('disable_breakpad'): |
| 876 crashes = self._pull_crash_dumps_from_device() | 870 crashes = self._pull_crash_dumps_from_device() |
| 877 for crash in crashes: | 871 for crash in crashes: |
| 878 stack = self._port._dump_reader._get_stack_from_dump(crash) # p
ylint: disable=protected-access | 872 stack = self._port._dump_reader._get_stack_from_dump(crash) # p
ylint: disable=protected-access |
| 879 stderr += '********* [%s] breakpad minidump %s:\n%s' % ( | 873 stderr += '********* [%s] breakpad minidump %s:\n%s' % ( |
| 880 self._port.host.filesystem.basename(crash), | 874 self._port.host.filesystem.basename(crash), |
| 881 self._device.serial, | 875 self._device.serial, |
| 882 stack) | 876 stack) |
| 883 | 877 |
| 884 # The parent method expects stdout and stderr to be byte streams, but | |
| 885 # since adb shell does newline conversion, we used universal_newlines | |
| 886 # when launching the processes, and hence our stdout and stderr are | |
| 887 # text objects that need to be encoded back into bytes. | |
| 888 return super(ChromiumAndroidDriver, self)._get_crash_log( | 878 return super(ChromiumAndroidDriver, self)._get_crash_log( |
| 889 stdout.encode('utf8', 'replace'), | 879 stdout, stderr, newer_than) |
| 890 stderr.encode('utf8', 'replace'), | |
| 891 newer_than) | |
| 892 | 880 |
| 893 def cmd_line(self, pixel_tests, per_test_args): | 881 def cmd_line(self, pixel_tests, per_test_args): |
| 894 # The returned command line is used to start _server_process. In our cas
e, it's an interactive 'adb shell'. | 882 # The returned command line is used to start _server_process. In our cas
e, it's an interactive 'adb shell'. |
| 895 # The command line passed to the driver process is returned by _driver_c
md_line() instead. | 883 # The command line passed to the driver process is returned by _driver_c
md_line() instead. |
| 896 return [self._device.adb.GetAdbPath(), '-s', self._device.serial, 'shell
'] | 884 return [self._device.adb.GetAdbPath(), '-s', self._device.serial, 'shell
'] |
| 897 | 885 |
| 898 def _android_driver_cmd_line(self, pixel_tests, per_test_args): | 886 def _android_driver_cmd_line(self, pixel_tests, per_test_args): |
| 899 return driver.Driver.cmd_line(self, pixel_tests, per_test_args) | 887 return driver.Driver.cmd_line(self, pixel_tests, per_test_args) |
| 900 | 888 |
| 901 @staticmethod | 889 @staticmethod |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 return command | 1125 return command |
| 1138 | 1126 |
| 1139 def _read_prompt(self, deadline): | 1127 def _read_prompt(self, deadline): |
| 1140 last_char = '' | 1128 last_char = '' |
| 1141 while True: | 1129 while True: |
| 1142 current_char = self._server_process.read_stdout(deadline, 1) | 1130 current_char = self._server_process.read_stdout(deadline, 1) |
| 1143 if current_char == ' ': | 1131 if current_char == ' ': |
| 1144 if last_char in ('#', '$'): | 1132 if last_char in ('#', '$'): |
| 1145 return | 1133 return |
| 1146 last_char = current_char | 1134 last_char = current_char |
| OLD | NEW |