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

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

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

Powered by Google App Engine
This is Rietveld 408576698