| 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 optparse | 5 import optparse |
| 6 | 6 |
| 7 from webkitpy.common.system.outputcapture import OutputCapture | 7 from webkitpy.common.system.outputcapture import OutputCapture |
| 8 from webkitpy.tool.commands.optimize_baselines import OptimizeBaselines | 8 from webkitpy.tool.commands.optimize_baselines import OptimizeBaselines |
| 9 from webkitpy.tool.commands.rebaseline_unittest import BaseTestCase | 9 from webkitpy.tool.commands.rebaseline_unittest import BaseTestCase |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 def test_no_modify_scm(self): | 39 def test_no_modify_scm(self): |
| 40 test_port = self.tool.port_factory.get('test') | 40 test_port = self.tool.port_factory.get('test') |
| 41 self._write_test_file(test_port, 'another/test.html', "Dummy test conten
ts") | 41 self._write_test_file(test_port, 'another/test.html', "Dummy test conten
ts") |
| 42 self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/tes
t-expected.txt', "result A") | 42 self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/tes
t-expected.txt', "result A") |
| 43 self._write_test_file(test_port, 'another/test-expected.txt', "result A"
) | 43 self._write_test_file(test_port, 'another/test-expected.txt', "result A"
) |
| 44 | 44 |
| 45 OutputCapture().assert_outputs(self, self.command.execute, args=[ | 45 OutputCapture().assert_outputs(self, self.command.execute, args=[ |
| 46 optparse.Values({'suffixes': 'txt', 'no_modify_scm': True, 'platform
': 'test-mac-mac10.10'}), | 46 optparse.Values({'suffixes': 'txt', 'no_modify_scm': True, 'platform
': 'test-mac-mac10.10'}), |
| 47 ['another/test.html'], | 47 ['another/test.html'], |
| 48 self.tool, | 48 self.tool, |
| 49 ], expected_stdout='{"add": [], "remove-lines": [], "delete": ["/test.ch
eckout/LayoutTests/platform/test-mac-mac10.10/another/test-expected.txt"]}\n') | 49 ], expected_stdout=('{"add": [], "remove-lines": [], ' |
| 50 '"delete": ["/test.checkout/LayoutTests/platform/tes
t-mac-mac10.10/another/test-expected.txt"]}\n')) |
| 50 | 51 |
| 51 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 52 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 52 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx
t'))) | 53 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx
t'))) |
| 53 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( | 54 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 54 test_port.layout_tests_dir(), 'another/test-expected.txt'))) | 55 test_port.layout_tests_dir(), 'another/test-expected.txt'))) |
| 55 | 56 |
| 56 def test_optimize_all_suffixes_by_default(self): | 57 def test_optimize_all_suffixes_by_default(self): |
| 57 test_port = self.tool.port_factory.get('test') | 58 test_port = self.tool.port_factory.get('test') |
| 58 self._write_test_file(test_port, 'another/test.html', "Dummy test conten
ts") | 59 self._write_test_file(test_port, 'another/test.html', "Dummy test conten
ts") |
| 59 self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/tes
t-expected.txt', "result A") | 60 self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/tes
t-expected.txt', "result A") |
| 60 self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/tes
t-expected.png', "result A png") | 61 self._write_test_file(test_port, 'platform/test-mac-mac10.10/another/tes
t-expected.png', "result A png") |
| 61 self._write_test_file(test_port, 'another/test-expected.txt', "result A"
) | 62 self._write_test_file(test_port, 'another/test-expected.txt', "result A"
) |
| 62 self._write_test_file(test_port, 'another/test-expected.png', "result A
png") | 63 self._write_test_file(test_port, 'another/test-expected.png', "result A
png") |
| 63 | 64 |
| 64 try: | 65 try: |
| 65 oc = OutputCapture() | 66 oc = OutputCapture() |
| 66 oc.capture_output() | 67 oc.capture_output() |
| 67 self.command.execute( | 68 self.command.execute( |
| 68 optparse.Values({'suffixes': 'txt,wav,png', 'no_modify_scm': Tru
e, 'platform': 'test-mac-mac10.10'}), | 69 optparse.Values({'suffixes': 'txt,wav,png', 'no_modify_scm': Tru
e, 'platform': 'test-mac-mac10.10'}), |
| 69 ['another/test.html'], | 70 ['another/test.html'], |
| 70 self.tool) | 71 self.tool) |
| 71 finally: | 72 finally: |
| 72 out, _, _ = oc.restore_output() | 73 out, _, _ = oc.restore_output() |
| 73 | 74 |
| 74 self.assertEquals(out, '{"add": [], "remove-lines": [], "delete": ["/tes
t.checkout/LayoutTests/platform/test-mac-mac10.10/another/test-expected.txt", "/
test.checkout/LayoutTests/platform/test-mac-mac10.10/another/test-expected.png"]
}\n') | 75 self.assertEquals( |
| 75 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 76 out, |
| 76 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx
t'))) | 77 '{"add": [], "remove-lines": [], ' |
| 77 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 78 '"delete": ["/test.checkout/LayoutTests/platform/test-mac-mac10.10/a
nother/test-expected.txt", ' |
| 78 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.pn
g'))) | 79 '"/test.checkout/LayoutTests/platform/test-mac-mac10.10/another/test
-expected.png"]}\n') |
| 79 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( | 80 self.assertFalse( |
| 80 test_port.layout_tests_dir(), 'another/test-expected.txt'))) | 81 self.tool.filesystem.exists(self.tool.filesystem.join( |
| 81 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( | 82 test_port.layout_tests_dir(), 'platform/mac/another/test-expecte
d.txt'))) |
| 82 test_port.layout_tests_dir(), 'another/test-expected.png'))) | 83 self.assertFalse( |
| 84 self.tool.filesystem.exists(self.tool.filesystem.join( |
| 85 test_port.layout_tests_dir(), 'platform/mac/another/test-expecte
d.png'))) |
| 86 self.assertTrue( |
| 87 self.tool.filesystem.exists(self.tool.filesystem.join( |
| 88 test_port.layout_tests_dir(), 'another/test-expected.txt'))) |
| 89 self.assertTrue( |
| 90 self.tool.filesystem.exists(self.tool.filesystem.join( |
| 91 test_port.layout_tests_dir(), 'another/test-expected.png'))) |
| OLD | NEW |