OLD | NEW |
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 import contextlib | 5 import contextlib |
6 import httplib | 6 import httplib |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import tempfile | 9 import tempfile |
10 import time | 10 import time |
(...skipping 25 matching lines...) Expand all Loading... |
36 def __init__(self, device, tool, shard_index, build_type): | 36 def __init__(self, device, tool, shard_index, build_type): |
37 """ | 37 """ |
38 Args: | 38 Args: |
39 device: Tests will run on the device of this ID. | 39 device: Tests will run on the device of this ID. |
40 shard_index: Index number of the shard on which the test suite will run. | 40 shard_index: Index number of the shard on which the test suite will run. |
41 build_type: 'Release' or 'Debug'. | 41 build_type: 'Release' or 'Debug'. |
42 """ | 42 """ |
43 self.device = device | 43 self.device = device |
44 self.adb = android_commands.AndroidCommands(device=device) | 44 self.adb = android_commands.AndroidCommands(device=device) |
45 self.tool = CreateTool(tool, self.adb) | 45 self.tool = CreateTool(tool, self.adb) |
46 # Synchronize date/time between host and device. Otherwise same file on | |
47 # host and device may have different timestamp which may cause | |
48 # AndroidCommands.PushIfNeeded failed, or a test which may compare timestamp | |
49 # got from http head and local time could be failed. | |
50 self.adb.SynchronizeDateTime() | |
51 self._http_server = None | 46 self._http_server = None |
52 self._forwarder = None | 47 self._forwarder = None |
53 self._forwarder_device_port = 8000 | 48 self._forwarder_device_port = 8000 |
54 self.forwarder_base_url = ('http://localhost:%d' % | 49 self.forwarder_base_url = ('http://localhost:%d' % |
55 self._forwarder_device_port) | 50 self._forwarder_device_port) |
56 self.flags = FlagChanger(self.adb) | 51 self.flags = FlagChanger(self.adb) |
57 self.shard_index = shard_index | 52 self.shard_index = shard_index |
58 self.flags.AddFlags(['--disable-fre']) | 53 self.flags.AddFlags(['--disable-fre']) |
59 self._spawning_server = None | 54 self._spawning_server = None |
60 self._spawner_forwarder = None | 55 self._spawner_forwarder = None |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 # Wait for 2 seconds then restart. | 227 # Wait for 2 seconds then restart. |
233 time.sleep(2) | 228 time.sleep(2) |
234 if not server_ready: | 229 if not server_ready: |
235 logging.error(';'.join(error_msgs)) | 230 logging.error(';'.join(error_msgs)) |
236 raise Exception('Can not start the test spawner server.') | 231 raise Exception('Can not start the test spawner server.') |
237 self._PushTestServerPortInfoToDevice() | 232 self._PushTestServerPortInfoToDevice() |
238 self._spawner_forwarder = Forwarder( | 233 self._spawner_forwarder = Forwarder( |
239 self.adb, | 234 self.adb, |
240 [(self.test_server_spawner_port, self.test_server_spawner_port)], | 235 [(self.test_server_spawner_port, self.test_server_spawner_port)], |
241 self.tool, '127.0.0.1', self.build_type) | 236 self.tool, '127.0.0.1', self.build_type) |
OLD | NEW |