| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <meta charset="utf-8" /> | 4 <meta charset="utf-8" /> |
| 5 <title>redirectStart and redirectEnd information in same-origin redirect
resource timing</title> | 5 <title>This test validates the values of the redirectStart/End in resour
ce timing for a same-origin resource redirect.</title> |
| 6 <link rel="author" title="Intel" href="http://www.intel.com/" /> | 6 <link rel="author" title="Intel" href="http://www.intel.com/" /> |
| 7 <link rel="help" href="http://www.w3.org/TR/resource-timing/#performance
resourcetiming"/> | 7 <link rel="help" href="http://www.w3.org/TR/resource-timing/#performance
resourcetiming"/> |
| 8 <script src="/w3c/resources/testharness.js"></script> | 8 <script src="/w3c/resources/testharness.js"></script> |
| 9 <script src="/w3c/resources/testharnessreport.js"></script> | 9 <script src="/w3c/resources/testharnessreport.js"></script> |
| 10 <script src="/w3c/webperf/resources/webperftestharness.js"></script> | 10 <script src="/w3c/webperf/resources/webperftestharness.js"></script> |
| 11 <script src="/w3c/webperf/resources/webperftestharnessextension.js"></sc
ript> | 11 <script src="/w3c/webperf/resources/webperftestharnessextension.js"></sc
ript> |
| 12 | 12 |
| 13 <script> | 13 <script> |
| 14 | 14 |
| 15 setup({explicit_done: true}); | 15 setup({explicit_done: true}); |
| 16 var pageOrigin = "127.0.0.1:8000"; | 16 var pageOrigin = "127.0.0.1:8000"; |
| 17 | 17 |
| 18 function onload_test() | 18 function onload_test() |
| 19 { | 19 { |
| 20 var context = new PerformanceContext(performance); | 20 var context = new PerformanceContext(performance); |
| 21 var entry = context.getEntriesByName(document.getElementById("fr
ameContext").src, "resource")[0]; | 21 var entry = context.getEntriesByName(document.getElementById("fr
ameContext").src, "resource")[0]; |
| 22 | 22 |
| 23 test_greater_than(entry.redirectStart, 0, "redirectStart should
be greater than 0 in same-origin redirect!"); | 23 test_greater_than(entry.redirectStart, 0, "redirectStart should
be greater than 0 in same-origin redirect!"); |
| 24 test_equals(entry.redirectStart, entry.startTime, "redirectStart
should be equal to startTime in same-origin redirect!"); | 24 test_equals(entry.redirectStart, entry.startTime, "redirectStart
should be equal to startTime in same-origin redirect!"); |
| 25 test_noless_than(entry.redirectEnd, entry.redirectStart, "redire
ctEnd should be no less than redirectStart in same-origin redirect!"); | 25 test_noless_than(entry.redirectEnd, entry.redirectStart, "redire
ctEnd should be no less than redirectStart in same-origin redirect!"); |
| 26 test_noless_than(entry.fetchStart, entry.redirectEnd, "fetchStar
t should be no less than redirectEnd in same-origin redirect!"); | 26 test_noless_than(entry.fetchStart, entry.redirectEnd, "fetchStar
t should be no less than redirectEnd in same-origin redirect!"); |
| 27 done(); | 27 done(); |
| 28 } | 28 } |
| 29 </script> | 29 </script> |
| 30 | 30 |
| 31 </head> | 31 </head> |
| 32 <body> | 32 <body> |
| 33 <h1>Description</h1> | |
| 34 <p>This test validates the values of the redirectStart/End in resource t
iming for a same-origin resource redirect.</p> | |
| 35 <iframe id="frameContext" src="" style="width: 250px; height: 250px;"></
iframe> | 33 <iframe id="frameContext" src="" style="width: 250px; height: 250px;"></
iframe> |
| 36 <script> | 34 <script> |
| 37 test_equals(document.location.host, pageOrigin, 'Starting document.l
ocation.hostname is correct (' + pageOrigin + ')'); | 35 test_equals(document.location.host, pageOrigin, 'Starting document.l
ocation.hostname is correct (' + pageOrigin + ')'); |
| 38 | 36 |
| 39 var destUrl = 'http://' + pageOrigin + '/w3c/webperf/resources/redir
ect.php'; | 37 var destUrl = 'http://' + pageOrigin + '/w3c/webperf/resources/redir
ect.php'; |
| 40 destUrl += '?location=http://' + pageOrigin + "/w3c/webperf/resource
s/blank_page_green.htm"; | 38 destUrl += '?location=http://' + pageOrigin + "/w3c/webperf/resource
s/blank_page_green.htm"; |
| 41 | 39 |
| 42 var frameContext = document.getElementById("frameContext"); | 40 var frameContext = document.getElementById("frameContext"); |
| 43 frameContext.onload = onload_test; | 41 frameContext.onload = onload_test; |
| 44 frameContext.src = destUrl; | 42 frameContext.src = destUrl; |
| 45 </script> | 43 </script> |
| 46 </body> | 44 </body> |
| 47 </html> | 45 </html> |
| OLD | NEW |