| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 # Private methods | 349 # Private methods |
| 350 def _battery_level_for_device(self, commands): | 350 def _battery_level_for_device(self, commands): |
| 351 battery_status = commands.run(['shell', 'dumpsys', 'battery']) | 351 battery_status = commands.run(['shell', 'dumpsys', 'battery']) |
| 352 if 'Error' in battery_status: | 352 if 'Error' in battery_status: |
| 353 _log.warning('Unable to read the battery level from device with seri
al "%s".' % commands.get_serial()) | 353 _log.warning('Unable to read the battery level from device with seri
al "%s".' % commands.get_serial()) |
| 354 return 100 | 354 return 100 |
| 355 | 355 |
| 356 return int(re.findall('level: (\d+)', battery_status)[0]) | 356 return int(re.findall('level: (\d+)', battery_status)[0]) |
| 357 | 357 |
| 358 | 358 |
| 359 class ChromiumAndroidPort(chromium.ChromiumPort): | 359 class AndroidPort(chromium.ChromiumPort): |
| 360 port_name = 'chromium-android' | 360 port_name = 'android' |
| 361 | 361 |
| 362 # Avoid initializing the adb path [worker count]+1 times by storing it as a
static member. | 362 # Avoid initializing the adb path [worker count]+1 times by storing it as a
static member. |
| 363 _adb_path = None | 363 _adb_path = None |
| 364 | 364 |
| 365 SUPPORTED_VERSIONS = ('android') | 365 SUPPORTED_VERSIONS = ('android') |
| 366 | 366 |
| 367 FALLBACK_PATHS = { 'android': [ 'chromium-android' ] + linux.LinuxPort.lates
t_platform_fallback_path() } | 367 FALLBACK_PATHS = { 'android': [ 'chromium-android' ] + linux.LinuxPort.lates
t_platform_fallback_path() } |
| 368 | 368 |
| 369 def __init__(self, host, port_name, **kwargs): | 369 def __init__(self, host, port_name, **kwargs): |
| 370 super(ChromiumAndroidPort, self).__init__(host, port_name, **kwargs) | 370 super(AndroidPort, self).__init__(host, port_name, **kwargs) |
| 371 | 371 |
| 372 self._operating_system = 'android' | 372 self._operating_system = 'android' |
| 373 self._version = 'icecreamsandwich' | 373 self._version = 'icecreamsandwich' |
| 374 | 374 |
| 375 self._host_port = factory.PortFactory(host).get('chromium', **kwargs) | 375 self._host_port = factory.PortFactory(host).get('chromium', **kwargs) |
| 376 self._server_process_constructor = self._android_server_process_construc
tor | 376 self._server_process_constructor = self._android_server_process_construc
tor |
| 377 | 377 |
| 378 if self.driver_name() != self.CONTENT_SHELL_NAME: | 378 if self.driver_name() != self.CONTENT_SHELL_NAME: |
| 379 raise AssertionError('Layout tests on Android only support content_s
hell as the driver.') | 379 raise AssertionError('Layout tests on Android only support content_s
hell as the driver.') |
| 380 | 380 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 425 |
| 426 return usable_device_count | 426 return usable_device_count |
| 427 | 427 |
| 428 def default_baseline_search_path(self): | 428 def default_baseline_search_path(self): |
| 429 return map(self._webkit_baseline_path, self.FALLBACK_PATHS['android']) | 429 return map(self._webkit_baseline_path, self.FALLBACK_PATHS['android']) |
| 430 | 430 |
| 431 def check_wdiff(self, logging=True): | 431 def check_wdiff(self, logging=True): |
| 432 return self._host_port.check_wdiff(logging) | 432 return self._host_port.check_wdiff(logging) |
| 433 | 433 |
| 434 def check_build(self, needs_http): | 434 def check_build(self, needs_http): |
| 435 result = super(ChromiumAndroidPort, self).check_build(needs_http) | 435 result = super(AndroidPort, self).check_build(needs_http) |
| 436 result = self._check_file_exists(self.path_to_md5sum(), 'md5sum utility'
) and result | 436 result = self._check_file_exists(self.path_to_md5sum(), 'md5sum utility'
) and result |
| 437 result = self._check_file_exists(self.path_to_md5sum_host(), 'md5sum hos
t utility') and result | 437 result = self._check_file_exists(self.path_to_md5sum_host(), 'md5sum hos
t utility') and result |
| 438 result = self._check_file_exists(self.path_to_forwarder(), 'forwarder ut
ility') and result | 438 result = self._check_file_exists(self.path_to_forwarder(), 'forwarder ut
ility') and result |
| 439 if not result: | 439 if not result: |
| 440 _log.error('For complete Android build requirements, please see:') | 440 _log.error('For complete Android build requirements, please see:') |
| 441 _log.error('') | 441 _log.error('') |
| 442 _log.error(' http://code.google.com/p/chromium/wiki/AndroidBuildI
nstructions') | 442 _log.error(' http://code.google.com/p/chromium/wiki/AndroidBuildI
nstructions') |
| 443 | 443 |
| 444 return result | 444 return result |
| 445 | 445 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 459 def requires_http_server(self): | 459 def requires_http_server(self): |
| 460 """Chromium Android runs tests on devices, and uses the HTTP server to | 460 """Chromium Android runs tests on devices, and uses the HTTP server to |
| 461 serve the actual layout tests to the test driver.""" | 461 serve the actual layout tests to the test driver.""" |
| 462 return True | 462 return True |
| 463 | 463 |
| 464 def start_http_server(self, additional_dirs=None, number_of_servers=0): | 464 def start_http_server(self, additional_dirs=None, number_of_servers=0): |
| 465 if not additional_dirs: | 465 if not additional_dirs: |
| 466 additional_dirs = {} | 466 additional_dirs = {} |
| 467 additional_dirs[PERF_TEST_PATH_PREFIX] = self.perf_tests_dir() | 467 additional_dirs[PERF_TEST_PATH_PREFIX] = self.perf_tests_dir() |
| 468 additional_dirs[LAYOUT_TEST_PATH_PREFIX] = self.layout_tests_dir() | 468 additional_dirs[LAYOUT_TEST_PATH_PREFIX] = self.layout_tests_dir() |
| 469 super(ChromiumAndroidPort, self).start_http_server(additional_dirs, numb
er_of_servers) | 469 super(AndroidPort, self).start_http_server(additional_dirs, number_of_se
rvers) |
| 470 | 470 |
| 471 def create_driver(self, worker_number, no_timeout=False): | 471 def create_driver(self, worker_number, no_timeout=False): |
| 472 return ChromiumAndroidDriver(self, worker_number, pixel_tests=self.get_o
ption('pixel_tests'), | 472 return ChromiumAndroidDriver(self, worker_number, pixel_tests=self.get_o
ption('pixel_tests'), |
| 473 driver_details=self._driver_details, | 473 driver_details=self._driver_details, |
| 474 android_devices=self._devices, | 474 android_devices=self._devices, |
| 475 # Force no timeout to avoid test driver tim
eouts before NRWT. | 475 # Force no timeout to avoid test driver tim
eouts before NRWT. |
| 476 no_timeout=True) | 476 no_timeout=True) |
| 477 | 477 |
| 478 def driver_cmd_line(self): | 478 def driver_cmd_line(self): |
| 479 # Override to return the actual test driver's command line. | 479 # Override to return the actual test driver's command line. |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 line = server_process.read_stdout_line(deadline) | 1061 line = server_process.read_stdout_line(deadline) |
| 1062 while not server_process.timed_out and not server_process.has_crashed()
and not text in line.rstrip(): | 1062 while not server_process.timed_out and not server_process.has_crashed()
and not text in line.rstrip(): |
| 1063 output += line | 1063 output += line |
| 1064 line = server_process.read_stdout_line(deadline) | 1064 line = server_process.read_stdout_line(deadline) |
| 1065 | 1065 |
| 1066 if server_process.timed_out or server_process.has_crashed(): | 1066 if server_process.timed_out or server_process.has_crashed(): |
| 1067 _log.error('Failed to start the %s process: \n%s' % (server_process.
name(), output)) | 1067 _log.error('Failed to start the %s process: \n%s' % (server_process.
name(), output)) |
| 1068 return False | 1068 return False |
| 1069 | 1069 |
| 1070 return True | 1070 return True |
| OLD | NEW |