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

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

Issue 14316009: Update tools to reflect movement of TestExpectations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix equality test Created 7 years, 8 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 #!/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 from datetime import datetime 6 from datetime import datetime
7 7
8 import time 8 import calendar
9 import unittest 9 import unittest
10 10
11 11
12 from test_expectations_history import TestExpectationsHistory 12 from test_expectations_history import TestExpectationsHistory
13 13
14 14
15 class TestTestExpectationsHistory(unittest.TestCase): 15 class TestTestExpectationsHistory(unittest.TestCase):
16 """Unit tests for the TestExpectationsHistory class.""" 16 """Unit tests for the TestExpectationsHistory class."""
17 17
18 def AssertTestName(self, result_list, testname): 18 def AssertTestName(self, result_list, testname):
19 """Assert test name in the result_list. 19 """Assert test name in the result_list.
20 20
21 Args: 21 Args:
22 result_list: a result list of tuples returned by 22 result_list: a result list of tuples returned by
23 |GetDiffBetweenTimesOnly1Diff()|. Each tuple consists of 23 |GetDiffBetweenTimesOnly1Diff()|. Each tuple consists of
24 (old_rev, new_rev, author, date, message, lines) where 24 (old_rev, new_rev, author, date, message, lines) where
25 |lines| are the entries in the test expectation file. 25 |lines| are the entries in the test expectation file.
26 testname: a testname string. 26 testname: a testname string.
27 27
28 Returns: 28 Returns:
29 True if the result contains the testname, False otherwise. 29 True if the result contains the testname, False otherwise.
30 """ 30 """
31 for (_, _, _, _, _, lines) in result_list: 31 for (_, _, _, _, _, lines) in result_list:
32 if any([testname in line for line in lines]): 32 if any([testname in line for line in lines]):
33 return True 33 return True
34 return False 34 return False
35 35
36 # These tests use the following commit.
37 # commit 235788e3a4fc71342a5c9fefe67ce9537706ce35
38 # Author: rniwa@webkit.org
39 # Date: Sat Aug 20 06:19:11 2011 +0000
40
36 def testGetDiffBetweenTimes(self): 41 def testGetDiffBetweenTimes(self):
37 t = (2011, 8, 20, 0, 0, 0, 0, 0, 0) 42 ptime = calendar.timegm((2011, 8, 20, 0, 0, 0, 0, 0, 0))
38 ctime = time.mktime(t) 43 ctime = calendar.timegm((2011, 8, 21, 0, 0, 0, 0, 0, 0))
39 t = (2011, 8, 19, 0, 0, 0, 0, 0, 0)
40 ptime = time.mktime(t)
41 testname = 'fast/css/getComputedStyle/computed-style-without-renderer.html' 44 testname = 'fast/css/getComputedStyle/computed-style-without-renderer.html'
42 testname_list = [testname] 45 testname_list = [testname]
43 result_list = TestExpectationsHistory.GetDiffBetweenTimes( 46 result_list = TestExpectationsHistory.GetDiffBetweenTimes(
44 ptime, ctime, testname_list) 47 ptime, ctime, testname_list)
45 self.assertTrue(self.AssertTestName(result_list, testname)) 48 self.assertTrue(self.AssertTestName(result_list, testname))
46 49
47 def testGetDiffBetweenTimesOnly1Diff(self): 50 def testGetDiffBetweenTimesOnly1Diff(self):
48 ptime = datetime.strptime('2011-08-19-23', '%Y-%m-%d-%H') 51 ptime = calendar.timegm((2011, 8, 20, 6, 0, 0, 0, 0, 0))
49 ptime = time.mktime(ptime.timetuple()) 52 ctime = calendar.timegm((2011, 8, 20, 7, 0, 0, 0, 0, 0))
50 ctime = datetime.strptime('2011-08-20-00', '%Y-%m-%d-%H')
51 ctime = time.mktime(ctime.timetuple())
52 testname = 'fast/css/getComputedStyle/computed-style-without-renderer.html' 53 testname = 'fast/css/getComputedStyle/computed-style-without-renderer.html'
53 testname_list = [testname] 54 testname_list = [testname]
54 result_list = TestExpectationsHistory.GetDiffBetweenTimes( 55 result_list = TestExpectationsHistory.GetDiffBetweenTimes(
55 ptime, ctime, testname_list) 56 ptime, ctime, testname_list)
56 self.assertTrue(self.AssertTestName(result_list, testname)) 57 self.assertTrue(self.AssertTestName(result_list, testname))
57 58
58 def testGetDiffBetweenTimesOnly1DiffWithGobackSeveralDays(self): 59 def testGetDiffBetweenTimesOnly1DiffWithGobackSeveralDays(self):
59 ptime = datetime.strptime('2011-09-11-18', '%Y-%m-%d-%H') 60 ptime = calendar.timegm((2011, 9, 12, 1, 0, 0, 0, 0, 0))
60 ptime = time.mktime(ptime.timetuple()) 61 ctime = calendar.timegm((2011, 9, 12, 2, 0, 0, 0, 0, 0))
61 ctime = datetime.strptime('2011-09-11-19', '%Y-%m-%d-%H')
62 ctime = time.mktime(ctime.timetuple())
63 testname = 'media/video-zoom-controls.html' 62 testname = 'media/video-zoom-controls.html'
64 testname_list = [testname] 63 testname_list = [testname]
65 result_list = TestExpectationsHistory.GetDiffBetweenTimes( 64 result_list = TestExpectationsHistory.GetDiffBetweenTimes(
66 ptime, ctime, testname_list) 65 ptime, ctime, testname_list)
67 self.assertTrue(self.AssertTestName(result_list, testname)) 66 self.assertTrue(self.AssertTestName(result_list, testname))
68 67
69 68
70 if __name__ == '__main__': 69 if __name__ == '__main__':
71 unittest.main() 70 unittest.main()
OLDNEW
« no previous file with comments | « media/tools/layout_tests/test_expectations_history.py ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698