OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 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 = 'BUGCR86714 MAC GPU : media/video-zoom.html = CRASH IMAGE' |
15 comments = 'Comments' | 15 comments = 'Comments' |
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': 'Comments', 'MAC': True, 'GPU': True} |
18 self.assertEquals(TestExpectations.ParseLine(line, comments), | 18 self.assertEquals(TestExpectations.ParseLine(line, comments), |
19 expected_map) | 19 expected_map) |
20 | 20 |
21 def testParseLineWithLineComments(self): | 21 def testParseLineWithLineComments(self): |
22 line = "BUGCR86714 MAC GPU : media/video-zoom.html = CRASH IMAGE // foo" | 22 line = 'BUGCR86714 MAC GPU : media/video-zoom.html = CRASH IMAGE // foo' |
23 comments = 'Comments' | 23 comments = 'Comments' |
24 expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'], | 24 expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'], |
25 'Comments': 'Comments foo', 'MAC': True, 'GPU': True} | 25 'Comments': 'Comments foo', 'MAC': True, 'GPU': True} |
26 self.assertEquals(TestExpectations.ParseLine(line, comments), | 26 self.assertEquals(TestExpectations.ParseLine(line, comments), |
27 expected_map) | 27 expected_map) |
28 | 28 |
29 def testParseLineWithLineGPUComments(self): | 29 def testParseLineWithLineGPUComments(self): |
30 line = "BUGCR86714 MAC : media/video-zoom.html = CRASH IMAGE // GPU" | 30 line = 'BUGCR86714 MAC : media/video-zoom.html = CRASH IMAGE // GPU' |
31 comments = 'Comments' | 31 comments = 'Comments' |
32 expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'], | 32 expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'], |
33 'Comments': 'Comments GPU', 'MAC': True} | 33 'Comments': 'Comments GPU', 'MAC': True} |
34 self.assertEquals(TestExpectations.ParseLine(line, comments), | 34 self.assertEquals(TestExpectations.ParseLine(line, comments), |
35 expected_map) | 35 expected_map) |
36 | 36 |
37 def testExtractTestOrDirectoryName(self): | 37 def testExtractTestOrDirectoryName(self): |
38 line = ('BUGWK58013 MAC GPU : compositing/scaling/' | 38 line = ('BUGWK58013 MAC GPU : compositing/scaling/' |
39 'tiled-layer-recursion.html = CRASH') | 39 'tiled-layer-recursion.html = CRASH') |
40 self.assertEquals(TestExpectations.ExtractTestOrDirectoryName(line), | 40 self.assertEquals(TestExpectations.ExtractTestOrDirectoryName(line), |
41 'compositing/scaling/tiled-layer-recursion.html') | 41 'compositing/scaling/tiled-layer-recursion.html') |
42 | 42 |
43 def testExtractTestOrDirectoryNameWithSvg(self): | 43 def testExtractTestOrDirectoryNameWithSvg(self): |
44 line = 'BUGWK43668 SKIP : media/track/x.svg = TIMEOUT' | 44 line = 'BUGWK43668 SKIP : media/track/x.svg = TIMEOUT' |
45 self.assertEquals(TestExpectations.ExtractTestOrDirectoryName(line), | 45 self.assertEquals(TestExpectations.ExtractTestOrDirectoryName(line), |
46 'media/track/x.svg') | 46 'media/track/x.svg') |
47 | 47 |
48 def testExtractTestOrDirectoryNameWithDirName(self): | 48 def testExtractTestOrDirectoryNameWithDirName(self): |
49 line = 'BUGWK43668 SKIP : media/track/ = TIMEOUT' | 49 line = 'BUGWK43668 SKIP : media/track/ = TIMEOUT' |
50 self.assertEquals(TestExpectations.ExtractTestOrDirectoryName(line), | 50 self.assertEquals(TestExpectations.ExtractTestOrDirectoryName(line), |
51 'media/track/') | 51 'media/track/') |
52 | 52 |
53 def testExtractTestOrDirectoryNameWithException(self): | 53 def testExtractTestOrDirectoryNameWithException(self): |
54 self.assertRaises(ValueError, | 54 self.assertRaises(ValueError, |
55 TestExpectations.ExtractTestOrDirectoryName, 'Foo') | 55 TestExpectations.ExtractTestOrDirectoryName, 'Foo') |
56 | 56 |
57 | 57 |
58 if __name__ == '__main__': | 58 if __name__ == '__main__': |
59 unittest.main() | 59 unittest.main() |
OLD | NEW |