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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/layers/paint-profiler.js

Issue 2954343004: [DevTools] Migrate inspector-protocol/layers tests to new harness (Closed)
Patch Set: fix test Created 3 years, 6 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/inspector-protocol/layers/paint-profiler.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/layers/paint-profiler.js b/third_party/WebKit/LayoutTests/inspector-protocol/layers/paint-profiler.js
new file mode 100644
index 0000000000000000000000000000000000000000..695b742272d51d5825ef5b2bf3e71d3500c22a9e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/layers/paint-profiler.js
@@ -0,0 +1,43 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startHTML(`
+ <head>
+ <style type='text/css'>
+ .composited {
+ position: absolute;
+ top: 25px;
+ left: 25px;
+ width: 50px;
+ height: 50px;
+ background-color: blue;
+ transform: translateZ(10px);
+ }
+ </style>
+ </head>
+ <body>
+ <div class='composited'>
+ Sanity test for DevTools Paint Profiler.
+ </div>
+ </body>
+ `, 'Sanity test for DevTools Paint Profiler.');
+
+ await dp.DOM.getDocument();
+ dp.LayerTree.enable();
+ var layers = (await dp.LayerTree.onceLayerTreeDidChange()).params.layers;
+ var matchingLayers = layers.filter(layer => !!(layer.backendNodeId && layer.transform));
+ testRunner.log('matchingLayers.length: ' + matchingLayers.length);
+
+ var layerId = matchingLayers[0].layerId;
+ var snapshotId = (await dp.LayerTree.makeSnapshot({layerId})).result.snapshotId;
+ var timings = (await dp.LayerTree.profileSnapshot({snapshotId, minRepeatCount: 4, minDuration: 0})).result.timings;
+ testRunner.log('Profile array length: ' + timings.length);
+ for (var i = 0; i < timings.length; ++i) {
+ testRunner.log('Profile subarray ' + i + ' length: ' + timings[i].length);
+ for (var j = 0; j < timings[i].length; ++j)
+ testRunner.log('Profile timing [' + i + '][' + j + '] is a number: ' + (timings[i][j] >= 0));
+ }
+
+ var image = (await dp.LayerTree.replaySnapshot({snapshotId, fromStep: 2, toStep: timings[0].length - 2})).result.dataURL;
+ testRunner.log('LayerTree.replaySnapshot returned valid image: ' + /^data:image\/png;base64,/.test(image));
+ testRunner.log('DONE!');
+ testRunner.completeTest();
+})

Powered by Google App Engine
This is Rietveld 408576698