OLD | NEW |
(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 os |
| 7 import unittest |
| 8 |
| 9 from layouttests import LayoutTests |
| 10 from test_expectations import TestExpectations |
| 11 |
| 12 |
| 13 class TestLayoutTests(unittest.TestCase): |
| 14 """Unit tests for the LayoutTests class.""" |
| 15 |
| 16 def testJoinWithTestExpectation(self): |
| 17 layouttests = LayoutTests(csv_file_path=os.path.join('testname', |
| 18 'media.csv')) |
| 19 test_expectations = TestExpectations() |
| 20 test_info_map = layouttests.JoinWithTestExpectation(test_expectations) |
| 21 # TODO(imasaki): have better assertion below. Currently, the test |
| 22 # expectation file is obtained dynamically so the strict assertion is |
| 23 # impossible. |
| 24 self.assertTrue(any(['media/' in k for k in test_info_map.keys()]), |
| 25 msg=('Analyzer result should contain at least one ' |
| 26 'media test cases since we only retrieved media ' |
| 27 'related test')) |
| 28 |
| 29 def testGetTestDescriptionsFromSVN(self): |
| 30 desc1 = LayoutTests.GetTestDescriptionFromSVN( |
| 31 'media/video-play-empty-events.html') |
| 32 self.assertEquals(desc1, |
| 33 ('Test that play() from EMPTY network state triggers ' |
| 34 'load() and async play event.'), |
| 35 msg='Extracted test description is wrong') |
| 36 desc2 = LayoutTests.GetTestDescriptionFromSVN('jquery/data.html') |
| 37 self.assertEquals(desc2, 'UNKNOWN', |
| 38 msg='Extracted test description is wrong') |
| 39 |
| 40 def testGetParentDirectoryList(self): |
| 41 testname_list = ['hoge1/hoge2/hoge3.html', 'hoge1/x.html', |
| 42 'hoge1/hoge2/hoge4.html'] |
| 43 expected_result = ['hoge1/', 'hoge1/hoge2/'] |
| 44 self.assertEquals(LayoutTests.GetParentDirectoryList(testname_list), |
| 45 expected_result) |
| 46 |
| 47 |
| 48 if __name__ == '__main__': |
| 49 unittest.main() |
OLD | NEW |