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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/server-timing/test_server_timing.html

Issue 2839683003: Server-Timing (Closed)
Patch Set: make those robots happy, attempt #4 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 <meta charset='utf-8' />
4 <script src="/resources/testharness.js"></script>
5 <script src='/resources/testharnessreport.js'></script>
6 <script src='resources/webperftestharness.js'></script>
7 <script src="/common/performance-timeline-utils.js"></script>
8 <script>
9 setup({explicit_done: true})
10
11 window.addEventListener('load', function() {
12 // there should be exactly two server-timing entries, 1 for document, 1 for img#one
13 test_entries(performance.getEntriesByType('server'), [{
14 name: document.location.href,
15 entryType: 'server',
16 startTime: 0,
17 duration: 1.2,
18 metric: 'metric1',
19 description: 'document',
20 }, {
21 name: document.querySelector('img#one').src,
22 entryType: 'server',
23 startTime: 0,
24 duration: 3.4,
25 metric: 'metric2',
26 description: 'blue.png',
27 }])
28
29 new PerformanceObserver(function(entryList, observer) {
30 // there should be exactly one server-timing entry, 1 for img#two
31 test_entries(entryList.getEntriesByType('server'), [{
32 name: document.querySelector('img#two').src,
33 entryType: 'server',
34 startTime: 0,
35 duration: 5.6,
36 metric: 'metric3',
37 description: 'green.png',
38 }])
39 observer.disconnect()
40 done()
41 }).observe({entryTypes: ['server']})
42
43 var img = document.createElement('img')
44 img.id = 'two'
45 img.src = './resources/green.png'
46 document.getElementsByTagName('script')[0].parentNode.appendChild(img)
47 })
48 </script>
49 </head>
50 <img id='one' src='resources/blue.png'>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698