| 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 json | 5 import json |
| 6 import optparse | 6 import optparse |
| 7 | 7 |
| 8 from webkitpy.common.net.buildbot import Build | 8 from webkitpy.common.net.buildbot import Build |
| 9 from webkitpy.common.net.rietveld import Rietveld | 9 from webkitpy.common.net.rietveld import Rietveld |
| 10 from webkitpy.common.net.web_mock import MockWeb | 10 from webkitpy.common.net.web_mock import MockWeb |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 "is_try_builder": True, | 55 "is_try_builder": True, |
| 56 }, | 56 }, |
| 57 }) | 57 }) |
| 58 self.command.rietveld = Rietveld(web) | 58 self.command.rietveld = Rietveld(web) |
| 59 | 59 |
| 60 # Write to the mock filesystem so that these tests are considered to exi
st. | 60 # Write to the mock filesystem so that these tests are considered to exi
st. |
| 61 port = self.mac_port | 61 port = self.mac_port |
| 62 tests = [ | 62 tests = [ |
| 63 'fast/dom/prototype-taco.html', | 63 'fast/dom/prototype-taco.html', |
| 64 'fast/dom/prototype-inheritance.html', | 64 'fast/dom/prototype-inheritance.html', |
| 65 'fast/dom/prototype-newtest.html', |
| 65 'svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.ht
ml', | 66 'svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.ht
ml', |
| 66 ] | 67 ] |
| 67 for test in tests: | 68 for test in tests: |
| 68 # pylint: disable=protected-access | |
| 69 self._write(port.host.filesystem.join(port.layout_tests_dir(), test)
, 'contents') | 69 self._write(port.host.filesystem.join(port.layout_tests_dir(), test)
, 'contents') |
| 70 | 70 |
| 71 def tearDown(self): | 71 def tearDown(self): |
| 72 BaseTestCase.tearDown(self) | 72 BaseTestCase.tearDown(self) |
| 73 LoggingTestCase.tearDown(self) | 73 LoggingTestCase.tearDown(self) |
| 74 | 74 |
| 75 @staticmethod | 75 @staticmethod |
| 76 def command_options(**kwargs): | 76 def command_options(**kwargs): |
| 77 options = { | 77 options = { |
| 78 'only_changed_tests': False, | 78 'only_changed_tests': False, |
| 79 'dry_run': False, | 79 'dry_run': False, |
| 80 'issue': None, | 80 'issue': None, |
| 81 'optimize': True, | 81 'optimize': True, |
| 82 'results_directory': None, | 82 'results_directory': None, |
| 83 'verbose': False, | 83 'verbose': False, |
| 84 'trigger_jobs': False, | 84 'trigger_jobs': False, |
| 85 } | 85 } |
| 86 options.update(kwargs) | 86 options.update(kwargs) |
| 87 return optparse.Values(dict(**options)) | 87 return optparse.Values(dict(**options)) |
| 88 | 88 |
| 89 def test_execute_with_issue_number_given(self): | 89 def test_execute_with_issue_number_given(self): |
| 90 self.command.execute(self.command_options(issue=11112222), [], self.tool
) | 90 self.command.execute(self.command_options(issue=11112222), [], self.tool
) |
| 91 self.assertLog([ | 91 self.assertLog([ |
| 92 'INFO: Tests to rebaseline:\n', | 92 'INFO: Tests to rebaseline:\n', |
| 93 'INFO: fast/dom/prototype-newtest.html: MOCK Try Win (5000)\n', |
| 93 'INFO: svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation
-attr.html: MOCK Try Win (5000)\n', | 94 'INFO: svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation
-attr.html: MOCK Try Win (5000)\n', |
| 94 'INFO: fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n'
, | 95 'INFO: fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n'
, |
| 95 'INFO: fast/dom/prototype-taco.html: MOCK Try Win (5000)\n', | 96 'INFO: fast/dom/prototype-taco.html: MOCK Try Win (5000)\n', |
| 96 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', | 97 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', |
| 98 'INFO: Rebaselining fast/dom/prototype-newtest.html\n', |
| 97 'INFO: Rebaselining fast/dom/prototype-taco.html\n', | 99 'INFO: Rebaselining fast/dom/prototype-taco.html\n', |
| 98 'INFO: Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-s
tdDeviation-attr.html\n', | 100 'INFO: Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-s
tdDeviation-attr.html\n', |
| 99 ]) | 101 ]) |
| 100 | 102 |
| 101 def test_execute_with_no_issue_number(self): | 103 def test_execute_with_no_issue_number(self): |
| 102 self.command.execute(self.command_options(), [], self.tool) | 104 self.command.execute(self.command_options(), [], self.tool) |
| 103 self.assertLog(['ERROR: No issue number given and no issue for current b
ranch. This tool requires a CL\n' | 105 self.assertLog(['ERROR: No issue number given and no issue for current b
ranch. This tool requires a CL\n' |
| 104 'to operate on; please run `git cl upload` on this branc
h first, or use the --issue\n' | 106 'to operate on; please run `git cl upload` on this branc
h first, or use the --issue\n' |
| 105 'option to download baselines for another existing CL.\n
']) | 107 'option to download baselines for another existing CL.\n
']) |
| 106 | 108 |
| 107 def test_execute_with_issue_number_from_branch(self): | 109 def test_execute_with_issue_number_from_branch(self): |
| 108 git_cl = GitCL(MockExecutive2()) | 110 git_cl = GitCL(MockExecutive2()) |
| 109 git_cl.get_issue_number = lambda: '11112222' | 111 git_cl.get_issue_number = lambda: '11112222' |
| 110 self.command.git_cl = lambda: git_cl | 112 self.command.git_cl = lambda: git_cl |
| 111 self.command.execute(self.command_options(), [], self.tool) | 113 self.command.execute(self.command_options(), [], self.tool) |
| 112 self.assertLog([ | 114 self.assertLog([ |
| 113 'INFO: Tests to rebaseline:\n', | 115 'INFO: Tests to rebaseline:\n', |
| 116 'INFO: fast/dom/prototype-newtest.html: MOCK Try Win (5000)\n', |
| 114 'INFO: svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation
-attr.html: MOCK Try Win (5000)\n', | 117 'INFO: svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation
-attr.html: MOCK Try Win (5000)\n', |
| 115 'INFO: fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n'
, | 118 'INFO: fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n'
, |
| 116 'INFO: fast/dom/prototype-taco.html: MOCK Try Win (5000)\n', | 119 'INFO: fast/dom/prototype-taco.html: MOCK Try Win (5000)\n', |
| 117 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', | 120 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', |
| 121 'INFO: Rebaselining fast/dom/prototype-newtest.html\n', |
| 118 'INFO: Rebaselining fast/dom/prototype-taco.html\n', | 122 'INFO: Rebaselining fast/dom/prototype-taco.html\n', |
| 119 'INFO: Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-s
tdDeviation-attr.html\n', | 123 'INFO: Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-s
tdDeviation-attr.html\n', |
| 120 ]) | 124 ]) |
| 121 | 125 |
| 122 def test_execute_with_only_changed_tests_option(self): | 126 def test_execute_with_only_changed_tests_option(self): |
| 123 self.command.execute(self.command_options(issue=11112222, only_changed_t
ests=True), [], self.tool) | 127 self.command.execute(self.command_options(issue=11112222, only_changed_t
ests=True), [], self.tool) |
| 124 # svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html | 128 # svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html |
| 125 # is in the list of failed tests, but not in the list of files modified | 129 # is in the list of failed tests, but not in the list of files modified |
| 126 # in the given CL; it should be included because all_tests is set to Tru
e. | 130 # in the given CL; it should be included because all_tests is set to Tru
e. |
| 127 self.assertLog([ | 131 self.assertLog([ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 169 |
| 166 self.assertEqual( | 170 self.assertEqual( |
| 167 self.tool.executive.calls, | 171 self.tool.executive.calls, |
| 168 [ | 172 [ |
| 169 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi
xes', 'txt', | 173 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi
xes', 'txt', |
| 170 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html']], | 174 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html']], |
| 171 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't
xt', | 175 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't
xt', |
| 172 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html', '--build-number', '5000']], | 176 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html', '--build-number', '5000']], |
| 173 [['python', 'echo', 'optimize-baselines', '--suffixes', 'txt', '
fast/dom/prototype-taco.html']] | 177 [['python', 'echo', 'optimize-baselines', '--suffixes', 'txt', '
fast/dom/prototype-taco.html']] |
| 174 ]) | 178 ]) |
| OLD | NEW |