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 | 5 |
6 class Environment(object): | 6 class Environment(object): |
7 """An environment in which tests can be run. | 7 """An environment in which tests can be run. |
8 | 8 |
9 This is expected to handle all logic that is applicable to an entire specific | 9 This is expected to handle all logic that is applicable to an entire specific |
10 environment but is independent of the test type. | 10 environment but is independent of the test type. |
11 | 11 |
12 Examples include: | 12 Examples include: |
13 - The local device environment, for running tests on devices attached to | 13 - The local device environment, for running tests on devices attached to |
14 the local machine. | 14 the local machine. |
15 - The local machine environment, for running tests directly on the local | 15 - The local machine environment, for running tests directly on the local |
16 machine. | 16 machine. |
17 """ | 17 """ |
18 | 18 |
19 def __init__(self): | 19 def __init__(self, output_manager): |
20 pass | 20 """Environment constructor. |
| 21 |
| 22 Args: |
| 23 output_manager: Instance of |output_manager.OutputManager| used to |
| 24 save test output. |
| 25 """ |
| 26 self._output_manager = output_manager |
21 | 27 |
22 def SetUp(self): | 28 def SetUp(self): |
23 raise NotImplementedError | 29 raise NotImplementedError |
24 | 30 |
25 def TearDown(self): | 31 def TearDown(self): |
26 raise NotImplementedError | 32 raise NotImplementedError |
27 | 33 |
28 def __enter__(self): | 34 def __enter__(self): |
29 self.SetUp() | 35 self.SetUp() |
30 return self | 36 return self |
31 | 37 |
32 def __exit__(self, _exc_type, _exc_val, _exc_tb): | 38 def __exit__(self, _exc_type, _exc_val, _exc_tb): |
33 self.TearDown() | 39 self.TearDown() |
34 | 40 |
| 41 @property |
| 42 def output_manager(self): |
| 43 return self._output_manager |
OLD | NEW |