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 """Class for running instrumentation tests on a single device.""" | 5 """Class for running instrumentation tests on a single device.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import re | 9 import re |
10 import sys | 10 import sys |
11 import time | 11 import time |
12 | 12 |
13 from pylib import constants | 13 from pylib import constants |
14 from pylib import device_settings | |
14 from pylib import flag_changer | 15 from pylib import flag_changer |
15 from pylib import valgrind_tools | 16 from pylib import valgrind_tools |
16 from pylib.base import base_test_result | 17 from pylib.base import base_test_result |
17 from pylib.base import base_test_runner | 18 from pylib.base import base_test_runner |
18 from pylib.device import device_errors | 19 from pylib.device import device_errors |
19 from pylib.instrumentation import instrumentation_test_instance | 20 from pylib.instrumentation import instrumentation_test_instance |
20 from pylib.instrumentation import json_perf_parser | 21 from pylib.instrumentation import json_perf_parser |
21 from pylib.instrumentation import test_result | 22 from pylib.instrumentation import test_result |
22 from pylib.local.device import local_device_instrumentation_test_run | 23 from pylib.local.device import local_device_instrumentation_test_run |
23 | 24 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 def SetUp(self): | 92 def SetUp(self): |
92 """Sets up the test harness and device before all tests are run.""" | 93 """Sets up the test harness and device before all tests are run.""" |
93 super(TestRunner, self).SetUp() | 94 super(TestRunner, self).SetUp() |
94 if not self.device.HasRoot(): | 95 if not self.device.HasRoot(): |
95 logging.warning('Unable to enable java asserts for %s, non rooted device', | 96 logging.warning('Unable to enable java asserts for %s, non rooted device', |
96 str(self.device)) | 97 str(self.device)) |
97 else: | 98 else: |
98 if self.device.SetJavaAsserts(self.options.set_asserts): | 99 if self.device.SetJavaAsserts(self.options.set_asserts): |
99 # TODO(jbudorick) How to best do shell restart after the | 100 # TODO(jbudorick) How to best do shell restart after the |
100 # android_commands refactor? | 101 # android_commands refactor? |
102 device_settings.SetLockScreenSettings(self.device) | |
jbudorick
2015/05/29 13:06:15
Why would we set the lock screen settings here?
JungJik
2015/06/01 14:44:51
When I execute the instrumentation,
if the lock sc
jbudorick
2015/06/01 14:50:56
This isn't in the scope of the test runner. We han
JungJik
2015/06/02 16:09:45
thanks for your help. I've checked the file.
I've
| |
101 self.device.RunShellCommand('stop') | 103 self.device.RunShellCommand('stop') |
102 self.device.RunShellCommand('start') | 104 self.device.RunShellCommand('start') |
105 self.device.WaitUntilFullyBooted() | |
103 | 106 |
104 # We give different default value to launch HTTP server based on shard index | 107 # We give different default value to launch HTTP server based on shard index |
105 # because it may have race condition when multiple processes are trying to | 108 # because it may have race condition when multiple processes are trying to |
106 # launch lighttpd with same port at same time. | 109 # launch lighttpd with same port at same time. |
107 self.LaunchTestHttpServer( | 110 self.LaunchTestHttpServer( |
108 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) | 111 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) |
109 if self.flags: | 112 if self.flags: |
110 self.flags.AddFlags(['--disable-fre', '--enable-test-intents']) | 113 self.flags.AddFlags(['--disable-fre', '--enable-test-intents']) |
111 if self.options.device_flags: | 114 if self.options.device_flags: |
112 with open(self.options.device_flags) as device_flags_file: | 115 with open(self.options.device_flags) as device_flags_file: |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 except device_errors.CommandTimeoutError as e: | 362 except device_errors.CommandTimeoutError as e: |
360 results.AddResult(test_result.InstrumentationTestResult( | 363 results.AddResult(test_result.InstrumentationTestResult( |
361 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, | 364 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, |
362 log=str(e) or 'No information')) | 365 log=str(e) or 'No information')) |
363 except device_errors.DeviceUnreachableError as e: | 366 except device_errors.DeviceUnreachableError as e: |
364 results.AddResult(test_result.InstrumentationTestResult( | 367 results.AddResult(test_result.InstrumentationTestResult( |
365 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, | 368 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, |
366 log=str(e) or 'No information')) | 369 log=str(e) or 'No information')) |
367 self.TestTeardown(test, results) | 370 self.TestTeardown(test, results) |
368 return (results, None if results.DidRunPass() else test) | 371 return (results, None if results.DidRunPass() else test) |
OLD | NEW |