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

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

Issue 2680863007: Refactoring: Remove trivial uses of OutputCapture. (Closed)
Patch Set: Rebased Created 3 years, 10 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 5 import optparse
6 6
7 from webkitpy.common.system.output_capture import OutputCapture
8 from webkitpy.tool.commands.optimize_baselines import OptimizeBaselines 7 from webkitpy.tool.commands.optimize_baselines import OptimizeBaselines
9 from webkitpy.tool.commands.rebaseline_unittest import BaseTestCase 8 from webkitpy.tool.commands.rebaseline_unittest import BaseTestCase
10 9
11 10
12 class TestOptimizeBaselines(BaseTestCase): 11 class TestOptimizeBaselines(BaseTestCase):
13 command_constructor = OptimizeBaselines 12 command_constructor = OptimizeBaselines
14 13
15 def _write_test_file(self, port, path, contents): 14 def _write_test_file(self, port, path, contents):
16 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path) 15 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path)
17 self.tool.filesystem.write_text_file(abs_path, contents) 16 self.tool.filesystem.write_text_file(abs_path, contents)
18 17
19 def setUp(self): 18 def setUp(self):
20 super(TestOptimizeBaselines, self).setUp() 19 super(TestOptimizeBaselines, self).setUp()
21 20
22 def test_optimize_all_suffixes_by_default(self): 21 def test_optimize_all_suffixes_by_default(self):
23 test_port = self.tool.port_factory.get('test') 22 test_port = self.tool.port_factory.get('test')
24 self._write_test_file(test_port, 'another/test.html', "Dummy test conten ts") 23 self._write_test_file(test_port, 'another/test.html', "Dummy test conten ts")
25 self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/tes t-expected.txt', "result A") 24 self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/tes t-expected.txt', "result A")
26 self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/tes t-expected.png', "result A png") 25 self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/tes t-expected.png', "result A png")
27 self._write_test_file(test_port, 'another/test-expected.txt', "result A" ) 26 self._write_test_file(test_port, 'another/test-expected.txt', "result A" )
28 self._write_test_file(test_port, 'another/test-expected.png', "result A png") 27 self._write_test_file(test_port, 'another/test-expected.png', "result A png")
29 28
30 try: 29 self.command.execute(
31 oc = OutputCapture() 30 optparse.Values({'suffixes': 'txt,wav,png', 'no_modify_git': True, ' platform': 'test-mac-mac10.10'}),
32 oc.capture_output() 31 ['another/test.html'],
33 self.command.execute( 32 self.tool)
34 optparse.Values({'suffixes': 'txt,wav,png', 'no_modify_git': Tru e, 'platform': 'test-mac-mac10.10'}),
35 ['another/test.html'],
36 self.tool)
37 finally:
38 oc.restore_output()
39 33
40 self.assertFalse( 34 self.assertFalse(
41 self.tool.filesystem.exists(self.tool.filesystem.join( 35 self.tool.filesystem.exists(self.tool.filesystem.join(
42 test_port.layout_tests_dir(), 'platform/mac/another/test-expecte d.txt'))) 36 test_port.layout_tests_dir(), 'platform/mac/another/test-expecte d.txt')))
43 self.assertFalse( 37 self.assertFalse(
44 self.tool.filesystem.exists(self.tool.filesystem.join( 38 self.tool.filesystem.exists(self.tool.filesystem.join(
45 test_port.layout_tests_dir(), 'platform/mac/another/test-expecte d.png'))) 39 test_port.layout_tests_dir(), 'platform/mac/another/test-expecte d.png')))
46 self.assertTrue( 40 self.assertTrue(
47 self.tool.filesystem.exists(self.tool.filesystem.join( 41 self.tool.filesystem.exists(self.tool.filesystem.join(
48 test_port.layout_tests_dir(), 'another/test-expected.txt'))) 42 test_port.layout_tests_dir(), 'another/test-expected.txt')))
49 self.assertTrue( 43 self.assertTrue(
50 self.tool.filesystem.exists(self.tool.filesystem.join( 44 self.tool.filesystem.exists(self.tool.filesystem.join(
51 test_port.layout_tests_dir(), 'another/test-expected.png'))) 45 test_port.layout_tests_dir(), 'another/test-expected.png')))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698