test-timing-client-redirect.html (2545B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title>window.performance.timing.redirect attributes on a client redirect navigation</title> 6 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> 7 <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/> 8 <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"/> 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 <script src="/common/performance-timeline-utils.js"></script> 12 <script src="resources/webperftestharness.js"></script> 13 <script> 14 setup({explicit_done: true}); 15 16 test_namespace('navigation'); 17 test_namespace('timing', true); 18 19 var redirect_frame; 20 function onload_test() 21 { 22 if (performanceNamespace === undefined) 23 { 24 // avoid script errors 25 done(); 26 return; 27 } 28 29 redirect_frame = document.getElementById("frameContext"); 30 redirect_frame.onload = do_test; 31 } 32 33 function do_test() 34 { 35 redirect_frame.onload = ""; 36 test_true(redirect_frame.contentWindow.performance.navigation.type == performanceNamespace.navigation.TYPE_NAVIGATE, 37 'timing.navigation.type is TYPE_NAVIGATE'); 38 39 test_equals(redirect_frame.contentWindow.performance.navigation.redirectCount, 0, 'navigation.redirectCount == 0 on an client redirected navigation'); 40 test_equals(redirect_frame.contentWindow.performance.timing.redirectStart, 0, 'timing.redirectStart == 0 on an client redirected navigation'); 41 test_equals(redirect_frame.contentWindow.performance.timing.redirectEnd, 0, 'timing.redirectEnd == 0 on an client redirected navigation'); 42 43 done(); 44 } 45 </script> 46 47 </head> 48 <body onload="onload_test();"> 49 <h1>Description</h1> 50 <p>This test validates the values of the window.navigation.redirectCount and the 51 window.performance.timing.redirectStart/End times on a client side redirect.</p> 52 53 <div id="log"></div><br /> 54 <iframe id="frameContext" src="resources/blank-page-meta-redirect.html" style="width: 250px; height: 250px;"></iframe> 55 </body> 56 </html>