| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 from webkitpy.common.net import layouttestresults_unittest | 32 from webkitpy.common.net import layouttestresults_unittest |
| 33 from webkitpy.common.host_mock import MockHost | 33 from webkitpy.common.host_mock import MockHost |
| 34 from webkitpy.layout_tests.layout_package.json_results_generator import strip_js
on_wrapper | 34 from webkitpy.layout_tests.layout_package.json_results_generator import strip_js
on_wrapper |
| 35 from webkitpy.layout_tests.port.base import Port | 35 from webkitpy.layout_tests.port.base import Port |
| 36 from webkitpy.tool.commands.rebaselineserver import TestConfig, RebaselineServer | 36 from webkitpy.tool.commands.rebaselineserver import TestConfig, RebaselineServer |
| 37 from webkitpy.tool.servers import rebaselineserver | 37 from webkitpy.tool.servers import rebaselineserver |
| 38 | 38 |
| 39 | 39 |
| 40 class RebaselineTestTest(unittest.TestCase): | 40 class RebaselineTestTest(unittest.TestCase): |
| 41 |
| 41 def test_text_rebaseline_update(self): | 42 def test_text_rebaseline_update(self): |
| 42 self._assertRebaseline( | 43 self._assertRebaseline( |
| 43 test_files=( | 44 test_files=( |
| 44 'fast/text-expected.txt', | 45 'fast/text-expected.txt', |
| 45 'platform/mac/fast/text-expected.txt', | 46 'platform/mac/fast/text-expected.txt', |
| 46 ), | 47 ), |
| 47 results_files=( | 48 results_files=( |
| 48 'fast/text-actual.txt', | 49 'fast/text-actual.txt', |
| 49 ), | 50 ), |
| 50 test_name='fast/text.html', | 51 test_name='fast/text.html', |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 ' Updated image-expected.checksum', | 204 ' Updated image-expected.checksum', |
| 204 ' Updated image-expected.png', | 205 ' Updated image-expected.png', |
| 205 ]) | 206 ]) |
| 206 | 207 |
| 207 def test_gather_baselines(self): | 208 def test_gather_baselines(self): |
| 208 example_json = layouttestresults_unittest.LayoutTestResultsTest.example_
full_results_json | 209 example_json = layouttestresults_unittest.LayoutTestResultsTest.example_
full_results_json |
| 209 results_json = json.loads(strip_json_wrapper(example_json)) | 210 results_json = json.loads(strip_json_wrapper(example_json)) |
| 210 server = RebaselineServer() | 211 server = RebaselineServer() |
| 211 server._test_config = get_test_config() | 212 server._test_config = get_test_config() |
| 212 server._gather_baselines(results_json) | 213 server._gather_baselines(results_json) |
| 213 self.assertEqual(results_json['tests']['svg/dynamic-updates/SVGFEDropSha
dowElement-dom-stdDeviation-attr.html']['state'], 'needs_rebaseline') | 214 self.assertEqual(results_json['tests'][ |
| 215 'svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDevi
ation-attr.html']['state'], 'needs_rebaseline') |
| 214 self.assertNotIn('prototype-chocolate.html', results_json['tests']) | 216 self.assertNotIn('prototype-chocolate.html', results_json['tests']) |
| 215 | 217 |
| 216 def _assertRebaseline(self, test_files, results_files, test_name, baseline_t
arget, baseline_move_to, expected_success, expected_log): | 218 def _assertRebaseline(self, test_files, results_files, test_name, baseline_t
arget, baseline_move_to, expected_success, expected_log): |
| 217 log = [] | 219 log = [] |
| 218 test_config = get_test_config(test_files, results_files) | 220 test_config = get_test_config(test_files, results_files) |
| 219 success = rebaselineserver._rebaseline_test( | 221 success = rebaselineserver._rebaseline_test( |
| 220 test_name, | 222 test_name, |
| 221 baseline_target, | 223 baseline_target, |
| 222 baseline_move_to, | 224 baseline_move_to, |
| 223 test_config, | 225 test_config, |
| 224 log=lambda l: log.append(l)) | 226 log=lambda l: log.append(l)) |
| 225 self.assertEqual(expected_log, log) | 227 self.assertEqual(expected_log, log) |
| 226 self.assertEqual(expected_success, success) | 228 self.assertEqual(expected_success, success) |
| 227 | 229 |
| 228 | 230 |
| 229 class GetActualResultFilesTest(unittest.TestCase): | 231 class GetActualResultFilesTest(unittest.TestCase): |
| 232 |
| 230 def test(self): | 233 def test(self): |
| 231 test_config = get_test_config(result_files=( | 234 test_config = get_test_config(result_files=( |
| 232 'fast/text-actual.txt', | 235 'fast/text-actual.txt', |
| 233 'fast2/text-actual.txt', | 236 'fast2/text-actual.txt', |
| 234 'fast/text2-actual.txt', | 237 'fast/text2-actual.txt', |
| 235 'fast/text-notactual.txt', | 238 'fast/text-notactual.txt', |
| 236 )) | 239 )) |
| 237 self.assertItemsEqual( | 240 self.assertItemsEqual( |
| 238 ('text-actual.txt',), | 241 ('text-actual.txt',), |
| 239 rebaselineserver._get_actual_result_files( | 242 rebaselineserver._get_actual_result_files( |
| 240 'fast/text.html', test_config)) | 243 'fast/text.html', test_config)) |
| 241 | 244 |
| 242 | 245 |
| 243 class GetBaselinesTest(unittest.TestCase): | 246 class GetBaselinesTest(unittest.TestCase): |
| 247 |
| 244 def test_no_baselines(self): | 248 def test_no_baselines(self): |
| 245 self._assertBaselines( | 249 self._assertBaselines( |
| 246 test_files=(), | 250 test_files=(), |
| 247 test_name='fast/missing.html', | 251 test_name='fast/missing.html', |
| 248 expected_baselines={}) | 252 expected_baselines={}) |
| 249 | 253 |
| 250 def test_text_baselines(self): | 254 def test_text_baselines(self): |
| 251 self._assertBaselines( | 255 self._assertBaselines( |
| 252 test_files=( | 256 test_files=( |
| 253 'fast/text-expected.txt', | 257 'fast/text-expected.txt', |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 class TestMacPort(Port): | 307 class TestMacPort(Port): |
| 304 port_name = "mac" | 308 port_name = "mac" |
| 305 FALLBACK_PATHS = {'': ['mac']} | 309 FALLBACK_PATHS = {'': ['mac']} |
| 306 | 310 |
| 307 return TestConfig( | 311 return TestConfig( |
| 308 TestMacPort(host, 'mac'), | 312 TestMacPort(host, 'mac'), |
| 309 layout_tests_directory, | 313 layout_tests_directory, |
| 310 results_directory, | 314 results_directory, |
| 311 ('mac', 'mac-leopard', 'win', 'linux'), | 315 ('mac', 'mac-leopard', 'win', 'linux'), |
| 312 host) | 316 host) |
| OLD | NEW |