Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import copy | |
| 6 import sets | |
| 7 | |
| 8 | |
| 9 _global_test_context = None | |
| 10 | |
| 11 | |
| 12 def GetCopy(): | |
| 13 return copy.deepcopy(_global_test_context) | |
| 14 | |
| 15 | |
| 16 class TypTestContext(object): | |
| 17 """ The TestContext that is used for passing data from the main test process | |
| 18 to typ's subprocesses. Those includes: | |
| 19 _ finder_options: the commandline options object. This is an instance of | |
| 20 telemetry.internal.browser.browser_options.BrowserFinderOptions. | |
| 21 _ test_class_name: the name of the test class to be run. | |
| 22 _ test_cases_ids_to_run: the ids of the test cases to be run. | |
|
Ken Russell (switch to Gerrit)
2016/12/21 00:12:59
Grammar: here and throughout: test_cases_ids -> te
nednguyen
2016/12/21 20:29:04
Done.
| |
| 23 | |
| 24 This object is designed to be pickle-able so that it can be easily pass from | |
| 25 the main process to test subprocesses. It also supports immutable mode to | |
| 26 ensure its data won't be changed by the subprocesses. | |
| 27 """ | |
| 28 def __init__(self): | |
| 29 self._finder_options = None | |
| 30 self._test_class_name = None | |
| 31 self._test_cases_ids_to_run = set() | |
| 32 self._frozen = False | |
| 33 | |
| 34 def Freeze(self): | |
| 35 """ Makes the |self| object immutable. | |
| 36 | |
| 37 Calling setter on |self|'s property will throw exception. | |
| 38 """ | |
| 39 assert self._finder_options | |
| 40 assert self._test_class_name | |
| 41 self._frozen = True | |
| 42 self._test_cases_ids_to_run = sets.ImmutableSet(self._test_cases_ids_to_run) | |
| 43 | |
| 44 @property | |
| 45 def finder_options(self): | |
| 46 return self._finder_options | |
| 47 | |
| 48 @property | |
| 49 def test_class_name(self): | |
| 50 return self._test_class_name | |
| 51 | |
| 52 @property | |
| 53 def test_cases_ids_to_run(self): | |
| 54 return self._test_cases_ids_to_run | |
| 55 | |
| 56 @finder_options.setter | |
| 57 def finder_options(self, value): | |
| 58 assert not self._frozen | |
| 59 self._finder_options = value | |
| 60 | |
| 61 @test_class_name.setter | |
| 62 def test_class_name(self, value): | |
| 63 assert not self._test_class_name | |
| 64 self._test_class_name = value | |
| OLD | NEW |