OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 copy | 6 import copy |
7 import os | 7 import os |
8 import pickle | 8 import pickle |
9 import unittest | 9 import unittest |
10 | 10 |
11 import layouttest_analyzer_helpers | 11 import layouttest_analyzer_helpers |
12 | 12 |
13 | 13 |
14 class TestLayoutTestAnalyzerHelpers(unittest.TestCase): | 14 class TestLayoutTestAnalyzerHelpers(unittest.TestCase): |
15 | 15 |
16 def testFindLatestTime(self): | 16 def testFindLatestTime(self): |
17 time_list = ['2011-08-18-19', '2011-08-18-22', '2011-08-18-21', | 17 time_list = ['2011-08-18-19', '2011-08-18-22', '2011-08-18-21', |
18 '2012-01-11-21'] | 18 '2012-01-11-21', '.foo'] |
19 self.assertEquals(layouttest_analyzer_helpers.FindLatestTime(time_list), | 19 self.assertEquals(layouttest_analyzer_helpers.FindLatestTime(time_list), |
20 '2012-01-11-21') | 20 '2012-01-11-21') |
21 | 21 |
| 22 def testFindLatestTimeWithEmptyList(self): |
| 23 time_list = [] |
| 24 self.assertEquals(layouttest_analyzer_helpers.FindLatestTime(time_list), |
| 25 None) |
| 26 |
| 27 def testFindLatestTimeWithNoValidStringInList(self): |
| 28 time_list = ['.foo1', '232232'] |
| 29 self.assertEquals(layouttest_analyzer_helpers.FindLatestTime(time_list), |
| 30 None) |
| 31 |
22 def GenerateTestDataWholeAndSkip(self): | 32 def GenerateTestDataWholeAndSkip(self): |
23 """You should call this method if you want to generate test data.""" | 33 """You should call this method if you want to generate test data.""" |
24 file_path = os.path.join('test_data', 'base') | 34 file_path = os.path.join('test_data', 'base') |
25 analyzerResultMapBase = ( | 35 analyzerResultMapBase = ( |
26 layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path)) | 36 layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path)) |
27 # Remove this first part | 37 # Remove this first part |
28 m = analyzerResultMapBase.result_map['whole'] | 38 m = analyzerResultMapBase.result_map['whole'] |
29 del m['media/video-source-type.html'] | 39 del m['media/video-source-type.html'] |
30 m = analyzerResultMapBase.result_map['skip'] | 40 m = analyzerResultMapBase.result_map['skip'] |
31 del m['media/track/track-webvtt-tc004-magicheader.html'] | 41 del m['media/track/track-webvtt-tc004-magicheader.html'] |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 file_path = os.path.join('test_data', 'base') | 103 file_path = os.path.join('test_data', 'base') |
94 analyzerResultMapBase = ( | 104 analyzerResultMapBase = ( |
95 layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path)) | 105 layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path)) |
96 self.assertEquals( | 106 self.assertEquals( |
97 len(analyzerResultMapBase.GetListOfBugsForNonSkippedTests().keys()), | 107 len(analyzerResultMapBase.GetListOfBugsForNonSkippedTests().keys()), |
98 10) | 108 10) |
99 | 109 |
100 | 110 |
101 if __name__ == '__main__': | 111 if __name__ == '__main__': |
102 unittest.main() | 112 unittest.main() |
OLD | NEW |