OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 """Run specific test on specific environment.""" | 5 """Run specific test on specific environment.""" |
6 | 6 |
7 import json | 7 import json |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import sys | 10 import sys |
11 import tempfile | 11 import tempfile |
12 import time | 12 import time |
13 import zipfile | 13 import zipfile |
14 | 14 |
15 from pylib import constants | 15 from pylib import constants |
16 from pylib.base import test_run | 16 from pylib.base import test_run |
17 from pylib.remote.device import appurify_sanitized | 17 from pylib.remote.device import appurify_sanitized |
18 from pylib.remote.device import remote_device_helper | 18 from pylib.remote.device import remote_device_helper |
19 from pylib.utils import zip_utils | 19 from pylib.utils import zip_utils |
20 | 20 |
21 class RemoteDeviceTestRun(test_run.TestRun): | 21 class RemoteDeviceTestRun(test_run.TestRun): |
22 """Run gtests and uirobot tests on a remote device.""" | 22 """Run tests on a remote device.""" |
23 | 23 |
24 _TEST_RUN_KEY = 'test_run' | 24 _TEST_RUN_KEY = 'test_run' |
25 _TEST_RUN_ID_KEY = 'test_run_id' | 25 _TEST_RUN_ID_KEY = 'test_run_id' |
26 | 26 |
27 WAIT_TIME = 5 | 27 WAIT_TIME = 5 |
28 COMPLETE = 'complete' | 28 COMPLETE = 'complete' |
29 HEARTBEAT_INTERVAL = 300 | 29 HEARTBEAT_INTERVAL = 300 |
30 | 30 |
31 def __init__(self, env, test_instance): | 31 def __init__(self, env, test_instance): |
32 """Constructor. | 32 """Constructor. |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 config_data.extend('%s=%s' % (k, v) for k, v in body.iteritems()) | 270 config_data.extend('%s=%s' % (k, v) for k, v in body.iteritems()) |
271 config.write(''.join('%s\n' % l for l in config_data)) | 271 config.write(''.join('%s\n' % l for l in config_data)) |
272 config.flush() | 272 config.flush() |
273 config.seek(0) | 273 config.seek(0) |
274 with appurify_sanitized.SanitizeLogging(self._env.verbose_count, | 274 with appurify_sanitized.SanitizeLogging(self._env.verbose_count, |
275 logging.WARNING): | 275 logging.WARNING): |
276 config_response = appurify_sanitized.api.config_upload( | 276 config_response = appurify_sanitized.api.config_upload( |
277 self._env.token, config, self._test_id) | 277 self._env.token, config, self._test_id) |
278 remote_device_helper.TestHttpResponse( | 278 remote_device_helper.TestHttpResponse( |
279 config_response, 'Unable to upload test config.') | 279 config_response, 'Unable to upload test config.') |
OLD | NEW |