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

Unified Diff: Tools/Scripts/webkitpy/layout_tests/controllers/repaint_overlay_unittest.py

Issue 303223008: Overlay expected and actual repaint rects for LayoutTests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add several small features Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/layout_tests/controllers/repaint_overlay_unittest.py
diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/repaint_overlay_unittest.py b/Tools/Scripts/webkitpy/layout_tests/controllers/repaint_overlay_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..1449869c3f23b454e0b05397810372f3afaf3c07
--- /dev/null
+++ b/Tools/Scripts/webkitpy/layout_tests/controllers/repaint_overlay_unittest.py
@@ -0,0 +1,54 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import optparse
+import webkitpy.thirdparty.unittest2 as unittest
+
+from webkitpy.layout_tests.controllers import repaint_overlay
+
+
+EXPECTED_TEXT = """
+(GraphicsLayer
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (repaint rects
+ (rect 8.00 108.00 100.00 100.00)
+ (rect 0.00 216.00 800.00 100.00)
+ )
+ )
+ )
+)
+"""
+
+ACTUAL_TEXT = """
+(GraphicsLayer
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (repaint rects
+ (rect 0.00 216.00 800.00 100.00)
+ )
+ )
+ )
+)
+"""
+
+
+class TestRepaintOverlay(unittest.TestCase):
+ def test_result_contains_repaint_rects(self):
+ self.assertTrue(repaint_overlay.result_contains_repaint_rects(EXPECTED_TEXT))
+ self.assertTrue(repaint_overlay.result_contains_repaint_rects(ACTUAL_TEXT))
+ self.assertFalse(repaint_overlay.result_contains_repaint_rects('ABCD'))
+
+ def test_generate_repaint_overlay_html(self):
+ html = repaint_overlay.generate_repaint_overlay_html('test', ACTUAL_TEXT, EXPECTED_TEXT)
+ self.assertNotEqual(-1, html.find('expected_rects = [[8.00,108.00,100.00,100.00],[0.00,216.00,800.00,100.00]];'))
+ self.assertNotEqual(-1, html.find('actual_rects = [[0.00,216.00,800.00,100.00]];'))

Powered by Google App Engine
This is Rietveld 408576698