Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: telemetry/telemetry/testing/browser_test_context.py

Issue 2700563004: [Telemetry] Migrate browser_test_runner to use typ as the test runner (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 _ client_configs: list of client configs that contain infos about binaries
20 to use.
21 _ finder_options: the commandline options object. This is an instance of
22 telemetry.internal.browser.browser_options.BrowserFinderOptions.
23 _ test_class: the name of the test class to be run.
24 _ test_case_ids_to_run: the ids of the test cases to be run. e.g:
25 foo.bar.Test1, foo.bar.Test2,..
26
27
28 This object is designed to be pickle-able so that it can be easily pass from
29 the main process to test subprocesses. It also supports immutable mode to
30 ensure its data won't be changed by the subprocesses.
31 """
32 def __init__(self):
33 self._client_configs = []
34 self._finder_options = None
35 self._test_class = None
36 self._test_cases_ids_to_run = set()
37 self._frozen = False
38
39 def Freeze(self):
40 """ Makes the |self| object immutable.
41
42 Calling setter on |self|'s property will throw exception.
43 """
44 assert self._finder_options
45 assert self._test_class
46 self._frozen = True
47 self._test_cases_ids_to_run = sets.ImmutableSet(self._test_cases_ids_to_run)
48 self._client_configs = tuple(self._client_configs)
49
50 @property
51 def finder_options(self):
52 return self._finder_options
53
54 @property
55 def client_configs(self):
56 return self._client_configs
57
58 @property
59 def test_class(self):
60 return self._test_class
61
62 @property
63 def test_case_ids_to_run(self):
64 return self._test_cases_ids_to_run
65
66 @finder_options.setter
67 def finder_options(self, value):
68 assert not self._frozen
69 self._finder_options = value
70
71 @test_class.setter
72 def test_class(self, value):
73 assert not self._test_class
74 self._test_class = value
OLDNEW
« no previous file with comments | « telemetry/examples/browser_tests/simple_browser_test.py ('k') | telemetry/telemetry/testing/browser_test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698