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

Unified Diff: third_party/WebKit/LayoutTests/paint/invalidation/resources/text-based-repaint.js

Issue 2321183002: Move repaint tests (except for svg/) to paint/invalidation (Closed)
Patch Set: - Created 4 years, 3 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: third_party/WebKit/LayoutTests/paint/invalidation/resources/text-based-repaint.js
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/resources/text-based-repaint.js b/third_party/WebKit/LayoutTests/paint/invalidation/resources/text-based-repaint.js
new file mode 100644
index 0000000000000000000000000000000000000000..d799d0f0843e8f21a182656eadc9e199768ffd68
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/resources/text-based-repaint.js
@@ -0,0 +1,79 @@
+// Asynchronous tests should manually call finishRepaintTest at the appropriate
+// time.
+window.testIsAsync = false;
+window.outputRepaintRects = true;
+
+// All repaint tests are asynchronous.
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+if (window.internals) {
+ internals.settings.setUseDefaultImageInterpolationQuality(true);
+ internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = true;
+}
+
+function runRepaintTest()
+{
+ if (!window.testRunner || !window.internals) {
+ setTimeout(repaintTest, 500);
+ return;
+ }
+
+ if (window.enablePixelTesting)
+ testRunner.dumpAsTextWithPixelResults();
+ else
+ testRunner.dumpAsText();
+
+ testRunner.layoutAndPaintAsyncThen(function() {
+ window.internals.startTrackingRepaints(document);
+ repaintTest();
+ if (!window.testIsAsync)
+ finishRepaintTest();
+ });
+}
+
+function runRepaintAndPixelTest()
+{
+ window.enablePixelTesting = true;
+ runRepaintTest();
+}
+
+function forceStyleRecalc()
+{
+ if (document.body)
+ document.body.clientTop;
+ else if (document.documentElement)
+ document.documentElement.clientTop;
+}
+
+function finishRepaintTest()
+{
+ if (!window.testRunner || !window.internals)
+ return;
+
+ // Force a style recalc.
+ forceStyleRecalc();
+
+ var flags = window.internals.LAYER_TREE_INCLUDES_PAINT_INVALIDATIONS;
+
+ if (window.layerTreeAsTextAdditionalFlags)
+ flags |= window.layerTreeAsTextAdditionalFlags;
+
+ var repaintRects = window.internals.layerTreeAsText(document, flags);
+
+ internals.stopTrackingRepaints(document);
+
+ // Play nice with JS tests which may want to print out assert results.
+ if (window.isJsTest)
+ window.outputRepaintRects = false;
+
+ if (window.outputRepaintRects)
+ testRunner.setCustomTextOutput(repaintRects);
+
+ if (window.afterTest)
+ window.afterTest();
+
+ // Play nice with async JS tests which want to notifyDone themselves.
+ if (!window.jsTestIsAsync)
+ testRunner.notifyDone();
+}

Powered by Google App Engine
This is Rietveld 408576698