1 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 import unittest 6 7 from webkitpy.layout_tests.controllers import repaint_overlay 8 9 10 LAYER_TREE = """{ 11 "bounds":[800.00,600.00], 12 "children":[ 13 { 14 "position": [8.00, 80.00], 15 "bounds": [800.00, 600.00], 16 "contentsOpaque": true, 17 "drawsContent": true, 18 "repaintRects": [ 19 [8, 108, 100, 100], 20 [0, 216, 800, 100] 21 ] 22 } 23 ] 24 } 25 """ 26 27 class TestRepaintOverlay(unittest.TestCase): 28 def test_result_contains_repaint_rects(self): 29 self.assertTrue(repaint_overlay.result_contains_repaint_rects(LAYER_TREE)) 30 self.assertFalse(repaint_overlay.result_contains_repaint_rects('ABCD')) 31 32 def test_extract_layer_tree(self): 33 self.assertEquals(LAYER_TREE, repaint_overlay.extract_layer_tree(LAYER_TREE)) 34