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 src="/common/utils.js"></script> |
| 11 <script> |
| 12 |
| 13 var reload_frame; |
| 14 |
| 15 function onload_test() |
| 16 { |
| 17 reload_frame = document.getElementById("frameContext"); |
| 18 reload_frame.onload = do_test; |
| 19 setTimeout("reload_the_frame();", 100); |
| 20 } |
| 21 |
| 22 function reload_the_frame() |
| 23 { |
| 24 var destUrl = make_absolute_url({subdomain: "www", |
| 25 path: "/common/redirect.py", |
| 26 query: "location=" + make_absol
ute_url( |
| 27 {path: "/navigation
-timing/resources/blank_page_yellow.html"}) |
| 28 }); |
| 29 reload_frame.contentWindow.location.href = destUrl; |
| 30 } |
| 31 |
| 32 function do_test() |
| 33 { |
| 34 var newNavTiming = document.getElementById("frameContext").conte
ntWindow.performance.getEntriesByType("navigation")[0]; |
| 35 assert_equals(newNavTiming.type, "navigate", "Expected navigatio
n type to be navigate."); |
| 36 assert_equals(newNavTiming.unloadEventStart, 0, "Expected unload
EventStart to be 0."); |
| 37 assert_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEv
entEnd to be 0."); |
| 38 done(); |
| 39 } |
| 40 </script> |
| 41 </head> |
| 42 <body> |
| 43 <h1>Description</h1> |
| 44 <p>This test validates the value of window.performance.getEntriesByType(
"navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigati
on.</p> |
| 45 |
| 46 <p>This page should be loaded with a green background frame below. The
frame will be automatically reloaded |
| 47 and then verified that |
| 48 <ul> |
| 49 <li>The window.performance.getEntriesByType("navigation").type = "na
vigate"</li> |
| 50 <li>The window.performance.getEntriesByType("navigation").unloadEven
tStart == 0</li> |
| 51 <li>The window.performance.getEntriesByType("navigation").unloadEven
tEnd == 0</li> |
| 52 </ul> |
| 53 </p> |
| 54 |
| 55 <iframe id="frameContext" onload="onload_test();" src="resources/blank_p
age_green.html" style="width: 250px; height: 250px;"></iframe> |
| 56 </body> |
| 57 </html> |
OLD | NEW |