| 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 unittest | 5 import unittest |
| 6 | 6 |
| 7 from webkitpy.common.net.buildbot_mock import MockBuilder | |
| 8 from webkitpy.common.net.layouttestresults import LayoutTestResults | 7 from webkitpy.common.net.layouttestresults import LayoutTestResults |
| 9 from webkitpy.common.system.executive_mock import MockExecutive | 8 from webkitpy.common.system.executive_mock import MockExecutive |
| 10 from webkitpy.common.system.executive_mock import MockExecutive2 | 9 from webkitpy.common.system.executive_mock import MockExecutive2 |
| 11 from webkitpy.common.system.outputcapture import OutputCapture | 10 from webkitpy.common.system.outputcapture import OutputCapture |
| 12 from webkitpy.layout_tests.builder_list import BuilderList | 11 from webkitpy.layout_tests.builder_list import BuilderList |
| 13 from webkitpy.tool.commands.rebaseline import * | 12 from webkitpy.tool.commands.rebaseline import * |
| 14 from webkitpy.tool.mock_tool import MockTool, MockOptions | 13 from webkitpy.tool.mock_tool import MockTool, MockOptions |
| 15 | 14 |
| 16 | 15 |
| 17 class BaseTestCase(unittest.TestCase): | 16 class BaseTestCase(unittest.TestCase): |
| 18 MOCK_WEB_RESULT = 'MOCK Web result, convert 404 to None=True' | 17 MOCK_WEB_RESULT = 'MOCK Web result, convert 404 to None=True' |
| 19 WEB_PREFIX = 'http://example.com/f/builders/MOCK Mac10.11/results/layout-tes
t-results' | 18 WEB_PREFIX = 'https://storage.googleapis.com/chromium-layout-test-archives/M
OCK_Mac10_11/results/layout-test-results' |
| 20 | 19 |
| 21 command_constructor = None | 20 command_constructor = None |
| 22 | 21 |
| 23 def setUp(self): | 22 def setUp(self): |
| 24 self.tool = MockTool() | 23 self.tool = MockTool() |
| 25 # lint warns that command_constructor might not be set, but this is inte
ntional; pylint: disable=E1102 | 24 # lint warns that command_constructor might not be set, but this is inte
ntional; pylint: disable=E1102 |
| 26 self.command = self.command_constructor() | 25 self.command = self.command_constructor() |
| 27 self.tool.builders = BuilderList({ | 26 self.tool.builders = BuilderList({ |
| 28 "MOCK Mac10.10 (dbg)": {"port_name": "test-mac-mac10.10", "specifier
s": ["Mac10.10", "Debug"]}, | 27 "MOCK Mac10.10 (dbg)": {"port_name": "test-mac-mac10.10", "specifier
s": ["Mac10.10", "Debug"]}, |
| 29 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": ["
Mac10.10", "Release"]}, | 28 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": ["
Mac10.10", "Release"]}, |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 self._write(self.mac_expectations_path, """Bug(B) [ Mac Linux Win7 Debug
] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ] | 246 self._write(self.mac_expectations_path, """Bug(B) [ Mac Linux Win7 Debug
] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ] |
| 248 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] | 247 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] |
| 249 """) | 248 """) |
| 250 self._write("fast/dom/Window/window-postmessage-clone-really-deep-array.
html", "Dummy test contents") | 249 self._write("fast/dom/Window/window-postmessage-clone-really-deep-array.
html", "Dummy test contents") |
| 251 self._write("fast/css/large-list-of-rules-crash.html", "Dummy test conte
nts") | 250 self._write("fast/css/large-list-of-rules-crash.html", "Dummy test conte
nts") |
| 252 self._write("userscripts/another-test.html", "Dummy test contents") | 251 self._write("userscripts/another-test.html", "Dummy test contents") |
| 253 | 252 |
| 254 self.options.suffixes = "png,wav,txt" | 253 self.options.suffixes = "png,wav,txt" |
| 255 self.command._rebaseline_test_and_update_expectations(self.options) | 254 self.command._rebaseline_test_and_update_expectations(self.options) |
| 256 | 255 |
| 256 self.maxDiff = None |
| 257 self.assertItemsEqual(self.tool.web.urls_fetched, | 257 self.assertItemsEqual(self.tool.web.urls_fetched, |
| 258 [self.WEB_PREFIX + '/userscripts/another-test-actu
al.png', | 258 [self.WEB_PREFIX + '/userscripts/another-test-actu
al.png', |
| 259 self.WEB_PREFIX + '/userscripts/another-test-actu
al.wav', | 259 self.WEB_PREFIX + '/userscripts/another-test-actu
al.wav', |
| 260 self.WEB_PREFIX + '/userscripts/another-test-actu
al.txt']) | 260 self.WEB_PREFIX + '/userscripts/another-test-actu
al.txt']) |
| 261 new_expectations = self._read(self.mac_expectations_path) | 261 new_expectations = self._read(self.mac_expectations_path) |
| 262 self.assertMultiLineEqual(new_expectations, """Bug(B) [ Mac Linux Win7 D
ebug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ] | 262 self.assertMultiLineEqual(new_expectations, """Bug(B) [ Mac Linux Win7 D
ebug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ] |
| 263 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] | 263 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] |
| 264 """) | 264 """) |
| 265 | 265 |
| 266 def test_rebaseline_test(self): | 266 def test_rebaseline_test(self): |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 self.assertMultiLineEqual( | 523 self.assertMultiLineEqual( |
| 524 new_expectations, "Bug(x) [ Linux Mac10.10 Win ] userscripts/first-t
est.html [ Failure ]\n") | 524 new_expectations, "Bug(x) [ Linux Mac10.10 Win ] userscripts/first-t
est.html [ Failure ]\n") |
| 525 | 525 |
| 526 | 526 |
| 527 class TestRebaseline(BaseTestCase): | 527 class TestRebaseline(BaseTestCase): |
| 528 # This command shares most of its logic with RebaselineJson, so these tests
just test what is different. | 528 # This command shares most of its logic with RebaselineJson, so these tests
just test what is different. |
| 529 | 529 |
| 530 command_constructor = Rebaseline # AKA webkit-patch rebaseline | 530 command_constructor = Rebaseline # AKA webkit-patch rebaseline |
| 531 | 531 |
| 532 def test_rebaseline(self): | 532 def test_rebaseline(self): |
| 533 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK Win7')] | 533 self.command._builders_to_pull_from = lambda: ['MOCK Win7'] |
| 534 | 534 |
| 535 self._write("userscripts/first-test.html", "test data") | 535 self._write("userscripts/first-test.html", "test data") |
| 536 | 536 |
| 537 self._zero_out_test_expectations() | 537 self._zero_out_test_expectations() |
| 538 self._setup_mock_builder_data() | 538 self._setup_mock_builder_data() |
| 539 | 539 |
| 540 self.command.execute(MockOptions(results_directory=False, optimize=False
, builders=None, | 540 self.command.execute(MockOptions(results_directory=False, optimize=False
, builders=None, |
| 541 suffixes="txt,png", verbose=True), ['us
erscripts/first-test.html'], self.tool) | 541 suffixes="txt,png", verbose=True), ['us
erscripts/first-test.html'], self.tool) |
| 542 | 542 |
| 543 self.assertEqual(self.tool.executive.calls, | 543 self.assertEqual(self.tool.executive.calls, |
| 544 [[['python', 'echo', 'copy-existing-baselines-internal'
, '--suffixes', 'txt,png', '--builder', 'MOCK Win7', '--test', 'userscripts/firs
t-test.html', '--verbose']], | 544 [[['python', 'echo', 'copy-existing-baselines-internal'
, '--suffixes', 'txt,png', '--builder', 'MOCK Win7', '--test', 'userscripts/firs
t-test.html', '--verbose']], |
| 545 [['python', 'echo', 'rebaseline-test-internal', '--suf
fixes', 'txt,png', '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.h
tml', '--verbose']]]) | 545 [['python', 'echo', 'rebaseline-test-internal', '--suf
fixes', 'txt,png', '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.h
tml', '--verbose']]]) |
| 546 | 546 |
| 547 def test_rebaseline_directory(self): | 547 def test_rebaseline_directory(self): |
| 548 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK Win7')] | 548 self.command._builders_to_pull_from = lambda: ['MOCK Win7'] |
| 549 | 549 |
| 550 self._write("userscripts/first-test.html", "test data") | 550 self._write("userscripts/first-test.html", "test data") |
| 551 self._write("userscripts/second-test.html", "test data") | 551 self._write("userscripts/second-test.html", "test data") |
| 552 | 552 |
| 553 self._setup_mock_builder_data() | 553 self._setup_mock_builder_data() |
| 554 | 554 |
| 555 self.command.execute(MockOptions(results_directory=False, optimize=False
, builders=None, | 555 self.command.execute(MockOptions(results_directory=False, optimize=False
, builders=None, |
| 556 suffixes="txt,png", verbose=True), ['us
erscripts'], self.tool) | 556 suffixes="txt,png", verbose=True), ['us
erscripts'], self.tool) |
| 557 | 557 |
| 558 self.assertEqual(self.tool.executive.calls, | 558 self.assertEqual(self.tool.executive.calls, |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV
ELD_REFRESH_TOKEN], | 1429 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV
ELD_REFRESH_TOKEN], |
| 1430 ['git', 'pull'], | 1430 ['git', 'pull'], |
| 1431 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R
IETVELD_REFRESH_TOKEN], | 1431 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R
IETVELD_REFRESH_TOKEN], |
| 1432 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], | 1432 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], |
| 1433 ], | 1433 ], |
| 1434 auth_refresh_token_json=RIETVELD_REFRESH_TOKEN) | 1434 auth_refresh_token_json=RIETVELD_REFRESH_TOKEN) |
| 1435 | 1435 |
| 1436 def test_execute_with_dry_run(self): | 1436 def test_execute_with_dry_run(self): |
| 1437 self._basic_execute_test([], dry_run=True) | 1437 self._basic_execute_test([], dry_run=True) |
| 1438 self.assertEqual(self.tool.scm().local_commits(), []) | 1438 self.assertEqual(self.tool.scm().local_commits(), []) |
| OLD | NEW |