| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import unittest | 6 import unittest |
| 7 | 7 |
| 8 from test_expectations import TestExpectations | 8 from test_expectations import TestExpectations |
| 9 | 9 |
| 10 | 10 |
| 11 class TestTestExpectations(unittest.TestCase): | 11 class TestTestExpectations(unittest.TestCase): |
| 12 | 12 |
| 13 def testParseLine(self): | 13 def testParseLine(self): |
| 14 line = 'BUGCR86714 MAC GPU : media/video-zoom.html = CRASH IMAGE' | 14 line = ('crbug.com/86714 [ Mac Gpu ] media/video-zoom.html [ Crash ' |
| 15 comments = 'Comments' | 15 'ImageOnlyFailure ]') |
| 16 expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'], | 16 expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'], |
| 17 'Comments': 'Comments', 'MAC': True, 'GPU': True, | 17 'Comments': '', 'MAC': True, 'Gpu': True, |
| 18 'Platforms': ['MAC', 'GPU']} | 18 'Platforms': ['MAC', 'Gpu']} |
| 19 self.assertEquals(TestExpectations.ParseLine(line, comments), | 19 self.assertEquals(TestExpectations.ParseLine(line), |
| 20 expected_map) | 20 ('media/video-zoom.html', expected_map)) |
| 21 | 21 |
| 22 def testParseLineWithLineComments(self): | 22 def testParseLineWithLineComments(self): |
| 23 line = 'BUGCR86714 MAC GPU : media/video-zoom.html = CRASH IMAGE // foo' | 23 line = ('crbug.com/86714 [ Mac Gpu ] media/video-zoom.html [ Crash ' |
| 24 comments = 'Comments' | 24 'ImageOnlyFailure ] # foo') |
| 25 expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'], | 25 expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'], |
| 26 'Comments': 'Comments foo', 'MAC': True, 'GPU': True, | 26 'Comments': ' foo', 'MAC': True, 'Gpu': True, |
| 27 'Platforms': ['MAC', 'GPU']} | 27 'Platforms': ['MAC', 'Gpu']} |
| 28 self.assertEquals(TestExpectations.ParseLine(line, comments), | 28 self.assertEquals(TestExpectations.ParseLine(line), |
| 29 expected_map) | 29 ('media/video-zoom.html', expected_map)) |
| 30 | 30 |
| 31 def testParseLineWithLineGPUComments(self): | 31 def testParseLineWithLineGPUComments(self): |
| 32 line = 'BUGCR86714 MAC : media/video-zoom.html = CRASH IMAGE // GPU' | 32 line = ('crbug.com/86714 [ Mac ] media/video-zoom.html [ Crash ' |
| 33 comments = 'Comments' | 33 'ImageOnlyFailure ] # Gpu') |
| 34 expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'], | 34 expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'], |
| 35 'Comments': 'Comments GPU', 'MAC': True, | 35 'Comments': ' Gpu', 'MAC': True, |
| 36 'Platforms': ['MAC']} | 36 'Platforms': ['MAC']} |
| 37 self.assertEquals(TestExpectations.ParseLine(line, comments), | 37 self.assertEquals(TestExpectations.ParseLine(line), |
| 38 expected_map) | 38 ('media/video-zoom.html', expected_map)) |
| 39 | |
| 40 def testExtractTestOrDirectoryName(self): | |
| 41 line = ('BUGWK58013 MAC GPU : compositing/scaling/' | |
| 42 'tiled-layer-recursion.html = CRASH') | |
| 43 self.assertEquals(TestExpectations.ExtractTestOrDirectoryName(line), | |
| 44 'compositing/scaling/tiled-layer-recursion.html') | |
| 45 | |
| 46 def testExtractTestOrDirectoryNameWithSvg(self): | |
| 47 line = 'BUGWK43668 SKIP : media/track/x.svg = TIMEOUT' | |
| 48 self.assertEquals(TestExpectations.ExtractTestOrDirectoryName(line), | |
| 49 'media/track/x.svg') | |
| 50 | |
| 51 def testExtractTestOrDirectoryNameWithDirName(self): | |
| 52 line = 'BUGWK43668 SKIP : media/track/ = TIMEOUT' | |
| 53 self.assertEquals(TestExpectations.ExtractTestOrDirectoryName(line), | |
| 54 'media/track/') | |
| 55 | |
| 56 def testExtractTestOrDirectoryNameWithException(self): | |
| 57 self.assertRaises(ValueError, | |
| 58 TestExpectations.ExtractTestOrDirectoryName, 'Foo') | |
| 59 | 39 |
| 60 | 40 |
| 61 if __name__ == '__main__': | 41 if __name__ == '__main__': |
| 62 unittest.main() | 42 unittest.main() |
| OLD | NEW |