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

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

Issue 2192403002: Remove MockOptions, and replace all usages of it with optparse.Values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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
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 optparse
6
5 from webkitpy.common.net.buildbot import Build 7 from webkitpy.common.net.buildbot import Build
6 from webkitpy.common.net.layouttestresults import LayoutTestResults 8 from webkitpy.common.net.layouttestresults import LayoutTestResults
7 from webkitpy.common.system.executive_mock import MockExecutive 9 from webkitpy.common.system.executive_mock import MockExecutive
8 from webkitpy.layout_tests.builder_list import BuilderList 10 from webkitpy.layout_tests.builder_list import BuilderList
9 from webkitpy.tool.commands.auto_rebaseline import AutoRebaseline 11 from webkitpy.tool.commands.auto_rebaseline import AutoRebaseline
10 from webkitpy.tool.commands.rebaseline_unittest import BaseTestCase 12 from webkitpy.tool.commands.rebaseline_unittest import BaseTestCase
11 from webkitpy.tool.commands.rebaseline_unittest import MockLineRemovingExecutive 13 from webkitpy.tool.commands.rebaseline_unittest import MockLineRemovingExecutive
12 from webkitpy.tool.mock_tool import MockOptions
13 14
14 15
15 class TestAutoRebaseline(BaseTestCase): 16 class TestAutoRebaseline(BaseTestCase):
16 command_constructor = AutoRebaseline 17 command_constructor = AutoRebaseline
17 18
18 def _write_test_file(self, port, path, contents): 19 def _write_test_file(self, port, path, contents):
19 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path) 20 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path)
20 self.tool.filesystem.write_text_file(abs_path, contents) 21 self.tool.filesystem.write_text_file(abs_path, contents)
21 22
22 def _execute_with_mock_options(self, auth_refresh_token_json=None, commit_au thor=None, dry_run=False): 23 def _execute_with_mock_options(self, auth_refresh_token_json=None, commit_au thor=None, dry_run=False):
23 self.command.execute( 24 self.command.execute(
24 MockOptions(optimize=True, verbose=False, results_directory=False, 25 optparse.Values({
25 auth_refresh_token_json=auth_refresh_token_json, 26 'optimize': True,
26 commit_author=commit_author, dry_run=dry_run), 27 'verbose': False,
27 [], self.tool) 28 'results_directory': False,
29 'auth_refresh_token_json': auth_refresh_token_json,
30 'commit_author': commit_author,
31 'dry_run': dry_run
32 }),
33 [],
34 self.tool)
28 35
29 def setUp(self): 36 def setUp(self):
30 super(TestAutoRebaseline, self).setUp() 37 super(TestAutoRebaseline, self).setUp()
31 self.tool.builders = BuilderList({ 38 self.tool.builders = BuilderList({
32 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": [" Mac10.10", "Release"]}, 39 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": [" Mac10.10", "Release"]},
33 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": [" Mac10.11", "Release"]}, 40 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": [" Mac10.11", "Release"]},
34 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": [" Precise", "Release"]}, 41 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": [" Precise", "Release"]},
35 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": ["Tr usty", "Release"]}, 42 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": ["Tr usty", "Release"]},
36 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", " Release"]}, 43 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", " Release"]},
37 "MOCK Win7 (dbg)": {"port_name": "test-win-win7", "specifiers": ["Wi n7", "Debug"]}, 44 "MOCK Win7 (dbg)": {"port_name": "test-win-win7", "specifiers": ["Wi n7", "Debug"]},
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 521
515 def test_execute_with_dry_run(self): 522 def test_execute_with_dry_run(self):
516 self._basic_execute_test([], dry_run=True) 523 self._basic_execute_test([], dry_run=True)
517 self.assertEqual(self.tool.scm().local_commits(), []) 524 self.assertEqual(self.tool.scm().local_commits(), [])
518 525
519 def test_bot_revision_data(self): 526 def test_bot_revision_data(self):
520 self._setup_mock_build_data() 527 self._setup_mock_build_data()
521 self.assertEqual( 528 self.assertEqual(
522 self.command.bot_revision_data(self.tool.scm()), 529 self.command.bot_revision_data(self.tool.scm()),
523 [{'builder': 'MOCK Win7', 'revision': '9000'}]) 530 [{'builder': 'MOCK Win7', 'revision': '9000'}])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698