Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: build/android/pylib/local/device/local_device_instrumentation_test_run.py

Issue 1981043004: Added the --screenshot option. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed file name format Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import os
6 import re 7 import re
7 import time 8 import time
8 9
9 from devil.android import device_errors 10 from devil.android import device_errors
10 from devil.android import flag_changer 11 from devil.android import flag_changer
12 from devil.android.device_utils import _GetTimeStamp
BigBossZhiling 2016/05/19 00:43:10 If I just do, from devil.android import device_uti
mikecase (-- gone --) 2016/05/19 00:49:27 You should change the name to GetTimeStamp if you
jbudorick 2016/05/19 18:11:42 No, don't do this, and don't use _GetTimeStamp. Ju
BigBossZhiling 2016/05/19 18:23:49 Done.
11 from devil.utils import reraiser_thread 13 from devil.utils import reraiser_thread
12 from pylib import valgrind_tools 14 from pylib import valgrind_tools
13 from pylib.base import base_test_result 15 from pylib.base import base_test_result
14 from pylib.local.device import local_device_test_run 16 from pylib.local.device import local_device_test_run
15 17
16 18
17 TIMEOUT_ANNOTATIONS = [ 19 TIMEOUT_ANNOTATIONS = [
18 ('Manual', 10 * 60 * 60), 20 ('Manual', 10 * 60 * 60),
19 ('IntegrationTest', 30 * 60), 21 ('IntegrationTest', 30 * 60),
20 ('External', 10 * 60), 22 ('External', 10 * 60),
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 if r.GetName() == test_name: 258 if r.GetName() == test_name:
257 r.SetName(test_display_name) 259 r.SetName(test_display_name)
258 if DidPackageCrashOnDevice(self._test_instance.test_package, device): 260 if DidPackageCrashOnDevice(self._test_instance.test_package, device):
259 for r in results: 261 for r in results:
260 if r.GetType() == base_test_result.ResultType.UNKNOWN: 262 if r.GetType() == base_test_result.ResultType.UNKNOWN:
261 r.SetType(base_test_result.ResultType.CRASH) 263 r.SetType(base_test_result.ResultType.CRASH)
262 264
263 if any(r.GetType() not in (base_test_result.ResultType.PASS, 265 if any(r.GetType() not in (base_test_result.ResultType.PASS,
264 base_test_result.ResultType.SKIP) 266 base_test_result.ResultType.SKIP)
265 for r in results): 267 for r in results):
268 if self._test_instance.screenshot_dir:
269 file_name = '%s-%s.png' % (test_display_name, _GetTimeStamp())
270 saved_dir = device.TakeScreenshot(
271 os.path.join(self._test_instance.screenshot_dir, file_name))
272 logging.info('Saved screenshot for %s to %s.',
273 test_display_name, saved_dir)
266 logging.info('detected failure in %s. raw output:', test_display_name) 274 logging.info('detected failure in %s. raw output:', test_display_name)
267 for l in output: 275 for l in output:
268 logging.info(' %s', l) 276 logging.info(' %s', l)
269 if (not self._env.skip_clear_data 277 if (not self._env.skip_clear_data
270 and self._test_instance.package_info): 278 and self._test_instance.package_info):
271 permissions = ( 279 permissions = (
272 self._test_instance.apk_under_test.GetPermissions() 280 self._test_instance.apk_under_test.GetPermissions()
273 if self._test_instance.apk_under_test 281 if self._test_instance.apk_under_test
274 else None) 282 else None)
275 device.ClearApplicationState(self._test_instance.package_info.package, 283 device.ClearApplicationState(self._test_instance.package_info.package,
(...skipping 25 matching lines...) Expand all
301 timeout = v 309 timeout = v
302 break 310 break
303 else: 311 else:
304 logging.warning('Using default 1 minute timeout for %s', test_name) 312 logging.warning('Using default 1 minute timeout for %s', test_name)
305 timeout = 60 313 timeout = 60
306 314
307 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) 315 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations)
308 316
309 return timeout 317 return timeout
310 318
OLDNEW
« no previous file with comments | « build/android/pylib/instrumentation/instrumentation_test_instance.py ('k') | build/android/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698