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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py

Issue 1346673003: Allow text expectation for reftests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 4 years, 7 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) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 def get_basic_tests(self): 54 def get_basic_tests(self):
55 return ['failures/expected/text.html', 55 return ['failures/expected/text.html',
56 'failures/expected/image_checksum.html', 56 'failures/expected/image_checksum.html',
57 'failures/expected/crash.html', 57 'failures/expected/crash.html',
58 'failures/expected/needsrebaseline.html', 58 'failures/expected/needsrebaseline.html',
59 'failures/expected/needsmanualrebaseline.html', 59 'failures/expected/needsmanualrebaseline.html',
60 'failures/expected/missing_text.html', 60 'failures/expected/missing_text.html',
61 'failures/expected/image.html', 61 'failures/expected/image.html',
62 'failures/expected/timeout.html', 62 'failures/expected/timeout.html',
63 'passes/text.html'] 63 'passes/text.html',
64 'reftests/failures/expected/needsrebaseline.html',
65 'reftests/failures/expected/needsrebaseline_with_txt.html',
66 'reftests/failures/expected/needsmanualrebaseline.html',
67 'reftests/failures/expected/needsmanualrebaseline_with_txt.html' ,
68 'reftests/failures/expected/has_unused_expectation.html']
64 69
65 def get_basic_expectations(self): 70 def get_basic_expectations(self):
66 return """ 71 return """
67 Bug(test) failures/expected/text.html [ Failure ] 72 Bug(test) failures/expected/text.html [ Failure ]
68 Bug(test) failures/expected/crash.html [ Crash ] 73 Bug(test) failures/expected/crash.html [ Crash ]
69 Bug(test) failures/expected/needsrebaseline.html [ NeedsRebaseline ] 74 Bug(test) failures/expected/needsrebaseline.html [ NeedsRebaseline ]
70 Bug(test) failures/expected/needsmanualrebaseline.html [ NeedsManualRebaseline ] 75 Bug(test) failures/expected/needsmanualrebaseline.html [ NeedsManualRebaseline ]
71 Bug(test) failures/expected/missing_image.html [ Rebaseline Missing ] 76 Bug(test) failures/expected/missing_image.html [ Rebaseline Missing ]
72 Bug(test) failures/expected/image_checksum.html [ Crash ] 77 Bug(test) failures/expected/image_checksum.html [ Crash ]
73 Bug(test) failures/expected/image.html [ Crash Mac ] 78 Bug(test) failures/expected/image.html [ Crash Mac ]
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 190
186 def test_get_test_set(self): 191 def test_get_test_set(self):
187 # Handle some corner cases for this routine not covered by other tests. 192 # Handle some corner cases for this routine not covered by other tests.
188 self.parse_exp(self.get_basic_expectations()) 193 self.parse_exp(self.get_basic_expectations())
189 s = self._exp.get_test_set(CRASH) 194 s = self._exp.get_test_set(CRASH)
190 self.assertEqual(s, set(['failures/expected/crash.html', 'failures/expec ted/image_checksum.html'])) 195 self.assertEqual(s, set(['failures/expected/crash.html', 'failures/expec ted/image_checksum.html']))
191 196
192 def test_needs_rebaseline_reftest(self): 197 def test_needs_rebaseline_reftest(self):
193 try: 198 try:
194 filesystem = self._port.host.filesystem 199 filesystem = self._port.host.filesystem
195 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 200 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'reftests/failures/expected/needsrebaseline.html'), 'content')
196 'failures/expected/needsr ebaseline.html'), 'content') 201 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'reftests/failures/expected/needsrebaseline-expected.html'), 'content')
197 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 202 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'reftests/failures/expected/needsrebaseline_with_txt.html'), 'content')
198 'failures/expected/needsr ebaseline-expected.html'), 'content') 203 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'reftests/failures/expected/needsrebaseline_with_txt-expected.html'), 'con tent')
199 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 204 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'reftests/failures/expected/needsrebaseline_with_txt-expected.txt'), 'cont ent')
200 'failures/expected/needsm anualrebaseline.html'), 'content') 205 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'reftests/failures/expected/needsmanualrebaseline.html'), 'content')
201 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 206 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'reftests/failures/expected/needsmanualrebaseline-expected.html'), 'conten t')
202 'failures/expected/needsm anualrebaseline-expected.html'), 'content') 207 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'reftests/failures/expected/needsmanualrebaseline_with_txt.html'), 'conten t')
203 self.parse_exp("""Bug(user) failures/expected/needsrebaseline.html [ NeedsRebaseline ] 208 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'reftests/failures/expected/needsmanualrebaseline_with_txt.html'), 'conten t')
204 Bug(user) failures/expected/needsmanualrebaseline.html [ NeedsManualRebaseline ] """, is_lint_mode=True) 209 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'reftests/failures/expected/needsmanualrebaseline_with_txt-expected.html') , 'content')
210 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'reftests/failures/expected/needsmanualrebaseline_with_txt-expected.txt'), 'content')
211 self.parse_exp("""Bug(user) reftests/failures/expected/needsrebaseli ne.html [ NeedsRebaseline ]
212 Bug(user) reftests/failures/expected/needsrebaseline_with_txt.html [ NeedsRebase line ]
213 Bug(user) reftests/failures/expected/needsmanualrebaseline.html [ NeedsManualReb aseline ]
214 Bug(user) reftests/failures/expected/needsmanualrebaseline_with_txt.html [ Needs ManualRebaseline ]
215 """, is_lint_mode=True)
205 self.assertFalse(True, "ParseError wasn't raised") 216 self.assertFalse(True, "ParseError wasn't raised")
206 except ParseError, e: 217 except ParseError, e:
207 warnings = """expectations:1 A reftest cannot be marked as NeedsReba seline/NeedsManualRebaseline failures/expected/needsrebaseline.html 218 warnings = """expectations:1 A reftest without text expectation cann ot be marked as NeedsRebaseline/NeedsManualRebaseline reftests/failures/expected /needsrebaseline.html
208 expectations:2 A reftest cannot be marked as NeedsRebaseline/NeedsManualRebaseli ne failures/expected/needsmanualrebaseline.html""" 219 expectations:3 A reftest without text expectation cannot be marked as NeedsRebas eline/NeedsManualRebaseline reftests/failures/expected/needsmanualrebaseline.htm l"""
209 self.assertEqual(str(e), warnings) 220 self.assertEqual(str(e), warnings)
210 221
211 def test_parse_warning(self): 222 def test_parse_warning(self):
212 try: 223 try:
213 filesystem = self._port.host.filesystem 224 filesystem = self._port.host.filesystem
214 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'disabled-test.html-disabled'), 'content') 225 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'disabled-test.html-disabled'), 'content')
215 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'test-to-rebaseline.html'), 'content') 226 filesystem.write_text_file(filesystem.join(self._port.layout_tests_d ir(), 'test-to-rebaseline.html'), 'content')
216 'disabled-test.html-disabled', 227 'disabled-test.html-disabled',
217 self.parse_exp("Bug(user) [ FOO ] failures/expected/text.html [ Fail ure ]\n" 228 self.parse_exp("Bug(user) [ FOO ] failures/expected/text.html [ Fail ure ]\n"
218 "Bug(user) non-existent-test.html [ Failure ]\n" 229 "Bug(user) non-existent-test.html [ Failure ]\n"
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 976
966 def disabled_test_string_whitespace_stripping(self): 977 def disabled_test_string_whitespace_stripping(self):
967 # FIXME: Re-enable this test once we rework the code to no longer suppor t the old syntax. 978 # FIXME: Re-enable this test once we rework the code to no longer suppor t the old syntax.
968 self.assert_round_trip('\n', '') 979 self.assert_round_trip('\n', '')
969 self.assert_round_trip(' [ FOO ] bar [ BAZ ]', '[ FOO ] bar [ BAZ ]') 980 self.assert_round_trip(' [ FOO ] bar [ BAZ ]', '[ FOO ] bar [ BAZ ]')
970 self.assert_round_trip('[ FOO ] bar [ BAZ ]', '[ FOO ] bar [ BAZ ]') 981 self.assert_round_trip('[ FOO ] bar [ BAZ ]', '[ FOO ] bar [ BAZ ]')
971 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FOO ] bar [ BAZ ] # Qux.') 982 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FOO ] bar [ BAZ ] # Qux.')
972 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FOO ] ba r [ BAZ ] # Qux.') 983 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FOO ] ba r [ BAZ ] # Qux.')
973 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FOO ] bar [ BAZ ] # Qux.') 984 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FOO ] bar [ BAZ ] # Qux.')
974 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FO O ] bar [ BAZ ] # Qux.') 985 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FO O ] bar [ BAZ ] # Qux.')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698