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

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 more tests 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 first paint timing instance.");
tdresser 2017/05/09 13:53:27 This string is incorrect, isn't it? The second ti
panicker 2017/05/09 17:55:06 Done.
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") {
tdresser 2017/05/09 13:53:27 Maybe check explicitly that t.first_paint_time has
panicker 2017/05/09 17:55:06 Done.
23 t.first_contentful_paint_time = entries[0].startTime;
24 assert_greater_than(t.first_contentful_paint_time - t.first_ paint_time, 100);
25 observer.disconnect();
26 t.done();
27 }
28 })
29 );
30 observer.observe({entryTypes: ["paint"]});
31
32 // Wait 100ms, then load image
33 setTimeout(function() {
34 var img = document.createElement("IMG");
35 img.src = "resources/circles.png";
36 document.getElementById('image').appendChild(img);
37 }, 100);
38 }, "First Paint triggerd by non-contentful paint. Image load triggers First Contentful Paint.");
tdresser 2017/05/09 13:53:27 triggerd -> triggered
panicker 2017/05/09 17:55:06 Done.
39
40 </script>
41 <div style="background-color:black;color:white;padding:20px;"></div>
42
43
44 </body>
45 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698