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

Side by Side Diff: Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py

Issue 561733003: Remove direct Host creation from RebaselineServer. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
1 # Copyright (c) 2010 Google Inc. All rights reserved. 1 # Copyright (c) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 13 matching lines...) Expand all
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 import fnmatch 29 import fnmatch
30 import os 30 import os
31 import os.path 31 import os.path
32 import BaseHTTPServer 32 import BaseHTTPServer
33 33
34 from webkitpy.common.host import Host # FIXME: This should not be needed!
35 from webkitpy.layout_tests.port.base import Port 34 from webkitpy.layout_tests.port.base import Port
36 from webkitpy.tool.servers.reflectionhandler import ReflectionHandler 35 from webkitpy.tool.servers.reflectionhandler import ReflectionHandler
37 36
38 37
39 STATE_NEEDS_REBASELINE = 'needs_rebaseline' 38 STATE_NEEDS_REBASELINE = 'needs_rebaseline'
40 STATE_REBASELINE_FAILED = 'rebaseline_failed' 39 STATE_REBASELINE_FAILED = 'rebaseline_failed'
41 STATE_REBASELINE_SUCCEEDED = 'rebaseline_succeeded' 40 STATE_REBASELINE_SUCCEEDED = 'rebaseline_succeeded'
42 41
43 42
44 def _get_actual_result_files(test_file, test_config): 43 def _get_actual_result_files(test_file, test_config):
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 super(AllPlatformsPort, self).__init__(host, 'mac') 167 super(AllPlatformsPort, self).__init__(host, 'mac')
169 self._platforms_by_directory = dict([(self._webkit_baseline_path(p), p) for p in test_config.platforms]) 168 self._platforms_by_directory = dict([(self._webkit_baseline_path(p), p) for p in test_config.platforms])
170 169
171 def baseline_search_path(self): 170 def baseline_search_path(self):
172 return self._platforms_by_directory.keys() 171 return self._platforms_by_directory.keys()
173 172
174 def platform_from_directory(self, directory): 173 def platform_from_directory(self, directory):
175 return self._platforms_by_directory[directory] 174 return self._platforms_by_directory[directory]
176 175
177 test_path = test_config.filesystem.join(test_config.layout_tests_directory, test_file) 176 test_path = test_config.filesystem.join(test_config.layout_tests_directory, test_file)
178 177 host = test_config.host
179 # FIXME: This should get the Host from the test_config to be mockable!
180 host = Host()
181 host.initialize_scm()
182 host.filesystem = test_config.filesystem
183 all_platforms_port = AllPlatformsPort(host) 178 all_platforms_port = AllPlatformsPort(host)
184 179
185 all_test_baselines = {} 180 all_test_baselines = {}
186 for baseline_extension in ('.txt', '.checksum', '.png'): 181 for baseline_extension in ('.txt', '.checksum', '.png'):
187 test_baselines = test_config.test_port.expected_baselines(test_file, bas eline_extension) 182 test_baselines = test_config.test_port.expected_baselines(test_file, bas eline_extension)
188 baselines = all_platforms_port.expected_baselines(test_file, baseline_ex tension, all_baselines=True) 183 baselines = all_platforms_port.expected_baselines(test_file, baseline_ex tension, all_baselines=True)
189 for platform_directory, expected_filename in baselines: 184 for platform_directory, expected_filename in baselines:
190 if not platform_directory: 185 if not platform_directory:
191 continue 186 continue
192 if platform_directory == test_config.layout_tests_directory: 187 if platform_directory == test_config.layout_tests_directory:
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 elif mode == 'diff-text': 274 elif mode == 'diff-text':
280 file_name = test_name + '-diff.txt' 275 file_name = test_name + '-diff.txt'
281 elif mode == 'diff-text-pretty': 276 elif mode == 'diff-text-pretty':
282 file_name = test_name + '-pretty-diff.html' 277 file_name = test_name + '-pretty-diff.html'
283 278
284 file_path = os.path.join(self.server.test_config.results_directory, file _name) 279 file_path = os.path.join(self.server.test_config.results_directory, file _name)
285 280
286 # Let results be cached for 60 seconds, so that they can be pre-fetched 281 # Let results be cached for 60 seconds, so that they can be pre-fetched
287 # by the UI 282 # by the UI
288 self._serve_file(file_path, cacheable_seconds=60) 283 self._serve_file(file_path, cacheable_seconds=60)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698