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

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

Issue 2860143002: Add tests for paint-timing, and move existing tests to same location (Closed)
Patch Set: add missing image resources Created 3 years, 7 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
(Empty)
1 <!DOCTYPE html>
2 <head>
3 <title>Performance Paint Timing Test</title>
4 </head>
5 <body>
6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script>
8 <div id="image"></div>
9
10 <script>
11 async_test(function (t) {
12 var observer = new PerformanceObserver(
13 t.step_func(function (entryList) {
14 var entries = entryList.getEntries();
15 // Nothing contentful to be painted yet.
16 assert_equals(entries.length, 1,
17 "There should be only one paint timing instance delivered at a time.");
18 assert_equals(entries[0].entryType, "paint",
19 "Expected entryType to be: paint.");
20 if (entries[0].name == "first-paint") {
21 t.first_paint_time = entries[0].startTime;
22 } else if (entries[0].name == "first-contentful-paint") {
23 assert_not_equals(t.first_paint_time, "");
24 t.first_contentful_paint_time = entries[0].startTime;
25 assert_greater_than(t.first_contentful_paint_time - t.first_ paint_time, 100);
26 observer.disconnect();
27 t.done();
28 }
29 })
30 );
31 observer.observe({entryTypes: ["paint"]});
32
33 // Wait 100ms, then load image
34 setTimeout(function() {
35 var img = document.createElement("IMG");
36 img.src = "resources/circles.png";
37 document.getElementById('image').appendChild(img);
38 }, 100);
39 }, "First Paint triggered by non-contentful paint. Image load triggers First Contentful Paint.");
40
41 </script>
42 <div style="background-color:black;color:white;padding:20px;"></div>
43
44
45 </body>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698