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

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

Issue 2397333002: Change layerTreeAsText to default to layer lists. (Closed)
Patch Set: none Created 4 years, 2 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
1 // Test runner for the paint worklet to test invalidation behaviour. 1 // Test runner for the paint worklet to test invalidation behaviour.
2 // 2 //
3 // Registers an promise_test per test case, which: 3 // Registers an promise_test per test case, which:
4 // - Creates an element. 4 // - Creates an element.
5 // - Invalidates the style of that element. 5 // - Invalidates the style of that element.
6 // - [worklet] Worklet code logs if it got the invalidation. 6 // - [worklet] Worklet code logs if it got the invalidation.
7 // - Asserts that it got the correct paint invalidation. 7 // - Asserts that it got the correct paint invalidation.
8 // 8 //
9 // Usage: 9 // Usage:
10 // testRunnerInvalidationLogging('background-image', [ 10 // testRunnerInvalidationLogging('background-image', [
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (test.invalidationProperty) { 70 if (test.invalidationProperty) {
71 el.style.setProperty(test.invalidationProperty, test.value); 71 el.style.setProperty(test.invalidationProperty, test.value);
72 } else { 72 } else {
73 el.style.setProperty(test.property, test.value); 73 el.style.setProperty(test.property, test.value);
74 } 74 }
75 75
76 runAfterLayoutAndPaint(function() { 76 runAfterLayoutAndPaint(function() {
77 // Check that the we got the correct paint invalidation. 77 // Check that the we got the correct paint invalidation.
78 if (window.internals) { 78 if (window.internals) {
79 const layers = JSON.parse(internals.layerTreeAsText(docu ment, internals.LAYER_TREE_INCLUDES_PAINT_INVALIDATIONS)); 79 const layers = JSON.parse(internals.layerTreeAsText(docu ment, internals.LAYER_TREE_INCLUDES_PAINT_INVALIDATIONS));
80 const paintInvalidations = layers['children'][0]['paintI nvalidations']; 80 const paintInvalidations = layers['layers'][0]['paintInv alidations'];
81 assert_equals(!paintInvalidations, !!test.noInvalidation ); 81 assert_equals(!paintInvalidations, !!test.noInvalidation );
82 if (paintInvalidations) { 82 if (paintInvalidations) {
83 assert_equals(paintInvalidations.length, 1, 'There s hould be only one paint invalidation.'); 83 assert_equals(paintInvalidations.length, 1, 'There s hould be only one paint invalidation.');
84 assert_array_equals( 84 assert_array_equals(
85 paintInvalidations[0]['rect'], 85 paintInvalidations[0]['rect'],
86 [rect.left, rect.top, rect.width, rect.heigh t], 86 [rect.left, rect.top, rect.width, rect.heigh t],
87 'The paint invalidation should cover the ent ire element.'); 87 'The paint invalidation should cover the ent ire element.');
88 } 88 }
89 internals.stopTrackingRepaints(document); 89 internals.stopTrackingRepaints(document);
90 } 90 }
91 91
92 // Cleanup. 92 // Cleanup.
93 document.body.removeChild(el); 93 document.body.removeChild(el);
94 resolve(); 94 resolve();
95 }); 95 });
96 }); 96 });
97 97
98 }); 98 });
99 99
100 }, testName); 100 }, testName);
101 } 101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698