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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/performance-timing/paint-timing/first-paint-only.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: FP only</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="main"></div>
9
8 <script> 10 <script>
11 async_test(function (t) {
12 const div = document.createElement("div");
13 div.style.width = "100px";
14 div.style.height = "100px";
15 div.style.backgroundColor = "red";
16 div.style.color = "blue";
17 document.getElementById("main").appendChild(div);
9 18
10 async_test(function (t) { 19 testRunner.capturePixelsAsyncThen(t.step_func_done(function() {
11 var observer = new PerformanceObserver( 20 const bufferedEntries = performance.getEntriesByType('paint');
12 t.step_func(function (entryList) { 21 assert_equals(bufferedEntries.length, 1, "FP only.");
13 var entries = entryList.getEntries(); 22 assert_equals(bufferedEntries[0].entryType, "paint");
14 // Nothing contentful to be painted yet. 23 assert_equals(bufferedEntries[0].name, "first-paint");
15 assert_equals(entries.length, 1, 24 }));
16 "There should be only first paint timing instance."); 25 }, "Performance first paint timing entry exists. No first contentful paint." );
17 assert_equals(entries[0].entryType, "paint",
18 "Expected entryType to be: paint.");
19 assert_equals(entries[0].name, "first-paint",
20 "Expected name to be: first-paint.");
21 assert_equals(entries[0].duration, 0,
22 "Expected duration to be: 0.");
23 observer.disconnect();
24 })
25 );
26 observer.observe({entryTypes: ["paint"]});
27
28 t.step_timeout(function() { t.done(); }, 1000);
29 }, "Performance first paint timing entry is observable. No first contentful paint.");
30 </script> 26 </script>
31
32 <div style="background-color:black;color:white;padding:20px;"></div>
33 </body> 27 </body>
34 </html> 28 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698