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

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

Issue 2101243005: Add a snapshot of flutter/engine/src/build to our sdk (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add README.dart Created 4 years, 5 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 2014 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 sys
10
11 from pylib import constants
12 from pylib.base import base_test_result
13 from pylib.remote.device import appurify_sanitized
14 from pylib.remote.device import remote_device_test_run
15 from pylib.remote.device import remote_device_helper
16
17
18 class RemoteDeviceUirobotTestRun(remote_device_test_run.RemoteDeviceTestRun):
19 """Run uirobot tests on a remote device."""
20
21
22 def __init__(self, env, test_instance):
23 """Constructor.
24
25 Args:
26 env: Environment the tests will run in.
27 test_instance: The test that will be run.
28 """
29 super(RemoteDeviceUirobotTestRun, self).__init__(env, test_instance)
30
31 #override
32 def TestPackage(self):
33 return self._test_instance.package_name
34
35 #override
36 def _TriggerSetUp(self):
37 """Set up the triggering of a test run."""
38 logging.info('Triggering test run.')
39
40 if self._env.device_type == 'Android':
41 default_runner_type = 'android_robot'
42 elif self._env.device_type == 'iOS':
43 default_runner_type = 'ios_robot'
44 else:
45 raise remote_device_helper.RemoteDeviceError(
46 'Unknown device type: %s' % self._env.device_type)
47
48 self._app_id = self._UploadAppToDevice(self._test_instance.app_under_test)
49 if not self._env.runner_type:
50 runner_type = default_runner_type
51 logging.info('Using default runner type: %s', default_runner_type)
52 else:
53 runner_type = self._env.runner_type
54
55 self._test_id = self._UploadTestToDevice(
56 'android_robot', None, app_id=self._app_id)
57 config_body = {'duration': self._test_instance.minutes}
58 self._SetTestConfig(runner_type, config_body)
59
60
61 # TODO(rnephew): Switch to base class implementation when supported.
62 #override
63 def _UploadTestToDevice(self, test_type, test_path, app_id=None):
64 if test_path:
65 logging.info("Ignoring test path.")
66 data = {
67 'access_token':self._env.token,
68 'test_type':test_type,
69 'app_id':app_id,
70 }
71 with appurify_sanitized.SanitizeLogging(self._env.verbose_count,
72 logging.WARNING):
73 test_upload_res = appurify_sanitized.utils.post('tests/upload',
74 data, None)
75 remote_device_helper.TestHttpResponse(
76 test_upload_res, 'Unable to get UiRobot test id.')
77 return test_upload_res.json()['response']['test_id']
78
79 #override
80 def _ParseTestResults(self):
81 logging.info('Parsing results from remote service.')
82 results = base_test_result.TestRunResults()
83 if self._results['results']['pass']:
84 result_type = base_test_result.ResultType.PASS
85 else:
86 result_type = base_test_result.ResultType.FAIL
87 results.AddResult(base_test_result.BaseTestResult('uirobot', result_type))
88 return results
OLDNEW
« no previous file with comments | « build/android/pylib/remote/device/remote_device_test_run.py ('k') | build/android/pylib/restart_adbd.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698