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

Side by Side Diff: media/tools/layout_tests/test_expectations_history_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 from datetime import datetime
7 from datetime import timedelta
8 import time
9 import unittest
10
11
12 from test_expectations_history import TestExpectationsHistory
13
14
15 class TestTestExpectationsHistory(unittest.TestCase):
16 """Unit tests for the TestExpectationsHistory class."""
17
18 def AssertTestName(self, result_list, testname):
19 """Assert test name in the result_list.
20
21 Args:
22 result_list: a result list of tuples returned by
23 |GetDiffBetweenTimesOnly1Diff()|. Each tuple consists of
24 (old_rev, new_rev, author, date, message, lines) where
25 |lines| are the entries in the test expectation file.
26 testname: a testname string.
27
28 Returns:
29 True if the result contains the testname, False otherwise.
30 """
31 for (_, _, _, _, _, lines) in result_list:
32 if any([testname in line for line in lines]):
33 return True
34 return False
35
36 def testGetDiffBetweenTimes(self):
37 t = (2011, 8, 20, 0, 0, 0, 0, 0, 0)
38 ctime = time.mktime(t)
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'
42 testname_list = [testname]
43 result_list = TestExpectationsHistory.GetDiffBetweenTimes(
44 ctime, ptime, testname_list)
45 self.assertTrue(self.AssertTestName(result_list, testname))
46
47 def testGetDiffBetweenTimesOnly1Diff(self):
48 ptime = datetime.strptime('2011-08-19-23', '%Y-%m-%d-%H')
49 ptime = time.mktime(ptime.timetuple())
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_list = [testname]
54 result_list = TestExpectationsHistory.GetDiffBetweenTimes(
55 ctime, ptime, testname_list)
56 self.assertTrue(self.AssertTestName(result_list, testname))
57
58
59 if __name__ == '__main__':
60 unittest.main()
OLDNEW
« no previous file with comments | « media/tools/layout_tests/test_expectations_history.py ('k') | media/tools/layout_tests/testname/media.csv » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698