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

Side by Side Diff: build/android/pylib/remote/device/remote_device_instrumentation_test_run.py

Issue 832493005: Add Instrumentation test support to remote device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
(Empty)
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
3 # found in the LICENSE file.
4
5 """Run specific test on specific environment."""
6
7 import logging
8 import os
9 import tempfile
10
11 from pylib.base import base_test_result
12 from pylib.remote.device import remote_device_test_run
13 from pylib.utils import apk_helper
14
15
16 class RemoteDeviceInstrumentationTestRun(
17 remote_device_test_run.RemoteDeviceTestRun):
18 """Run instrumentation tests on a remote device."""
19
20 #override
21 def TestPackage(self):
22 return self._test_instance.test_package
23
24 #override
25 def _TriggerSetUp(self):
26 """Set up the triggering of a test run."""
27 logging.info('Triggering test run.')
28 self._AmInstrumentTestSetup(
29 self._test_instance._apk_under_test, self._test_instance.test_apk,
30 self._test_instance.test_runner, environment_variables={})
31
32 #override
33 def _ParseTestResults(self):
34 logging.info('Parsing results from stdout.')
35 r = base_test_result.TestRunResults()
36
37 if self._results['results']['exception']:
38 r.AddResult(base_test_result.BaseTestResult(
39 self._results['results']['exception'],
40 base_test_result.ResultType.FAIL))
41 return r
42
43 _, errors, parsed_output = self._test_instance.ParseAmInstrumentRawOutput(
44 self._results['results']['output'].splitlines())
45 logging.debug(errors)
46 result = self._test_instance.GenerateMultiTestResult(errors, parsed_output)
47
48 if isinstance(result, base_test_result.BaseTestResult):
49 r.AddResult(result)
50 elif isinstance(result, list):
51 r.AddResults(result)
52 else:
53 raise Exception('Unexpected result type: %s' % type(result).__name__)
54
55 return r
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698