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

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

Issue 2932593002: Attempt 2: Update PaintTiming Web Perf APIs for FP & FCP to report swap time (Closed)
Patch Set: replace var with let 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 canvas</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 <canvas id="canvas" width="200" height="200" ></canvas>
9
8 <script> 10 <script>
9 async_test(function (t) { 11 async_test(function (t) {
10 var observer = new PerformanceObserver( 12 let c = document.getElementById("canvas");
tdresser 2017/06/12 14:44:45 constq
11 t.step_func(function (entryList) { 13 var ctx = c.getContext("2d");
tdresser 2017/06/12 14:44:45 const
12 var entries = entryList.getEntries(); 14 ctx.beginPath();
13 assert_equals(entries.length, 2, 15 ctx.moveTo(0,0);
14 "There should be two paint timing instances."); 16 ctx.lineTo(300,150);
15 assert_equals(entries[0].entryType, "paint", 17 ctx.stroke();
16 "Expected entryType to be: paint.");
17 assert_equals(entries[0].duration, 0,
18 "Expected duration to be: 0.");
19 18
20 assert_equals(entries[1].entryType, "paint", 19 testRunner.capturePixelsAsyncThen(t.step_func_done(function() {
21 "Expected entryType to be: paint."); 20 const bufferedEntries = performance.getEntriesByType('paint');
22 assert_equals(entries[1].duration, 0, 21 assert_equals(bufferedEntries.length, 2, "There should be two paint timing instances.");
23 "Expected duration to be: 0."); 22 assert_equals(bufferedEntries[0].entryType, "paint");
24 observer.disconnect(); 23 assert_equals(bufferedEntries[0].name, "first-paint");
25 t.done(); 24 assert_equals(bufferedEntries[1].entryType, "paint");
26 }) 25 assert_equals(bufferedEntries[1].name, "first-contentful-paint");
27 ); 26 }));
28 observer.observe({entryTypes: ["paint"]});
29 27
30 }, "First contentful paint fires due to canvas render."); 28 }, "First contentful paint fires due to canvas render.");
31 </script> 29 </script>
32
33 <script>
34 window.onload = function() {
35 var c=document.getElementById("canvas");
36 var ctx=c.getContext("2d");
37 ctx.beginPath();
38 ctx.moveTo(0,0);
39 ctx.lineTo(300,150);
40 ctx.stroke();
41 }
42 </script>
43
44 <canvas id="canvas" width="200" height="200" ></canvas>
45 </body> 30 </body>
46 </html> 31 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698