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

Side by Side Diff: media/tools/layout_tests/layouttest_analyzer_helpers_unittest.py

Issue 7693018: Intial checkin of layout test analyzer. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Modified based on CR comments. Created 9 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
(Empty)
1 #!/usr/bin/python
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
4 # found in the LICENSE file.
5
6 import copy
7 import os
8 import pickle
9 import unittest
10
11 import layouttest_analyzer_helpers
12
13
14 class TestLayoutTestAnalyzerHelpers(unittest.TestCase):
15
16 def testFindLatestTime(self):
17 time_list = ['2011-08-18-19', '2011-08-18-22', '2011-08-18-21',
18 '2012-01-11-21']
19 self.assertEquals(layouttest_analyzer_helpers.FindLatestTime(time_list),
20 '2012-01-11-21')
21
22 def GenerateTestDataWholeAndSkip(self):
23 """You should call this method if you want to generate test data."""
24 file_path = os.path.join('test_data', 'base')
25 analyzerResultMapBase = (
26 layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
27 # Remove this first part
28 m = analyzerResultMapBase.result_map['whole']
29 del m['media/video-source-type.html']
30 m = analyzerResultMapBase.result_map['skip']
31 del m['media/track/track-webvtt-tc004-magicheader.html']
32
33 file_path = os.path.join('test_data', 'less')
34 analyzerResultMapBase.Save(file_path)
35
36 file_path = os.path.join('test_data', 'base')
37 analyzerResultMapBase = AnalyzerResultMap.Load(file_path)
38
39 analyzerResultMapBase.result_map['whole']['add1.html'] = True
40 analyzerResultMapBase.result_map['skip']['add2.html'] = True
41
42 file_path = os.path.join('test_data', 'more')
43 analyzerResultMapBase.Save(file_path)
44
45 def GenerateTestDataNonSkip(self):
46 """You should call this method if you want to generate test data."""
47 file_path = os.path.join('test_data', 'base')
48 analyzerResultMapBase = AnalyzerResultMap.Load(file_path)
49 m = analyzerResultMapBase.result_map['nonskip']
50 ex = m['media/media-document-audio-repaint.html']
51 te_info_map1 = ex['te_info'][0]
52 te_info_map2 = copy.copy(te_info_map1)
53 te_info_map2['NEWADDED'] = True
54 ex['te_info'].append(te_info_map2)
55 m = analyzerResultMapBase.result_map['nonskip']
56
57 file_path = os.path.join('test_data', 'more_te_info')
58 analyzerResultMapBase.Save(file_path)
59
60 def testCompareResultMapsWholeAndSkip(self):
61 file_path = os.path.join('test_data', 'base')
62 analyzerResultMapBase = (
63 layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
64
65 file_path = os.path.join('test_data', 'less')
66 analyzerResultMapLess = (
67 layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
68
69 diff = analyzerResultMapBase.CompareToOtherResultMap(analyzerResultMapLess)
70 self.assertEquals(diff['skip'][0][0][0],
71 'media/track/track-webvtt-tc004-magicheader.html')
72 self.assertEquals(diff['whole'][0][0][0],
73 'media/video-source-type.html')
74 file_path = os.path.join('test_data', 'more')
75 analyzerResultMapMore = (
76 layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
77 diff = analyzerResultMapBase.CompareToOtherResultMap(analyzerResultMapMore)
78 self.assertEquals(diff['whole'][1][0][0], 'add1.html')
79 self.assertEquals(diff['skip'][1][0][0], 'add2.html')
80
81 def testCompareResultMapsNonSkip(self):
82 file_path = os.path.join('test_data', 'base')
83 analyzerResultMapBase = (
84 layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
85 file_path = os.path.join('test_data', 'more_te_info')
86 analyzerResultMapMoreTEInfo = (
87 layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
88 m = analyzerResultMapBase.CompareToOtherResultMap(
89 analyzerResultMapMoreTEInfo)
90 self.assertTrue('NEWADDED' in m['nonskip'][1][0][1][0])
91
92 def testGetListOfBugsForNonSkippedTests(self):
93 file_path = os.path.join('test_data', 'base')
94 analyzerResultMapBase = (
95 layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
96 self.assertEquals(
97 len(analyzerResultMapBase.GetListOfBugsForNonSkippedTests().keys()),
98 10)
99
100
101 if __name__ == '__main__':
102 unittest.main()
OLDNEW
« no previous file with comments | « media/tools/layout_tests/layouttest_analyzer_helpers.py ('k') | media/tools/layout_tests/layouttests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698