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

Side by Side Diff: build/android/pylib/run_java_tests.py

Issue 11366068: Take screenshots using /system/bin/screencap instead of monkeyrunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed bulach's comments Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « build/android/pylib/constants.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Runs the Java tests. See more information on run_instrumentation_tests.py.""" 5 """Runs the Java tests. See more information on run_instrumentation_tests.py."""
6 6
7 import fnmatch 7 import fnmatch
8 import logging 8 import logging
9 import os 9 import os
10 import re 10 import re
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 def _GetInstrumentationArgs(self): 234 def _GetInstrumentationArgs(self):
235 ret = {} 235 ret = {}
236 if self.coverage: 236 if self.coverage:
237 ret['coverage'] = 'true' 237 ret['coverage'] = 'true'
238 if self.wait_for_debugger: 238 if self.wait_for_debugger:
239 ret['debug'] = 'true' 239 ret['debug'] = 'true'
240 return ret 240 return ret
241 241
242 def _TakeScreenshot(self, test): 242 def _TakeScreenshot(self, test):
243 """Takes a screenshot from the device.""" 243 """Takes a screenshot from the device."""
244 screenshot_tool = os.path.join(constants.CHROME_DIR, 244 screenshot_name = os.path.join(constants.SCREENSHOTS_DIR, test + '.png')
245 'third_party/android_tools/sdk/tools/monkeyrunner')
246 screenshot_script = os.path.join(constants.CHROME_DIR,
247 'build/android/monkeyrunner_screenshot.py')
248 screenshot_path = os.path.join(constants.CHROME_DIR,
249 'out_screenshots')
250 if not os.path.exists(screenshot_path):
251 os.mkdir(screenshot_path)
252 screenshot_name = os.path.join(screenshot_path, test + '.png')
253 logging.info('Taking screenshot named %s', screenshot_name) 245 logging.info('Taking screenshot named %s', screenshot_name)
254 cmd_helper.RunCmd([screenshot_tool, screenshot_script, 246 self.adb.TakeScreenshot(screenshot_name)
255 '--serial', self.device,
256 '--file', screenshot_name])
257 247
258 def SetUp(self): 248 def SetUp(self):
259 """Sets up the test harness and device before all tests are run.""" 249 """Sets up the test harness and device before all tests are run."""
260 super(TestRunner, self).SetUp() 250 super(TestRunner, self).SetUp()
261 if not self.adb.IsRootEnabled(): 251 if not self.adb.IsRootEnabled():
262 logging.warning('Unable to enable java asserts for %s, non rooted device', 252 logging.warning('Unable to enable java asserts for %s, non rooted device',
263 self.device) 253 self.device)
264 else: 254 else:
265 if self.adb.SetJavaAssertsEnabled(enable=True): 255 if self.adb.SetJavaAssertsEnabled(enable=True):
266 self.adb.Reboot(full_reboot=False) 256 self.adb.Reboot(full_reboot=False)
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 572
583 logging.info('Will run: %s', str(tests)) 573 logging.info('Will run: %s', str(tests))
584 574
585 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger): 575 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger):
586 logging.warning('Coverage / debugger can not be sharded, ' 576 logging.warning('Coverage / debugger can not be sharded, '
587 'using first available device') 577 'using first available device')
588 attached_devices = attached_devices[:1] 578 attached_devices = attached_devices[:1]
589 sharder = TestSharder(attached_devices, options, tests, apks) 579 sharder = TestSharder(attached_devices, options, tests, apks)
590 test_results = sharder.RunShardedTests() 580 test_results = sharder.RunShardedTests()
591 return test_results 581 return test_results
OLDNEW
« no previous file with comments | « build/android/pylib/constants.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698