Home | History | Annotate | Download | only in layout_tests
      1 #!/usr/bin/env python
      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
      4 # found in the LICENSE file.
      5 
      6 import unittest
      7 
      8 from test_expectations import TestExpectations
      9 
     10 
     11 class TestTestExpectations(unittest.TestCase):
     12 
     13   def testParseLine(self):
     14     line = ('crbug.com/86714 [ Mac Gpu ] media/video-zoom.html [ Crash '
     15             'ImageOnlyFailure ]')
     16     expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'],
     17                     'Comments': '', 'MAC': True, 'Gpu': True,
     18                     'Platforms': ['MAC', 'Gpu']}
     19     self.assertEquals(TestExpectations.ParseLine(line),
     20                       ('media/video-zoom.html', expected_map))
     21 
     22   def testParseLineWithLineComments(self):
     23     line = ('crbug.com/86714 [ Mac Gpu ] media/video-zoom.html [ Crash '
     24             'ImageOnlyFailure ] # foo')
     25     expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'],
     26                     'Comments': ' foo', 'MAC': True, 'Gpu': True,
     27                     'Platforms': ['MAC', 'Gpu']}
     28     self.assertEquals(TestExpectations.ParseLine(line),
     29                       ('media/video-zoom.html', expected_map))
     30 
     31   def testParseLineWithLineGPUComments(self):
     32     line = ('crbug.com/86714 [ Mac ] media/video-zoom.html [ Crash '
     33             'ImageOnlyFailure ] # Gpu')
     34     expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'],
     35                     'Comments': ' Gpu', 'MAC': True,
     36                     'Platforms': ['MAC']}
     37     self.assertEquals(TestExpectations.ParseLine(line),
     38                       ('media/video-zoom.html', expected_map))
     39 
     40 
     41 if __name__ == '__main__':
     42   unittest.main()
     43