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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/layout_tests_mover_unittest.py

Issue 546133003: Reformat webkitpy.layout_tests w/ format-webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 def test_collision_in_existing_directory_raises(self): 117 def test_collision_in_existing_directory_raises(self):
118 self.assertRaises(Exception, self._mover.move, 'origin/path', 'existing_ directory_with_contents') 118 self.assertRaises(Exception, self._mover.move, 'origin/path', 'existing_ directory_with_contents')
119 119
120 def test_move_to_layout_tests_root(self): 120 def test_move_to_layout_tests_root(self):
121 self._mover.move('origin/path', '') 121 self._mover.move('origin/path', '')
122 self.assertFalse(self._filesystem.exists(self._port._absolute_path('orig in', 'path'))) 122 self.assertFalse(self._filesystem.exists(self._port._absolute_path('orig in', 'path')))
123 self.assertTrue(self._filesystem.isfile(self._port._absolute_path('test. html'))) 123 self.assertTrue(self._filesystem.isfile(self._port._absolute_path('test. html')))
124 124
125 def test_moved_reference_in_moved_file_not_updated(self): 125 def test_moved_reference_in_moved_file_not_updated(self):
126 self._mover.move('origin/path', 'destination') 126 self._mover.move('origin/path', 'destination')
127 self.assertTrue('src="local_script.js"' in self._filesystem.read_text_fi le(self._port._absolute_path('destination', 'test.html'))) 127 self.assertTrue(
128 'src="local_script.js"' in self._filesystem.read_text_file(
129 self._port._absolute_path(
130 'destination',
131 'test.html')))
128 132
129 def test_unmoved_reference_in_unmoved_file_not_updated(self): 133 def test_unmoved_reference_in_unmoved_file_not_updated(self):
130 self._mover.move('origin/path', 'destination') 134 self._mover.move('origin/path', 'destination')
131 self.assertTrue('src="local_script.js"' in self._filesystem.read_text_fi le(self._port._absolute_path('unmoved', 'test.html'))) 135 self.assertTrue(
136 'src="local_script.js"' in self._filesystem.read_text_file(
137 self._port._absolute_path(
138 'unmoved',
139 'test.html')))
132 140
133 def test_moved_reference_in_unmoved_file_is_updated(self): 141 def test_moved_reference_in_unmoved_file_is_updated(self):
134 self._mover.move('origin/path', 'destination') 142 self._mover.move('origin/path', 'destination')
135 self.assertTrue('src="../destination/remote_script.js"' in self._filesys tem.read_text_file(self._port._absolute_path('unmoved', 'test.html'))) 143 self.assertTrue(
144 'src="../destination/remote_script.js"' in self._filesystem.read_tex t_file(self._port._absolute_path('unmoved', 'test.html')))
136 145
137 def test_unmoved_reference_in_moved_file_is_updated(self): 146 def test_unmoved_reference_in_moved_file_is_updated(self):
138 self._mover.move('origin/path', 'destination') 147 self._mover.move('origin/path', 'destination')
139 self.assertTrue('src="../unmoved/remote_script.js"' in self._filesystem. read_text_file(self._port._absolute_path('destination', 'test.html'))) 148 self.assertTrue(
149 'src="../unmoved/remote_script.js"' in self._filesystem.read_text_fi le(self._port._absolute_path('destination', 'test.html')))
140 150
141 def test_references_in_html_file_are_updated(self): 151 def test_references_in_html_file_are_updated(self):
142 self._mover.move('origin/path', 'destination') 152 self._mover.move('origin/path', 'destination')
143 self.assertTrue('src="../unmoved/remote_script.js"' in self._filesystem. read_text_file(self._port._absolute_path('destination', 'test.html'))) 153 self.assertTrue(
144 self.assertTrue('src=\'../unmoved/remote_script_single_quotes.js\'' in s elf._filesystem.read_text_file(self._port._absolute_path('destination', 'test.ht ml'))) 154 'src="../unmoved/remote_script.js"' in self._filesystem.read_text_fi le(self._port._absolute_path('destination', 'test.html')))
145 self.assertTrue('href="../unmoved/remote_script.js"' in self._filesystem .read_text_file(self._port._absolute_path('destination', 'test.html'))) 155 self.assertTrue(
146 self.assertTrue('href=\'../unmoved/remote_script_single_quotes.js\'' in self._filesystem.read_text_file(self._port._absolute_path('destination', 'test.h tml'))) 156 'src=\'../unmoved/remote_script_single_quotes.js\'' in self._filesys tem.read_text_file(
157 self._port._absolute_path(
158 'destination',
159 'test.html')))
160 self.assertTrue(
161 'href="../unmoved/remote_script.js"' in self._filesystem.read_text_f ile(self._port._absolute_path('destination', 'test.html')))
162 self.assertTrue(
163 'href=\'../unmoved/remote_script_single_quotes.js\'' in self._filesy stem.read_text_file(
164 self._port._absolute_path(
165 'destination',
166 'test.html')))
147 self.assertTrue('href=""' in self._filesystem.read_text_file(self._port. _absolute_path('destination', 'test.html'))) 167 self.assertTrue('href=""' in self._filesystem.read_text_file(self._port. _absolute_path('destination', 'test.html')))
148 168
149 def test_references_in_css_file_are_updated(self): 169 def test_references_in_css_file_are_updated(self):
150 self._mover.move('origin/path', 'destination') 170 self._mover.move('origin/path', 'destination')
151 self.assertTrue('url(\'../unmoved/url_function.js\')' in self._filesyste m.read_text_file(self._port._absolute_path('destination', 'test.css'))) 171 self.assertTrue(
152 self.assertTrue('url("../unmoved/url_function_double_quotes.js")' in sel f._filesystem.read_text_file(self._port._absolute_path('destination', 'test.css' ))) 172 '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_no_quotes.js)' in self._fil esystem.read_text_file(self._port._absolute_path('destination', 'test.css'))) 173 self.assertTrue(
174 'url("../unmoved/url_function_double_quotes.js")' in self._filesyste m.read_text_file(
175 self._port._absolute_path(
176 'destination',
177 'test.css')))
178 self.assertTrue(
179 'url(../unmoved/url_function_no_quotes.js)' in self._filesystem.read _text_file(self._port._absolute_path('destination', 'test.css')))
154 self.assertTrue('url(\'\')' in self._filesystem.read_text_file(self._por t._absolute_path('destination', 'test.css'))) 180 self.assertTrue('url(\'\')' in self._filesystem.read_text_file(self._por t._absolute_path('destination', 'test.css')))
155 self.assertTrue('url()' in self._filesystem.read_text_file(self._port._a bsolute_path('destination', 'test.css'))) 181 self.assertTrue('url()' in self._filesystem.read_text_file(self._port._a bsolute_path('destination', 'test.css')))
156 182
157 def test_references_in_javascript_file_are_updated(self): 183 def test_references_in_javascript_file_are_updated(self):
158 self._mover.move('origin/path', 'destination') 184 self._mover.move('origin/path', 'destination')
159 self.assertTrue('importScripts(\'../unmoved/import_scripts_function.js\' )' in self._filesystem.read_text_file(self._port._absolute_path('destination', ' test.js'))) 185 self.assertTrue(
160 self.assertTrue('importScripts("../unmoved/import_scripts_function_doubl e_quotes.js")' in self._filesystem.read_text_file(self._port._absolute_path('des tination', 'test.js'))) 186 'importScripts(\'../unmoved/import_scripts_function.js\')' in self._ filesystem.read_text_file(
161 self.assertTrue('importScripts(\'\')' in self._filesystem.read_text_file (self._port._absolute_path('destination', 'test.js'))) 187 self._port._absolute_path(
188 'destination',
189 'test.js')))
190 self.assertTrue(
191 'importScripts("../unmoved/import_scripts_function_double_quotes.js" )' in self._filesystem.read_text_file(
192 self._port._absolute_path(
193 'destination',
194 'test.js')))
195 self.assertTrue(
196 'importScripts(\'\')' in self._filesystem.read_text_file(
197 self._port._absolute_path(
198 'destination',
199 'test.js')))
162 200
163 def test_expectation_is_updated(self): 201 def test_expectation_is_updated(self):
164 self._mover.move('origin/path', 'destination') 202 self._mover.move('origin/path', 'destination')
165 self.assertFalse('origin/path/test.html' in self._filesystem.read_text_f ile(self._port._absolute_path('TestExpectations'))) 203 self.assertFalse('origin/path/test.html' in self._filesystem.read_text_f ile(self._port._absolute_path('TestExpectations')))
166 self.assertTrue('crbug.com/42 [ Debug ] destination/test.html [ Pass Tim eout Failure ]' 204 self.assertTrue('crbug.com/42 [ Debug ] destination/test.html [ Pass Tim eout Failure ]'
167 in self._filesystem.read_text_file(self._port._absolute_ path('TestExpectations'))) 205 in self._filesystem.read_text_file(self._port._absolute_ path('TestExpectations')))
168 206
169 def test_directory_expectation_is_updated(self): 207 def test_directory_expectation_is_updated(self):
170 self._mover.move('origin/path', 'destination') 208 self._mover.move('origin/path', 'destination')
171 self.assertFalse('origin/path' in self._filesystem.read_text_file(self._ port._absolute_path('TestExpectations'))) 209 self.assertFalse('origin/path' in self._filesystem.read_text_file(self._ port._absolute_path('TestExpectations')))
172 self.assertTrue('crbug.com/42 [ Win ] destination [ Slow ]' in self._fil esystem.read_text_file(self._port._absolute_path('TestExpectations'))) 210 self.assertTrue(
211 'crbug.com/42 [ Win ] destination [ Slow ]' in self._filesystem.read _text_file(self._port._absolute_path('TestExpectations')))
173 212
174 def test_expectation_is_added_when_subdirectory_moved(self): 213 def test_expectation_is_added_when_subdirectory_moved(self):
175 self._mover.move('origin/path', 'destination') 214 self._mover.move('origin/path', 'destination')
176 self.assertTrue('crbug.com/42 [ Release ] origin [ Crash ]' in self._fil esystem.read_text_file(self._port._absolute_path('TestExpectations'))) 215 self.assertTrue(
177 self.assertTrue('crbug.com/42 [ Release ] destination [ Crash ]' in self ._filesystem.read_text_file(self._port._absolute_path('TestExpectations'))) 216 'crbug.com/42 [ Release ] origin [ Crash ]' in self._filesystem.read _text_file(self._port._absolute_path('TestExpectations')))
217 self.assertTrue(
218 'crbug.com/42 [ Release ] destination [ Crash ]' in self._filesystem .read_text_file(self._port._absolute_path('TestExpectations')))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698