resource_connection_reuse_mixed_content.html (2318B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title>Resource Timing connection reuse</title> 6 <link rel="author" title="Google" href="http://www.google.com/" /> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="resources/webperftestharness.js"></script> 10 <script src="resources/webperftestharnessextension.js"></script> 11 <script> 12 setup({explicit_done: true}); 13 let iframe; 14 let d; 15 let body; 16 17 // Explicitly test the namespace before we start testing. 18 test_namespace('getEntriesByType'); 19 20 function setup_iframe() { 21 iframe = document.getElementById('frameContext'); 22 d = iframe.contentWindow.document; 23 iframe.addEventListener('load', onload_test, false); 24 } 25 26 function onload_test() { 27 const entries = iframe.contentWindow.performance.getEntriesByType('resource'); 28 29 // When a persistent connection is used, follow-on resources should be included as PerformanceResourceTiming objects. 30 test_equals(entries.length, 2, 'There should be 2 PerformanceEntries'); 31 32 if (entries.length >= 2) { 33 // When a persistent connection is used, for the resource that reuses the socket, connectStart and connectEnd should have the same value as fetchStart. 34 const entry = entries[1]; 35 test_equals(entry.fetchStart, entry.connectStart, 'connectStart and fetchStart should be the same'); 36 test_equals(entry.fetchStart, entry.connectEnd, 'connectEnd and fetchStart should be the same'); 37 // secureConnectionStart is the same as fetchStart since the subresource is fetched over https 38 test_equals(entry.fetchStart, entry.secureConnectionStart, 'secureConnectionStart and fetchStart should be the same'); 39 test_equals(entry.fetchStart, entry.domainLookupStart, 'domainLookupStart and fetchStart should be the same') 40 test_equals(entry.fetchStart, entry.domainLookupEnd, 'domainLookupEnd and fetchStart should be the same') 41 } 42 43 done(); 44 } 45 46 window.setup_iframe = setup_iframe; 47 </script> 48 </head> 49 <body> 50 <h1>Description</h1> 51 <p>This test validates that connectStart and connectEnd are the same when a connection is reused (e.g. when a persistent connection is used).</p> 52 <div id="log"></div> 53 <iframe id="frameContext" src="resources/fake_responses_https.sub.html"></iframe> 54 </body> 55 </html>