OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8" /> |
| 5 <title>Navigation Timing 2 WPT</title> |
| 6 <link rel="author" title="Google" href="http://www.google.com/" /> |
| 7 <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-Per
formanceNavigationTiming"/> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 <script> |
| 11 |
| 12 var reload_frame; |
| 13 |
| 14 function onload_test() |
| 15 { |
| 16 reload_frame = document.getElementById("frameContext"); |
| 17 reload_frame.onload = function() { |
| 18 setTimeout(do_test, 0); |
| 19 } |
| 20 setTimeout("reload_the_frame();", 100); |
| 21 } |
| 22 |
| 23 function reload_the_frame() |
| 24 { |
| 25 reload_frame.contentWindow.location.reload(true); |
| 26 } |
| 27 |
| 28 function do_test() |
| 29 { |
| 30 var newNavTiming = document.getElementById("frameContext").conte
ntWindow.performance.getEntriesByType("navigation")[0]; |
| 31 assert_equals(newNavTiming.type, "reload", "Expected navigation
type to be reload."); |
| 32 assert_true(newNavTiming.unloadEventStart > 0, "Expected unloadE
ventStart to be greater than 0."); |
| 33 assert_true(newNavTiming.unloadEventEnd > 0, "Expected unloadEve
ntEnd to be greater than 0."); |
| 34 done(); |
| 35 } |
| 36 </script> |
| 37 </head> |
| 38 <body onload="onload_test();"> |
| 39 <h1>Description</h1> |
| 40 <p>This test validates the value of window.performance.getEntriesByType(
"navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigati
on.</p> |
| 41 |
| 42 <p>This page should be loaded with a green background frame below. The f
rame will be automatically reloaded |
| 43 and then verified that |
| 44 <ul> |
| 45 <li>The window.performance.getEntriesByType("navigation").type = "re
load" after reload</li> |
| 46 <li>The window.performance.getEntriesByType("navigation").unloadEven
tStart > 0 after reload</li> |
| 47 <li>The window.performance.getEntriesByType("navigation").unloadEven
tEnd > 0 after reload</li> |
| 48 </ul> |
| 49 </p> |
| 50 |
| 51 <iframe id="frameContext" src="resources/blank_page_green.html" style="w
idth: 250px; height: 250px;"></iframe> |
| 52 </body> |
| 53 </html> |
OLD | NEW |