| Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_tests_mover_unittest.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_tests_mover_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_tests_mover_unittest.py
|
| index e888a70641e611392daee858dbc1c71b0346d86c..aad1c469457c7d68287685154268cc2183072e4b 100644
|
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_tests_mover_unittest.py
|
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_tests_mover_unittest.py
|
| @@ -37,7 +37,6 @@ from webkitpy.layout_tests.port import base
|
|
|
|
|
| class MockPort(base.Port):
|
| -
|
| def __init__(self, **kwargs):
|
| # This sets up a mock FileSystem and SCM using that FileSystem.
|
| host = MockHost()
|
| @@ -47,13 +46,15 @@ class MockPort(base.Port):
|
| host.filesystem.maybe_make_directory(self._absolute_path('existing_directory'))
|
| host.filesystem.write_text_file(self._absolute_path('existing_file.txt'), '')
|
| host.filesystem.write_text_file(self._absolute_path('VirtualTestSuites'), '[]')
|
| - host.filesystem.write_text_file(self._absolute_path('TestExpectations'), """
|
| + host.filesystem.write_text_file(
|
| + self._absolute_path('TestExpectations'), """
|
| crbug.com/42 [ Debug ] origin/path/test.html [ Pass Timeout Failure ]
|
| crbug.com/42 [ Win ] origin/path [ Crash ]
|
| crbug.com/42 [ Release ] origin [ Crash ]
|
| """)
|
| host.filesystem.write_text_file(self._absolute_path('existing_directory_with_contents', 'test.html'), '')
|
| - host.filesystem.write_text_file(self._absolute_path('origin', 'path', 'test.html'), """
|
| + host.filesystem.write_text_file(
|
| + self._absolute_path('origin', 'path', 'test.html'), """
|
| <script src="local_script.js">
|
| <script src="../../unmoved/remote_script.js">
|
| <script src='../../unmoved/remote_script_single_quotes.js'>
|
| @@ -61,19 +62,22 @@ crbug.com/42 [ Release ] origin [ Crash ]
|
| <script href='../../unmoved/remote_script_single_quotes.js'>
|
| <script href="">
|
| """)
|
| - host.filesystem.write_text_file(self._absolute_path('origin', 'path', 'test.css'), """
|
| + host.filesystem.write_text_file(
|
| + self._absolute_path('origin', 'path', 'test.css'), """
|
| url('../../unmoved/url_function.js')
|
| url("../../unmoved/url_function_double_quotes.js")
|
| url(../../unmoved/url_function_no_quotes.js)
|
| url('')
|
| url()
|
| """)
|
| - host.filesystem.write_text_file(self._absolute_path('origin', 'path', 'test.js'), """
|
| + host.filesystem.write_text_file(
|
| + self._absolute_path('origin', 'path', 'test.js'), """
|
| importScripts('../../unmoved/import_scripts_function.js')
|
| importScripts("../../unmoved/import_scripts_function_double_quotes.js")
|
| importScripts('')
|
| """)
|
| - host.filesystem.write_text_file(self._absolute_path('unmoved', 'test.html'), """
|
| + host.filesystem.write_text_file(
|
| + self._absolute_path('unmoved', 'test.html'), """
|
| <script src="local_script.js">
|
| <script src="../origin/path/remote_script.js">
|
| """)
|
| @@ -86,7 +90,6 @@ importScripts('')
|
|
|
|
|
| class LayoutTestsMoverTest(unittest.TestCase):
|
| -
|
| def setUp(self):
|
| port = MockPort()
|
| self._port = port
|
| @@ -125,54 +128,71 @@ class LayoutTestsMoverTest(unittest.TestCase):
|
|
|
| def test_moved_reference_in_moved_file_not_updated(self):
|
| self._mover.move('origin/path', 'destination')
|
| - self.assertTrue('src="local_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
|
| + self.assertTrue('src="local_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('destination',
|
| + 'test.html')))
|
|
|
| def test_unmoved_reference_in_unmoved_file_not_updated(self):
|
| self._mover.move('origin/path', 'destination')
|
| - self.assertTrue('src="local_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('unmoved', 'test.html')))
|
| + self.assertTrue('src="local_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('unmoved',
|
| + 'test.html')))
|
|
|
| def test_moved_reference_in_unmoved_file_is_updated(self):
|
| self._mover.move('origin/path', 'destination')
|
| - self.assertTrue('src="../destination/remote_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('unmoved', 'test.html')))
|
| + self.assertTrue('src="../destination/remote_script.js"' in self._filesystem.read_text_file(self._port._absolute_path(
|
| + 'unmoved', 'test.html')))
|
|
|
| def test_unmoved_reference_in_moved_file_is_updated(self):
|
| self._mover.move('origin/path', 'destination')
|
| - self.assertTrue('src="../unmoved/remote_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
|
| + self.assertTrue('src="../unmoved/remote_script.js"' in self._filesystem.read_text_file(self._port._absolute_path(
|
| + 'destination', 'test.html')))
|
|
|
| def test_references_in_html_file_are_updated(self):
|
| self._mover.move('origin/path', 'destination')
|
| - self.assertTrue('src="../unmoved/remote_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
|
| - self.assertTrue('src=\'../unmoved/remote_script_single_quotes.js\'' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
|
| - self.assertTrue('href="../unmoved/remote_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
|
| - self.assertTrue('href=\'../unmoved/remote_script_single_quotes.js\'' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
|
| + self.assertTrue('src="../unmoved/remote_script.js"' in self._filesystem.read_text_file(self._port._absolute_path(
|
| + 'destination', 'test.html')))
|
| + self.assertTrue('src=\'../unmoved/remote_script_single_quotes.js\'' in self._filesystem.read_text_file(
|
| + self._port._absolute_path('destination', 'test.html')))
|
| + self.assertTrue('href="../unmoved/remote_script.js"' in self._filesystem.read_text_file(self._port._absolute_path(
|
| + 'destination', 'test.html')))
|
| + self.assertTrue('href=\'../unmoved/remote_script_single_quotes.js\'' in self._filesystem.read_text_file(
|
| + self._port._absolute_path('destination', 'test.html')))
|
| self.assertTrue('href=""' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
|
|
|
| def test_references_in_css_file_are_updated(self):
|
| self._mover.move('origin/path', 'destination')
|
| - self.assertTrue('url(\'../unmoved/url_function.js\')' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.css')))
|
| - self.assertTrue('url("../unmoved/url_function_double_quotes.js")' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.css')))
|
| - self.assertTrue('url(../unmoved/url_function_no_quotes.js)' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.css')))
|
| + self.assertTrue('url(\'../unmoved/url_function.js\')' in self._filesystem.read_text_file(self._port._absolute_path(
|
| + 'destination', 'test.css')))
|
| + self.assertTrue('url("../unmoved/url_function_double_quotes.js")' in self._filesystem.read_text_file(
|
| + self._port._absolute_path('destination', 'test.css')))
|
| + self.assertTrue('url(../unmoved/url_function_no_quotes.js)' in self._filesystem.read_text_file(self._port._absolute_path(
|
| + 'destination', 'test.css')))
|
| self.assertTrue('url(\'\')' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.css')))
|
| self.assertTrue('url()' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.css')))
|
|
|
| def test_references_in_javascript_file_are_updated(self):
|
| self._mover.move('origin/path', 'destination')
|
| - self.assertTrue('importScripts(\'../unmoved/import_scripts_function.js\')' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.js')))
|
| - self.assertTrue('importScripts("../unmoved/import_scripts_function_double_quotes.js")' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.js')))
|
| - self.assertTrue('importScripts(\'\')' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.js')))
|
| + self.assertTrue('importScripts(\'../unmoved/import_scripts_function.js\')' in self._filesystem.read_text_file(
|
| + self._port._absolute_path('destination', 'test.js')))
|
| + self.assertTrue('importScripts("../unmoved/import_scripts_function_double_quotes.js")' in self._filesystem.read_text_file(
|
| + self._port._absolute_path('destination', 'test.js')))
|
| + self.assertTrue('importScripts(\'\')' in self._filesystem.read_text_file(self._port._absolute_path('destination',
|
| + 'test.js')))
|
|
|
| def test_expectation_is_updated(self):
|
| self._mover.move('origin/path', 'destination')
|
| self.assertFalse('origin/path/test.html' in self._filesystem.read_text_file(self._port._absolute_path('TestExpectations')))
|
| - self.assertTrue('crbug.com/42 [ Debug ] destination/test.html [ Pass Timeout Failure ]'
|
| - in self._filesystem.read_text_file(self._port._absolute_path('TestExpectations')))
|
| + self.assertTrue('crbug.com/42 [ Debug ] destination/test.html [ Pass Timeout Failure ]' in self._filesystem.read_text_file(
|
| + self._port._absolute_path('TestExpectations')))
|
|
|
| def test_directory_expectation_is_updated(self):
|
| self._mover.move('origin/path', 'destination')
|
| self.assertFalse('origin/path' in self._filesystem.read_text_file(self._port._absolute_path('TestExpectations')))
|
| - self.assertTrue('crbug.com/42 [ Win ] destination [ Crash ]' in self._filesystem.read_text_file(self._port._absolute_path('TestExpectations')))
|
| + self.assertTrue('crbug.com/42 [ Win ] destination [ Crash ]' in self._filesystem.read_text_file(self._port._absolute_path(
|
| + 'TestExpectations')))
|
|
|
| def test_expectation_is_added_when_subdirectory_moved(self):
|
| self._mover.move('origin/path', 'destination')
|
| - self.assertTrue('crbug.com/42 [ Release ] origin [ Crash ]' in self._filesystem.read_text_file(self._port._absolute_path('TestExpectations')))
|
| - self.assertTrue('crbug.com/42 [ Release ] destination [ Crash ]' in self._filesystem.read_text_file(self._port._absolute_path('TestExpectations')))
|
| + self.assertTrue('crbug.com/42 [ Release ] origin [ Crash ]' in self._filesystem.read_text_file(self._port._absolute_path(
|
| + 'TestExpectations')))
|
| + self.assertTrue('crbug.com/42 [ Release ] destination [ Crash ]' in self._filesystem.read_text_file(
|
| + self._port._absolute_path('TestExpectations')))
|
|
|