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

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

Issue 2868003002: CSSPaint: Move layout tests in csspaint/ to http/tests/csspaint/ (Closed)
Patch Set: rebase Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Test runner for the paint worklet.
2 //
3 // Calls a given function with a newly created element, and prints the expected
4 // geometry to the console.
5 //
6 // Runs each test sequentially after a layout and a paint.
7 //
8 // Usage:
9 // testRunnerGeometryLogging([{
10 // func: function(el) {
11 // el.style.width = '100px';
12 // el.style.height = '100px';
13 // },
14 // expected: {width: 100, height: 100},
15 // ]);
16
17 function testRunnerGeometryLogging(tests, workletCode) {
18 if (window.testRunner) {
19 testRunner.waitUntilDone();
20 testRunner.dumpAsText();
21 }
22
23 paintWorklet.addModule('resources/paint-logging-green.js').then(function() {
24 tests.reduce(function(chain, obj) {
25 return chain.then(function() {
26 console.log('The worklet should log: \'width: ' + obj.expected.w idth + ', height: ' + obj.expected.height + '\'');
27 var el = document.createElement('div');
28 document.body.appendChild(el);
29 obj.func(el);
30 return new Promise(function(resolve) {
31 runAfterLayoutAndPaint(function() {
32 document.body.removeChild(el);
33 resolve();
34 });
35 });
36 });
37 }, Promise.resolve()).then(function() {
38 if (window.testRunner) {
39 testRunner.notifyDone();
40 }
41 });
42 });
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698