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 import re | 5 import re |
6 from telemetry.user_story import shared_user_story_state | 6 from telemetry.user_story import shared_user_story_state |
7 | 7 |
8 _next_user_story_id = 0 | 8 _next_user_story_id = 0 |
9 | 9 |
10 | 10 |
11 class UserStory(object): | 11 class UserStory(object): |
12 """A class styled on unittest.TestCase for creating user story tests. | 12 """A class styled on unittest.TestCase for creating user story tests. |
13 | 13 |
14 Test should override Run to maybe start the application and perform actions | 14 Test should override Run to maybe start the application and perform actions |
15 onto it. To share state between different tests, one can define a | 15 onto it. To share state between different tests, one can define a |
16 shared_user_story_state which contains hooks that will be called before & | 16 shared_user_story_state which contains hooks that will be called before & |
17 after mutiple user stories run and in between runs. | 17 after mutiple user stories run and in between runs. |
18 | 18 |
19 Args: | 19 Args: |
20 shared_user_story_state_class: subclass of | 20 shared_user_story_state_class: subclass of |
21 telemetry.user_story.shared_user_story_state.SharedUserStoryState. | 21 telemetry.user_story.shared_user_story_state.SharedUserStoryState. |
22 name: string name of this user story that can be used for identifying user | 22 name: string name of this user story that can be used for identifying user |
23 story in results output. | 23 story in results output. |
24 labels: A list or set of string labels that are used for filtering. See | 24 labels: A list or set of string labels that are used for filtering. See |
25 user_story.user_story_filter for more information. | 25 story.story_filter for more information. |
26 is_local: If true, the user story does not require network. | 26 is_local: If true, the user story does not require network. |
27 """ | 27 """ |
28 | 28 |
29 def __init__(self, shared_user_story_state_class, name='', labels=None, | 29 def __init__(self, shared_user_story_state_class, name='', labels=None, |
30 is_local=False, make_javascript_deterministic=True): | 30 is_local=False, make_javascript_deterministic=True): |
31 """ | 31 """ |
32 Args: | 32 Args: |
33 make_javascript_deterministic: Whether JavaScript performed on | 33 make_javascript_deterministic: Whether JavaScript performed on |
34 the page is made deterministic across multiple runs. This | 34 the page is made deterministic across multiple runs. This |
35 requires that the web content is served via Web Page Replay | 35 requires that the web content is served via Web Page Replay |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 def serving_dir(self): | 102 def serving_dir(self): |
103 """Returns the absolute path to a directory with hash files to data that | 103 """Returns the absolute path to a directory with hash files to data that |
104 should be updated from cloud storage, or None if no files need to be | 104 should be updated from cloud storage, or None if no files need to be |
105 updated. | 105 updated. |
106 """ | 106 """ |
107 return None | 107 return None |
108 | 108 |
109 @property | 109 @property |
110 def make_javascript_deterministic(self): | 110 def make_javascript_deterministic(self): |
111 return self._make_javascript_deterministic | 111 return self._make_javascript_deterministic |
OLD | NEW |