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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/performance-timing/paint-timing/first-contentful-image.html

Issue 2932593002: Attempt 2: Update PaintTiming Web Perf APIs for FP & FCP to report swap time (Closed)
Patch Set: rebase to head 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <head> 2 <head>
3 <title>Performance Paint Timing Test</title> 3 <title>Performance Paint Timing Test: FCP due to image</title>
4 </head> 4 </head>
5 <body> 5 <body>
6 <script src="../../resources/testharness.js"></script> 6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script> 7 <script src="../../resources/testharnessreport.js"></script>
8 <div id="image"></div>
9
8 <script> 10 <script>
9 async_test(function (t) { 11 async_test(function (t) {
10 var observer = new PerformanceObserver( 12 const img = document.createElement("IMG");
11 t.step_func(function (entryList) { 13 img.src = "resources/circles.png";
12 var entries = entryList.getEntries(); 14 img.onload = function() {
13 assert_equals(entries.length, 2, 15 testRunner.capturePixelsAsyncThen(t.step_func_done(function() {
14 "There should be two paint timing instances."); 16 const bufferedEntries = performance.getEntriesByType('paint');
15 assert_equals(entries[0].entryType, "paint", 17 assert_equals(bufferedEntries.length, 2, "There should be two pa int timing instances.");
16 "Expected entryType to be: paint."); 18 assert_equals(bufferedEntries[0].entryType, "paint");
17 assert_equals(entries[0].duration, 0, 19 assert_equals(bufferedEntries[0].name, "first-paint");
18 "Expected duration to be: 0."); 20 assert_equals(bufferedEntries[1].entryType, "paint");
19 21 assert_equals(bufferedEntries[1].name, "first-contentful-paint") ;
20 assert_equals(entries[1].entryType, "paint", 22 }));
21 "Expected entryType to be: paint."); 23 };
22 assert_equals(entries[1].duration, 0, 24 document.getElementById('image').appendChild(img);
23 "Expected duration to be: 0.");
24 observer.disconnect();
25 t.done();
26 })
27 );
28 observer.observe({entryTypes: ["paint"]});
29
30 }, "First contentful paint fires due to image render."); 25 }, "First contentful paint fires due to image render.");
31 </script> 26 </script>
32
33 <script>
34 window.onload = function() {
35 var img = document.createElement("IMG");
36 img.src = "resources/circles.png";
37 document.getElementById('image').appendChild(img);
38 }
39 </script>
40
41 <div id="image"></div>
42 </body> 27 </body>
43 </html> 28 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698