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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py

Issue 2152663003: Refactor the buildbot module in webkitpy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_from_try_jobs.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_build_data() 538 self._setup_mock_build_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_build_data() 553 self._setup_mock_build_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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV ELD_REFRESH_TOKEN], 1430 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV ELD_REFRESH_TOKEN],
1431 ['git', 'pull'], 1431 ['git', 'pull'],
1432 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R IETVELD_REFRESH_TOKEN], 1432 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R IETVELD_REFRESH_TOKEN],
1433 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv eldissue'], 1433 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv eldissue'],
1434 ], 1434 ],
1435 auth_refresh_token_json=RIETVELD_REFRESH_TOKEN) 1435 auth_refresh_token_json=RIETVELD_REFRESH_TOKEN)
1436 1436
1437 def test_execute_with_dry_run(self): 1437 def test_execute_with_dry_run(self):
1438 self._basic_execute_test([], dry_run=True) 1438 self._basic_execute_test([], dry_run=True)
1439 self.assertEqual(self.tool.scm().local_commits(), []) 1439 self.assertEqual(self.tool.scm().local_commits(), [])
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_from_try_jobs.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698