OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8" /> |
| 5 <title>window.navigation.type for back and forward navigations</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-navig
ation-info-interface"/> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 <script src="resources/webperftestharness.js"></script> |
| 11 <script> |
| 12 setup({explicit_done: true}); |
| 13 |
| 14 // explicitly test the namespace before we start testing |
| 15 test_namespace('navigation'); |
| 16 |
| 17 function onload_test() |
| 18 { |
| 19 if (performanceNamespace === undefined) |
| 20 { |
| 21 // avoid script errors |
| 22 done(); |
| 23 return; |
| 24 } |
| 25 |
| 26 // do this with a timeout to see the visuals of the navigations. |
| 27 setTimeout("nav_frame();", 100); |
| 28 } |
| 29 |
| 30 var step = 1; |
| 31 function nav_frame() |
| 32 { |
| 33 var navigation_frame = document.getElementById("frameContext").c
ontentWindow; |
| 34 switch (step) |
| 35 { |
| 36 case 1: |
| 37 { |
| 38 navigation_frame.location.href = '/navigation-timing/res
ources/blank_page_green_with_onunload.html'; |
| 39 step++; |
| 40 break; |
| 41 } |
| 42 case 2: |
| 43 { |
| 44 test_equals(navigation_frame.performance.navigation.type
, |
| 45 performanceNamespace.navigation.TYPE_NAVIGATE, |
| 46 'window.performance.navigation.type == TYPE_NAVI
GATE'); |
| 47 navigation_frame.history.back(); |
| 48 step++; |
| 49 break; |
| 50 } |
| 51 case 3: |
| 52 { |
| 53 test_equals(navigation_frame.performance.navigation.type
, |
| 54 performanceNamespace.navigation.TYPE_BACK_FORWAR
D, |
| 55 'window.performance.navigation.type == TYPE_BACK
_FORWARD after history.back()'); |
| 56 step++; |
| 57 navigation_frame.history.forward(); |
| 58 break; |
| 59 } |
| 60 case 4: |
| 61 { |
| 62 test_equals(navigation_frame.performance.navigation.type
, |
| 63 performanceNamespace.navigation.TYPE_BACK_FORWAR
D, |
| 64 'window.performance.navigation.type == TYPE_BACK
_FORWARD after history.forward()'); |
| 65 done(); |
| 66 step++; |
| 67 break; |
| 68 } |
| 69 default: |
| 70 break; |
| 71 } |
| 72 } |
| 73 </script> |
| 74 |
| 75 </head> |
| 76 <body> |
| 77 <h1> |
| 78 Description</h1> |
| 79 <p> |
| 80 This test validates the value of window.performance.navigation.type
with a forward |
| 81 and back navigation.</p> |
| 82 |
| 83 <p>This page should be loaded with a yellow background frame below. It
should turn green for a starting |
| 84 navigation, back to yellow for a back navigation and then back to gr
een again for a forward navigation.</p> |
| 85 |
| 86 <p>Along the navigation timeline the frame.window.performance.type is ch
ecked for TYPE_BACK_FORWARD.</p> |
| 87 |
| 88 <p>This test passes if all of the checks to the navigation.type are corr
ect throughout the navigation |
| 89 scenario and the frame below ends with a green background. Otherwis
e, this test fails.</p> |
| 90 |
| 91 <div id="log"></div> |
| 92 <br /> |
| 93 <iframe id="frameContext" onload="onload_test();" src="resources/blank_p
age_yellow_with_onunload.html" style="width: 250px; height: 250px;"></iframe> |
| 94 </body> |
| 95 </html> |
OLD | NEW |