| 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 def _shut_down_http_server(self, pid): | 505 def _shut_down_http_server(self, pid): |
| 506 return self._host_port._shut_down_http_server(pid) | 506 return self._host_port._shut_down_http_server(pid) |
| 507 | 507 |
| 508 def _driver_class(self): | 508 def _driver_class(self): |
| 509 return ChromiumAndroidDriver | 509 return ChromiumAndroidDriver |
| 510 | 510 |
| 511 # Local private methods. | 511 # Local private methods. |
| 512 | 512 |
| 513 @staticmethod | 513 @staticmethod |
| 514 def _android_server_process_constructor(port, server_name, cmd_line, env=Non
e, more_logging=False): | 514 def _android_server_process_constructor(port, server_name, cmd_line, env=Non
e, more_logging=False): |
| 515 # We need universal_newlines=True, because 'adb shell' for some unknown
reason | |
| 516 # does newline conversion of unix-style LF into win-style CRLF (and we n
eed | |
| 517 # to convert that back). This can cause headaches elsewhere because | |
| 518 # server_process' stdout and stderr are now unicode file-like objects, | |
| 519 # not binary file-like objects like all of the other ports are. | |
| 520 # FIXME: crbug.com/496983. | |
| 521 return server_process.ServerProcess(port, server_name, cmd_line, env, | 515 return server_process.ServerProcess(port, server_name, cmd_line, env, |
| 522 universal_newlines=True, treat_no_da
ta_as_crash=True, more_logging=more_logging) | 516 treat_no_data_as_crash=True, more_lo
gging=more_logging) |
| 523 | 517 |
| 524 | 518 |
| 525 class AndroidPerf(SingleFileOutputProfiler): | 519 class AndroidPerf(SingleFileOutputProfiler): |
| 526 _cached_perf_host_path = None | 520 _cached_perf_host_path = None |
| 527 _have_searched_for_perf_host = False | 521 _have_searched_for_perf_host = False |
| 528 | 522 |
| 529 def __init__(self, host, executable_path, output_dir, device, symfs_path, ka
llsyms_path, identifier=None): | 523 def __init__(self, host, executable_path, output_dir, device, symfs_path, ka
llsyms_path, identifier=None): |
| 530 super(AndroidPerf, self).__init__(host, executable_path, output_dir, "da
ta", identifier) | 524 super(AndroidPerf, self).__init__(host, executable_path, output_dir, "da
ta", identifier) |
| 531 self._device = device | 525 self._device = device |
| 532 self._perf_process = None | 526 self._perf_process = None |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 | 874 |
| 881 if not self._port.get_option('disable_breakpad'): | 875 if not self._port.get_option('disable_breakpad'): |
| 882 crashes = self._pull_crash_dumps_from_device() | 876 crashes = self._pull_crash_dumps_from_device() |
| 883 for crash in crashes: | 877 for crash in crashes: |
| 884 stack = self._port._dump_reader._get_stack_from_dump(crash) # p
ylint: disable=protected-access | 878 stack = self._port._dump_reader._get_stack_from_dump(crash) # p
ylint: disable=protected-access |
| 885 stderr += '********* [%s] breakpad minidump %s:\n%s' % ( | 879 stderr += '********* [%s] breakpad minidump %s:\n%s' % ( |
| 886 self._port.host.filesystem.basename(crash), | 880 self._port.host.filesystem.basename(crash), |
| 887 self._device.serial, | 881 self._device.serial, |
| 888 stack) | 882 stack) |
| 889 | 883 |
| 890 # The parent method expects stdout and stderr to be byte streams, but | |
| 891 # since adb shell does newline conversion, we used universal_newlines | |
| 892 # when launching the processes, and hence our stdout and stderr are | |
| 893 # text objects that need to be encoded back into bytes. | |
| 894 return super(ChromiumAndroidDriver, self)._get_crash_log( | 884 return super(ChromiumAndroidDriver, self)._get_crash_log( |
| 895 stdout.encode('utf8', 'replace'), | 885 stdout, stderr, newer_than) |
| 896 stderr.encode('utf8', 'replace'), | |
| 897 newer_than) | |
| 898 | 886 |
| 899 def cmd_line(self, pixel_tests, per_test_args): | 887 def cmd_line(self, pixel_tests, per_test_args): |
| 900 # The returned command line is used to start _server_process. In our cas
e, it's an interactive 'adb shell'. | 888 # The returned command line is used to start _server_process. In our cas
e, it's an interactive 'adb shell'. |
| 901 # The command line passed to the driver process is returned by _driver_c
md_line() instead. | 889 # The command line passed to the driver process is returned by _driver_c
md_line() instead. |
| 902 return [self._device.adb.GetAdbPath(), '-s', self._device.serial, 'shell
'] | 890 return [self._device.adb.GetAdbPath(), '-s', self._device.serial, 'shell
'] |
| 903 | 891 |
| 904 def _android_driver_cmd_line(self, pixel_tests, per_test_args): | 892 def _android_driver_cmd_line(self, pixel_tests, per_test_args): |
| 905 return driver.Driver.cmd_line(self, pixel_tests, per_test_args) | 893 return driver.Driver.cmd_line(self, pixel_tests, per_test_args) |
| 906 | 894 |
| 907 @staticmethod | 895 @staticmethod |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 return command | 1131 return command |
| 1144 | 1132 |
| 1145 def _read_prompt(self, deadline): | 1133 def _read_prompt(self, deadline): |
| 1146 last_char = '' | 1134 last_char = '' |
| 1147 while True: | 1135 while True: |
| 1148 current_char = self._server_process.read_stdout(deadline, 1) | 1136 current_char = self._server_process.read_stdout(deadline, 1) |
| 1149 if current_char == ' ': | 1137 if current_char == ' ': |
| 1150 if last_char in ('#', '$'): | 1138 if last_char in ('#', '$'): |
| 1151 return | 1139 return |
| 1152 last_char = current_char | 1140 last_char = current_char |
| OLD | NEW |