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/#sec-navig
ation-timing-interface"/> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 <script> |
| 11 |
| 12 function onload_test() |
| 13 { |
| 14 // do this with a timeout to see the visuals of the navigations. |
| 15 setTimeout("nav_frame();", 100); |
| 16 } |
| 17 |
| 18 var step = 1; |
| 19 function nav_frame() |
| 20 { |
| 21 var navigation_frame = document.getElementById("frameContext").c
ontentWindow; |
| 22 switch (step) |
| 23 { |
| 24 case 1: |
| 25 { |
| 26 navigation_frame.location.href = '/navigation-timing/res
ources/blank_page_green_with_onunload.html'; |
| 27 step++; |
| 28 break; |
| 29 } |
| 30 case 2: |
| 31 { |
| 32 assert_equals(navigation_frame.performance.getEntriesByT
ype("navigation")[0].type, |
| 33 "navigate", |
| 34 'Expected navigation type to be navigate.'); |
| 35 navigation_frame.history.back(); |
| 36 step++; |
| 37 break; |
| 38 } |
| 39 case 3: |
| 40 { |
| 41 assert_equals(navigation_frame.performance.getEntriesByT
ype("navigation")[0].type, |
| 42 "back_forward", |
| 43 'Expected navigation type to be back_forward.'); |
| 44 step++; |
| 45 navigation_frame.history.forward(); |
| 46 break; |
| 47 } |
| 48 case 4: |
| 49 { |
| 50 assert_equals(navigation_frame.performance.getEntriesByT
ype("navigation")[0].type, |
| 51 "back_forward", |
| 52 'Expected navigation type to be back_forward.'); |
| 53 done(); |
| 54 step++; |
| 55 break; |
| 56 } |
| 57 default: |
| 58 break; |
| 59 } |
| 60 } |
| 61 </script> |
| 62 |
| 63 </head> |
| 64 <body> |
| 65 <h1> |
| 66 Description</h1> |
| 67 <p> |
| 68 This test validates the value of window.performance.getEntriesByType
("navigation")[0].type with a forward |
| 69 and back navigation.</p> |
| 70 |
| 71 <p>This page should be loaded with a yellow background frame below. It
should turn green for a starting |
| 72 navigation, back to yellow for a back navigation and then back to gr
een again for a forward navigation.</p> |
| 73 |
| 74 <p>Along the navigation timeline the window.performance.getEntriesByType
("navigation")[0].type is checked for back_forward.</p> |
| 75 |
| 76 <p>This test passes if all of the checks to the window.performance.getEn
triesByType("navigation")[0].type are correct throughout the navigation |
| 77 scenario and the frame below ends with a green background. Otherwis
e, this test fails.</p> |
| 78 |
| 79 <iframe id="frameContext" onload="onload_test();" src="resources/blank_p
age_yellow_with_onunload.html" style="width: 250px; height: 250px;"></iframe> |
| 80 </body> |
| 81 </html> |
OLD | NEW |