| 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 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 self._test_id = '' | 42 self._test_id = '' |
| 43 self._results = '' | 43 self._results = '' |
| 44 self._test_run_id = '' | 44 self._test_run_id = '' |
| 45 | 45 |
| 46 #override | 46 #override |
| 47 def SetUp(self): | 47 def SetUp(self): |
| 48 """Set up a test run.""" | 48 """Set up a test run.""" |
| 49 if self._env.trigger: | 49 if self._env.trigger: |
| 50 self._TriggerSetUp() | 50 self._TriggerSetUp() |
| 51 elif self._env.collect: | 51 elif self._env.collect: |
| 52 assert isinstance(self._env.trigger, basestring), ( | 52 assert isinstance(self._env.collect, basestring), ( |
| 53 'File for storing test_run_id must be a string.') | 53 'File for storing test_run_id must be a string.') |
| 54 with open(self._env.collect, 'r') as persisted_data_file: | 54 with open(self._env.collect, 'r') as persisted_data_file: |
| 55 persisted_data = json.loads(persisted_data_file.read()) | 55 persisted_data = json.loads(persisted_data_file.read()) |
| 56 self._env.LoadFrom(persisted_data) | 56 self._env.LoadFrom(persisted_data) |
| 57 self.LoadFrom(persisted_data) | 57 self.LoadFrom(persisted_data) |
| 58 | 58 |
| 59 def _TriggerSetUp(self): | 59 def _TriggerSetUp(self): |
| 60 """Set up the triggering of a test run.""" | 60 """Set up the triggering of a test run.""" |
| 61 raise NotImplementedError | 61 raise NotImplementedError |
| 62 | 62 |
| (...skipping 207 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 |