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

Unified Diff: third_party/WebKit/LayoutTests/csspaint/resources/test-runner-geometry-logging.js

Issue 1866623002: Hook up CSSPaintValue::image to CSS Paint API callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments + rebase. Created 4 years, 8 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/csspaint/resources/test-runner-geometry-logging.js
diff --git a/third_party/WebKit/LayoutTests/csspaint/resources/test-runner-geometry-logging.js b/third_party/WebKit/LayoutTests/csspaint/resources/test-runner-geometry-logging.js
new file mode 100644
index 0000000000000000000000000000000000000000..53937e8acc5701cd9d8f3e052e76cfe832b03468
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/csspaint/resources/test-runner-geometry-logging.js
@@ -0,0 +1,43 @@
+// Test runner for the paint worklet.
+//
+// Calls a given function with a newly created element, and prints the expected
+// geometry to the console.
+//
+// Runs each test sequentially after a layout and a paint.
+//
+// Usage:
+// testRunnerGeometryLogging([{
+// func: function(el) {
+// el.style.width = '100px';
+// el.style.height = '100px';
+// },
+// expected: {width: 100, height: 100},
+// ]);
+
+function testRunnerGeometryLogging(tests, workletCode) {
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ paintWorklet.import('resources/paint-logging-green.js').then(function() {
+ tests.reduce(function(chain, obj) {
+ return chain.then(function() {
+ console.log('The worklet should log: \'width: ' + obj.expected.width + ', height: ' + obj.expected.height + '\'');
+ var el = document.createElement('div');
+ document.body.appendChild(el);
+ obj.func(el);
+ return new Promise(function(resolve) {
+ runAfterLayoutAndPaint(function() {
+ document.body.removeChild(el);
+ resolve();
+ });
+ });
+ });
+ }, Promise.resolve()).then(function() {
+ if (window.testRunner) {
+ testRunner.notifyDone();
+ }
+ });
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698