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/layouttests_unittest.py

Issue 9476021: Updating Layout test analyzer to add control to show issue detail or not. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 10 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env 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 os
7 import unittest 6 import unittest
8 7
9 from layouttests import LayoutTests 8 from layouttests import LayoutTests
10 from test_expectations import TestExpectations 9 from test_expectations import TestExpectations
11 10
12 11
13 class TestLayoutTests(unittest.TestCase): 12 class TestLayoutTests(unittest.TestCase):
14 """Unit tests for the LayoutTests class.""" 13 """Unit tests for the LayoutTests class."""
15 14
16 def testJoinWithTestExpectation(self): 15 def testJoinWithTestExpectation(self):
17 layouttests = LayoutTests(parent_location_list=['media/']) 16 layouttests = LayoutTests(parent_location_list=['media/'])
18 test_expectations = TestExpectations() 17 test_expectations = TestExpectations()
19 test_info_map = layouttests.JoinWithTestExpectation(test_expectations) 18 test_info_map = layouttests.JoinWithTestExpectation(test_expectations)
20 # TODO(imasaki): have better assertion below. Currently, the test 19 # TODO(imasaki): have better assertion below. Currently, the test
21 # expectation file is obtained dynamically so the strict assertion is 20 # expectation file is obtained dynamically so the strict assertion is
22 # impossible. 21 # impossible.
23 self.assertTrue(any(['media/' in k for k in test_info_map.keys()]), 22 self.assertTrue(any(['media/' in k for k in test_info_map.keys()]),
24 msg=('Analyzer result should contain at least one ' 23 msg=('Analyzer result should contain at least one '
25 'media test cases since we only retrieved media ' 24 'media test cases since we only retrieved media '
26 'related test')) 25 'related test'))
27 26
28 def testGetTestDescriptionsFromSVN(self): 27 def testGetTestDescriptionsFromSVN(self):
29 desc1 = LayoutTests.GetTestDescriptionFromSVN( 28 desc1 = LayoutTests.GetTestDescriptionFromSVN(
30 'media/video-play-empty-events.html') 29 'media/video-play-empty-events.html')
31 self.assertEquals(desc1, 30 self.assertEquals(desc1,
32 ('Test that play() from EMPTY network state triggers ' 31 ('Test that play() from EMPTY network state triggers '
33 'load() and async play event.'), 32 'load() and async play event.'),
34 msg='Extracted test description is wrong') 33 msg='Extracted test description is wrong')
35 desc2 = LayoutTests.GetTestDescriptionFromSVN('jquery/data.html') 34 desc2 = LayoutTests.GetTestDescriptionFromSVN('jquery/data.html')
36 self.assertEquals(desc2, 'UNKNOWN', 35 self.assertEquals(desc2, 'UNKNOWN',
37 msg='Extracted test description is wrong') 36 msg='Extracted test description is wrong')
38 37
39 def testGetParentDirectoryList(self): 38 def testGetParentDirectoryList(self):
40 testname_list = ['hoge1/hoge2/hoge3.html', 'hoge1/x.html', 39 testname_list = ['hoge1/hoge2/hoge3.html', 'hoge1/x.html',
41 'hoge1/hoge2/hoge4.html'] 40 'hoge1/hoge2/hoge4.html']
42 expected_result = ['hoge1/', 'hoge1/hoge2/'] 41 expected_result = ['hoge1/', 'hoge1/hoge2/']
43 self.assertEquals(LayoutTests.GetParentDirectoryList(testname_list), 42 self.assertEquals(LayoutTests.GetParentDirectoryList(testname_list),
44 expected_result) 43 expected_result)
45 44
46 45
47 if __name__ == '__main__': 46 if __name__ == '__main__':
48 unittest.main() 47 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698