OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 inspect | 5 import inspect |
6 import logging | 6 import logging |
7 import re | 7 import re |
8 import unittest | 8 import unittest |
9 | 9 |
10 from py_utils import cloud_storage | 10 from py_utils import cloud_storage |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 archive_path: Path to the WPR file. If there is a corresponding sha1 file, | 84 archive_path: Path to the WPR file. If there is a corresponding sha1 file, |
85 this archive will be automatically downloaded from Google Storage. | 85 this archive will be automatically downloaded from Google Storage. |
86 archive_bucket: The bucket to look for the WPR archive. | 86 archive_bucket: The bucket to look for the WPR archive. |
87 """ | 87 """ |
88 assert cls._browser_options, ( | 88 assert cls._browser_options, ( |
89 'Browser options must be set with |SetBrowserOptions| prior to ' | 89 'Browser options must be set with |SetBrowserOptions| prior to ' |
90 'starting WPR') | 90 'starting WPR') |
91 assert not cls.browser, 'WPR must be started prior to browser being started' | 91 assert not cls.browser, 'WPR must be started prior to browser being started' |
92 | 92 |
93 cloud_storage.GetIfChanged(archive_path, archive_bucket) | 93 cloud_storage.GetIfChanged(archive_path, archive_bucket) |
94 cls.platform.network_controller.Open(wpr_modes.WPR_REPLAY, []) | 94 use_wpr_go = archive_path.endswith('.wprgo') |
| 95 cls.platform.network_controller.Open(wpr_modes.WPR_REPLAY, [], |
| 96 use_wpr_go=use_wpr_go) |
95 cls.platform.network_controller.StartReplay(archive_path=archive_path) | 97 cls.platform.network_controller.StartReplay(archive_path=archive_path) |
96 | 98 |
97 @classmethod | 99 @classmethod |
98 def StopWPRServer(cls): | 100 def StopWPRServer(cls): |
99 cls.platform.network_controller.StopReplay() | 101 cls.platform.network_controller.StopReplay() |
100 | 102 |
101 @classmethod | 103 @classmethod |
102 def StartBrowser(cls): | 104 def StartBrowser(cls): |
103 assert cls._browser_options, ( | 105 assert cls._browser_options, ( |
104 'Browser options must be set with |SetBrowserOptions| prior to ' | 106 'Browser options must be set with |SetBrowserOptions| prior to ' |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 assert hasattr(test_class, based_method_name), ( | 221 assert hasattr(test_class, based_method_name), ( |
220 '%s is specified but based method %s does not exist' % | 222 '%s is specified but based method %s does not exist' % |
221 (name, based_method_name)) | 223 (name, based_method_name)) |
222 based_method = getattr(test_class, based_method_name) | 224 based_method = getattr(test_class, based_method_name) |
223 for generated_test_name, args in method(finder_options): | 225 for generated_test_name, args in method(finder_options): |
224 _ValidateTestMethodname(generated_test_name) | 226 _ValidateTestMethodname(generated_test_name) |
225 setattr(test_class, generated_test_name, _GenerateTestMethod( | 227 setattr(test_class, generated_test_name, _GenerateTestMethod( |
226 based_method, args)) | 228 based_method, args)) |
227 test_cases.append(test_class(generated_test_name)) | 229 test_cases.append(test_class(generated_test_name)) |
228 return test_cases | 230 return test_cases |
OLD | NEW |