Lines Matching refs:self

41     def __init__(self, **kwargs):
44 super(MockPort, self).__init__(host, host.port_factory.all_port_names()[0], **kwargs)
46 host.filesystem.maybe_make_directory(self._absolute_path('platform'))
47 host.filesystem.maybe_make_directory(self._absolute_path('existing_directory'))
48 host.filesystem.write_text_file(self._absolute_path('existing_file.txt'), '')
49 host.filesystem.write_text_file(self._absolute_path('VirtualTestSuites'), '[]')
50 host.filesystem.write_text_file(self._absolute_path('TestExpectations'), """
55 host.filesystem.write_text_file(self._absolute_path('existing_directory_with_contents', 'test.html'), '')
56 host.filesystem.write_text_file(self._absolute_path('origin', 'path', 'test.html'), """
64 host.filesystem.write_text_file(self._absolute_path('origin', 'path', 'test.css'), """
71 host.filesystem.write_text_file(self._absolute_path('origin', 'path', 'test.js'), """
76 host.filesystem.write_text_file(self._absolute_path('unmoved', 'test.html'), """
81 def _absolute_path(self, *paths):
82 return self.host.scm().absolute_path('LayoutTests', *paths)
84 def layout_tests_dir(self):
85 return self._absolute_path()
90 def setUp(self):
92 self._port = port
93 self._filesystem = self._port.host.filesystem
94 self._mover = LayoutTestsMover(port=self._port)
96 def test_non_existent_origin_raises(self):
97 self.assertRaises(Exception, self._mover.move, 'non_existent', 'destination')
99 def test_origin_outside_layout_tests_directory_raises(self):
100 self.assertRaises(Exception, self._mover.move, '../outside', 'destination')
102 def test_file_destination_raises(self):
103 self.assertRaises(Exception, self._mover.move, 'origin/path', 'existing_file.txt')
105 def test_destination_outside_layout_tests_directory_raises(self):
106 self.assertRaises(Exception, self._mover.move, 'origin/path', '../outside')
108 def test_basic_operation(self):
109 self._mover.move('origin/path', 'destination')
110 self.assertFalse(self._filesystem.exists(self._port._absolute_path('origin/path')))
111 self.assertTrue(self._filesystem.isfile(self._port._absolute_path('destination/test.html')))
113 def test_move_to_existing_directory(self):
114 self._mover.move('origin/path', 'existing_directory')
115 self.assertFalse(self._filesystem.exists(self._port._absolute_path('origin', 'path')))
116 self.assertTrue(self._filesystem.isfile(self._port._absolute_path('existing_directory', 'test.html')))
118 def test_collision_in_existing_directory_raises(self):
119 self.assertRaises(Exception, self._mover.move, 'origin/path', 'existing_directory_with_contents')
121 def test_move_to_layout_tests_root(self):
122 self._mover.move('origin/path', '')
123 self.assertFalse(self._filesystem.exists(self._port._absolute_path('origin', 'path')))
124 self.assertTrue(self._filesystem.isfile(self._port._absolute_path('test.html')))
126 def test_moved_reference_in_moved_file_not_updated(self):
127 self._mover.move('origin/path', 'destination')
128 self.assertTrue('src="local_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
130 def test_unmoved_reference_in_unmoved_file_not_updated(self):
131 self._mover.move('origin/path', 'destination')
132 self.assertTrue('src="local_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('unmoved', 'test.html')))
134 def test_moved_reference_in_unmoved_file_is_updated(self):
135 self._mover.move('origin/path', 'destination')
136 self.assertTrue('src="../destination/remote_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('unmoved', 'test.html')))
138 def test_unmoved_reference_in_moved_file_is_updated(self):
139 self._mover.move('origin/path', 'destination')
140 self.assertTrue('src="../unmoved/remote_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
142 def test_references_in_html_file_are_updated(self):
143 self._mover.move('origin/path', 'destination')
144 self.assertTrue('src="../unmoved/remote_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
145 self.assertTrue('src=\'../unmoved/remote_script_single_quotes.js\'' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
146 self.assertTrue('href="../unmoved/remote_script.js"' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
147 self.assertTrue('href=\'../unmoved/remote_script_single_quotes.js\'' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
148 self.assertTrue('href=""' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.html')))
150 def test_references_in_css_file_are_updated(self):
151 self._mover.move('origin/path', 'destination')
152 self.assertTrue('url(\'../unmoved/url_function.js\')' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.css')))
153 self.assertTrue('url("../unmoved/url_function_double_quotes.js")' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.css')))
154 self.assertTrue('url(../unmoved/url_function_no_quotes.js)' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.css')))
155 self.assertTrue('url(\'\')' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.css')))
156 self.assertTrue('url()' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.css')))
158 def test_references_in_javascript_file_are_updated(self):
159 self._mover.move('origin/path', 'destination')
160 self.assertTrue('importScripts(\'../unmoved/import_scripts_function.js\')' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.js')))
161 self.assertTrue('importScripts("../unmoved/import_scripts_function_double_quotes.js")' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.js')))
162 self.assertTrue('importScripts(\'\')' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.js')))
164 def test_expectation_is_updated(self):
165 self._mover.move('origin/path', 'destination')
166 self.assertFalse('origin/path/test.html' in self._filesystem.read_text_file(self._port._absolute_path('TestExpectations')))
167 self.assertTrue('crbug.com/42 [ Debug ] destination/test.html [ Pass Timeout Failure ]'
168 in self._filesystem.read_text_file(self._port._absolute_path('TestExpectations')))
170 def test_directory_expectation_is_updated(self):
171 self._mover.move('origin/path', 'destination')
172 self.assertFalse('origin/path' in self._filesystem.read_text_file(self._port._absolute_path('TestExpectations')))
173 self.assertTrue('crbug.com/42 [ Win ] destination [ Slow ]' in self._filesystem.read_text_file(self._port._absolute_path('TestExpectations')))
175 def test_expectation_is_added_when_subdirectory_moved(self):
176 self._mover.move('origin/path', 'destination')
177 self.assertTrue('crbug.com/42 [ Release ] origin [ Crash ]' in self._filesystem.read_text_file(self._port._absolute_path('TestExpectations')))
178 self.assertTrue('crbug.com/42 [ Release ] destination [ Crash ]' in self._filesystem.read_text_file(self._port._absolute_path('TestExpectations')))