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

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

Issue 2826983002: Rename Worklet.import() to Worklet.addModule(). (Closed)
Patch Set: Fixing Layout Tests Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/csspaint/resources/test-runner-invalidation-logging.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Test runner for the paint worklet. 1 // Test runner for the paint worklet.
2 // 2 //
3 // Calls a given function with a newly created element, and prints the expected 3 // Calls a given function with a newly created element, and prints the expected
4 // geometry to the console. 4 // geometry to the console.
5 // 5 //
6 // Runs each test sequentially after a layout and a paint. 6 // Runs each test sequentially after a layout and a paint.
7 // 7 //
8 // Usage: 8 // Usage:
9 // testRunnerGeometryLogging([{ 9 // testRunnerGeometryLogging([{
10 // func: function(el) { 10 // func: function(el) {
11 // el.style.width = '100px'; 11 // el.style.width = '100px';
12 // el.style.height = '100px'; 12 // el.style.height = '100px';
13 // }, 13 // },
14 // expected: {width: 100, height: 100}, 14 // expected: {width: 100, height: 100},
15 // ]); 15 // ]);
16 16
17 function testRunnerGeometryLogging(tests, workletCode) { 17 function testRunnerGeometryLogging(tests, workletCode) {
18 if (window.testRunner) { 18 if (window.testRunner) {
19 testRunner.waitUntilDone(); 19 testRunner.waitUntilDone();
20 testRunner.dumpAsText(); 20 testRunner.dumpAsText();
21 } 21 }
22 22
23 paintWorklet.import('resources/paint-logging-green.js').then(function() { 23 paintWorklet.addModule('resources/paint-logging-green.js').then(function() {
24 tests.reduce(function(chain, obj) { 24 tests.reduce(function(chain, obj) {
25 return chain.then(function() { 25 return chain.then(function() {
26 console.log('The worklet should log: \'width: ' + obj.expected.w idth + ', height: ' + obj.expected.height + '\''); 26 console.log('The worklet should log: \'width: ' + obj.expected.w idth + ', height: ' + obj.expected.height + '\'');
27 var el = document.createElement('div'); 27 var el = document.createElement('div');
28 document.body.appendChild(el); 28 document.body.appendChild(el);
29 obj.func(el); 29 obj.func(el);
30 return new Promise(function(resolve) { 30 return new Promise(function(resolve) {
31 runAfterLayoutAndPaint(function() { 31 runAfterLayoutAndPaint(function() {
32 document.body.removeChild(el); 32 document.body.removeChild(el);
33 resolve(); 33 resolve();
34 }); 34 });
35 }); 35 });
36 }); 36 });
37 }, Promise.resolve()).then(function() { 37 }, Promise.resolve()).then(function() {
38 if (window.testRunner) { 38 if (window.testRunner) {
39 testRunner.notifyDone(); 39 testRunner.notifyDone();
40 } 40 }
41 }); 41 });
42 }); 42 });
43 } 43 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/csspaint/resources/test-runner-invalidation-logging.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698