| OLD | NEW |
| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return False | 156 return False |
| 157 else: | 157 else: |
| 158 log(' Moved %s' % file_name) | 158 log(' Moved %s' % file_name) |
| 159 | 159 |
| 160 return True | 160 return True |
| 161 | 161 |
| 162 | 162 |
| 163 def get_test_baselines(test_file, test_config): | 163 def get_test_baselines(test_file, test_config): |
| 164 # FIXME: This seems like a hack. This only seems used to access the Port.exp
ected_baselines logic. | 164 # FIXME: This seems like a hack. This only seems used to access the Port.exp
ected_baselines logic. |
| 165 class AllPlatformsPort(Port): | 165 class AllPlatformsPort(Port): |
| 166 |
| 166 def __init__(self, host): | 167 def __init__(self, host): |
| 167 super(AllPlatformsPort, self).__init__(host, 'mac') | 168 super(AllPlatformsPort, self).__init__(host, 'mac') |
| 168 self._platforms_by_directory = dict([(self._webkit_baseline_path(p),
p) for p in test_config.platforms]) | 169 self._platforms_by_directory = dict([(self._webkit_baseline_path(p),
p) for p in test_config.platforms]) |
| 169 | 170 |
| 170 def baseline_search_path(self): | 171 def baseline_search_path(self): |
| 171 return self._platforms_by_directory.keys() | 172 return self._platforms_by_directory.keys() |
| 172 | 173 |
| 173 def platform_from_directory(self, directory): | 174 def platform_from_directory(self, directory): |
| 174 return self._platforms_by_directory[directory] | 175 return self._platforms_by_directory[directory] |
| 175 | 176 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 189 else: | 190 else: |
| 190 platform = all_platforms_port.platform_from_directory(platform_d
irectory) | 191 platform = all_platforms_port.platform_from_directory(platform_d
irectory) |
| 191 platform_baselines = all_test_baselines.setdefault(platform, {}) | 192 platform_baselines = all_test_baselines.setdefault(platform, {}) |
| 192 was_used_for_test = (platform_directory, expected_filename) in test_
baselines | 193 was_used_for_test = (platform_directory, expected_filename) in test_
baselines |
| 193 platform_baselines[baseline_extension] = was_used_for_test | 194 platform_baselines[baseline_extension] = was_used_for_test |
| 194 | 195 |
| 195 return all_test_baselines | 196 return all_test_baselines |
| 196 | 197 |
| 197 | 198 |
| 198 class RebaselineHTTPServer(BaseHTTPServer.HTTPServer): | 199 class RebaselineHTTPServer(BaseHTTPServer.HTTPServer): |
| 200 |
| 199 def __init__(self, httpd_port, config): | 201 def __init__(self, httpd_port, config): |
| 200 server_name = "" | 202 server_name = "" |
| 201 BaseHTTPServer.HTTPServer.__init__(self, (server_name, httpd_port), Reba
selineHTTPRequestHandler) | 203 BaseHTTPServer.HTTPServer.__init__(self, (server_name, httpd_port), Reba
selineHTTPRequestHandler) |
| 202 self.test_config = config['test_config'] | 204 self.test_config = config['test_config'] |
| 203 self.results_json = config['results_json'] | 205 self.results_json = config['results_json'] |
| 204 self.platforms_json = config['platforms_json'] | 206 self.platforms_json = config['platforms_json'] |
| 205 | 207 |
| 206 | 208 |
| 207 class RebaselineHTTPRequestHandler(ReflectionHandler): | 209 class RebaselineHTTPRequestHandler(ReflectionHandler): |
| 208 STATIC_FILE_NAMES = frozenset([ | 210 STATIC_FILE_NAMES = frozenset([ |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 elif mode == 'diff-text': | 276 elif mode == 'diff-text': |
| 275 file_name = test_name + '-diff.txt' | 277 file_name = test_name + '-diff.txt' |
| 276 elif mode == 'diff-text-pretty': | 278 elif mode == 'diff-text-pretty': |
| 277 file_name = test_name + '-pretty-diff.html' | 279 file_name = test_name + '-pretty-diff.html' |
| 278 | 280 |
| 279 file_path = os.path.join(self.server.test_config.results_directory, file
_name) | 281 file_path = os.path.join(self.server.test_config.results_directory, file
_name) |
| 280 | 282 |
| 281 # Let results be cached for 60 seconds, so that they can be pre-fetched | 283 # Let results be cached for 60 seconds, so that they can be pre-fetched |
| 282 # by the UI | 284 # by the UI |
| 283 self._serve_file(file_path, cacheable_seconds=60) | 285 self._serve_file(file_path, cacheable_seconds=60) |
| OLD | NEW |