| Index: build/android/pylib/local/device/local_device_instrumentation_test_run.py
|
| diff --git a/build/android/pylib/local/device/local_device_instrumentation_test_run.py b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
|
| index c95fe6d6e9bf81d10465469fd425d253e45a56a7..44ea4f01f3dbebafc765d7c89d5591fded52eec0 100644
|
| --- a/build/android/pylib/local/device/local_device_instrumentation_test_run.py
|
| +++ b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
|
| @@ -132,7 +132,7 @@ class LocalDeviceInstrumentationTestRun(
|
| logging.error("Couldn't set debug app: no package defined")
|
| else:
|
| dev.RunShellCommand(['am', 'set-debug-app', '--persistent',
|
| - self._test_instance.package_info.package],
|
| + self._test_instance.package_info.package],
|
| check_return=True)
|
| @trace_event.traced
|
| def edit_shared_prefs():
|
| @@ -386,22 +386,35 @@ class LocalDeviceInstrumentationTestRun(
|
| self._test_instance.gs_results_bucket) as screenshot_host_dir:
|
| screenshot_host_dir = (
|
| self._test_instance.screenshot_dir or screenshot_host_dir)
|
| +
|
| if screenshot_host_dir:
|
| - file_name = '%s-%s.png' % (
|
| - test_display_name,
|
| - time.strftime('%Y%m%dT%H%M%S-UTC', time.gmtime()))
|
| - screenshot_file = device.TakeScreenshot(
|
| - os.path.join(screenshot_host_dir, file_name))
|
| - logging.info(
|
| - 'Saved screenshot for %s to %s.',
|
| - test_display_name, screenshot_file)
|
| - if self._test_instance.gs_results_bucket:
|
| - link = google_storage_helper.upload(
|
| - google_storage_helper.unique_name('screenshot', device=device),
|
| - screenshot_file,
|
| - bucket=self._test_instance.gs_results_bucket + '/screenshots')
|
| - for result in results:
|
| - result.SetLink('post_test_screenshot', link)
|
| + screenshot_device_file = posixpath.join(
|
| + device.GetExternalStoragePath(),
|
| + 'chromium_tests_output_root',
|
| + instrumentation_test_instance.FAILURE_SCREENSHOT_FILE)
|
| + screenshot_host_file = os.path.join(
|
| + screenshot_host_dir,
|
| + '%s-%s.png' % (
|
| + test_display_name,
|
| + time.strftime('%Y%m%dT%H%M%S-UTC', time.gmtime())))
|
| + if device.FileExists(screenshot_device_file):
|
| + try:
|
| + device.PullFile(screenshot_device_file, screenshot_host_file)
|
| + finally:
|
| + device.RemovePath(screenshot_device_file)
|
| +
|
| + logging.info(
|
| + 'Saved screenshot for %s to %s.',
|
| + test_display_name, screenshot_host_file)
|
| + if self._test_instance.gs_results_bucket:
|
| + link = google_storage_helper.upload(
|
| + google_storage_helper.unique_name(
|
| + 'screenshot', device=device),
|
| + screenshot_host_file,
|
| + bucket=('%s/screenshots' %
|
| + self._test_instance.gs_results_bucket))
|
| + for result in results:
|
| + result.SetLink('post_test_screenshot', link)
|
|
|
| logging.info('detected failure in %s. raw output:', test_display_name)
|
| for l in output:
|
|
|