| 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. |
| 515 return server_process.ServerProcess(port, server_name, cmd_line, env, | 521 return server_process.ServerProcess(port, server_name, cmd_line, env, |
| 516 treat_no_data_as_crash=True, more_lo
gging=more_logging) | 522 universal_newlines=True, treat_no_da
ta_as_crash=True, more_logging=more_logging) |
| 517 | 523 |
| 518 | 524 |
| 519 class AndroidPerf(SingleFileOutputProfiler): | 525 class AndroidPerf(SingleFileOutputProfiler): |
| 520 _cached_perf_host_path = None | 526 _cached_perf_host_path = None |
| 521 _have_searched_for_perf_host = False | 527 _have_searched_for_perf_host = False |
| 522 | 528 |
| 523 def __init__(self, host, executable_path, output_dir, device, symfs_path, ka
llsyms_path, identifier=None): | 529 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) | 530 super(AndroidPerf, self).__init__(host, executable_path, output_dir, "da
ta", identifier) |
| 525 self._device = device | 531 self._device = device |
| 526 self._perf_process = None | 532 self._perf_process = None |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 | 880 |
| 875 if not self._port.get_option('disable_breakpad'): | 881 if not self._port.get_option('disable_breakpad'): |
| 876 crashes = self._pull_crash_dumps_from_device() | 882 crashes = self._pull_crash_dumps_from_device() |
| 877 for crash in crashes: | 883 for crash in crashes: |
| 878 stack = self._port._dump_reader._get_stack_from_dump(crash) # p
ylint: disable=protected-access | 884 stack = self._port._dump_reader._get_stack_from_dump(crash) # p
ylint: disable=protected-access |
| 879 stderr += '********* [%s] breakpad minidump %s:\n%s' % ( | 885 stderr += '********* [%s] breakpad minidump %s:\n%s' % ( |
| 880 self._port.host.filesystem.basename(crash), | 886 self._port.host.filesystem.basename(crash), |
| 881 self._device.serial, | 887 self._device.serial, |
| 882 stack) | 888 stack) |
| 883 | 889 |
| 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. |
| 884 return super(ChromiumAndroidDriver, self)._get_crash_log( | 894 return super(ChromiumAndroidDriver, self)._get_crash_log( |
| 885 stdout, stderr, newer_than) | 895 stdout.encode('utf8', 'replace'), |
| 896 stderr.encode('utf8', 'replace'), |
| 897 newer_than) |
| 886 | 898 |
| 887 def cmd_line(self, pixel_tests, per_test_args): | 899 def cmd_line(self, pixel_tests, per_test_args): |
| 888 # The returned command line is used to start _server_process. In our cas
e, it's an interactive 'adb shell'. | 900 # The returned command line is used to start _server_process. In our cas
e, it's an interactive 'adb shell'. |
| 889 # The command line passed to the driver process is returned by _driver_c
md_line() instead. | 901 # The command line passed to the driver process is returned by _driver_c
md_line() instead. |
| 890 return [self._device.adb.GetAdbPath(), '-s', self._device.serial, 'shell
'] | 902 return [self._device.adb.GetAdbPath(), '-s', self._device.serial, 'shell
'] |
| 891 | 903 |
| 892 def _android_driver_cmd_line(self, pixel_tests, per_test_args): | 904 def _android_driver_cmd_line(self, pixel_tests, per_test_args): |
| 893 return driver.Driver.cmd_line(self, pixel_tests, per_test_args) | 905 return driver.Driver.cmd_line(self, pixel_tests, per_test_args) |
| 894 | 906 |
| 895 @staticmethod | 907 @staticmethod |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 return command | 1143 return command |
| 1132 | 1144 |
| 1133 def _read_prompt(self, deadline): | 1145 def _read_prompt(self, deadline): |
| 1134 last_char = '' | 1146 last_char = '' |
| 1135 while True: | 1147 while True: |
| 1136 current_char = self._server_process.read_stdout(deadline, 1) | 1148 current_char = self._server_process.read_stdout(deadline, 1) |
| 1137 if current_char == ' ': | 1149 if current_char == ' ': |
| 1138 if last_char in ('#', '$'): | 1150 if last_char in ('#', '$'): |
| 1139 return | 1151 return |
| 1140 last_char = current_char | 1152 last_char = current_char |
| OLD | NEW |