OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8" > |
| 5 <title>window.performance.timing in document navigation</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 src="resources/webperftestharness.js"></script> |
| 11 </head> |
| 12 <body> |
| 13 <h1>Description</h1> |
| 14 <p>This test validates that all of the window.performance.timing attribu
tes remain unchanged after an in document navigation (URL fragment change).</p> |
| 15 |
| 16 <div id="log"></div> |
| 17 <script> |
| 18 setup({explicit_done: true}); |
| 19 |
| 20 // explicitly test the namespace before we start testing |
| 21 test_namespace('timing'); |
| 22 |
| 23 var timing; |
| 24 |
| 25 function check_timing_not_changed() |
| 26 { |
| 27 for (var i = 0; i < timingAttributes.length; ++i) |
| 28 { |
| 29 var property = timingAttributes[i]; |
| 30 test_equals(timing[property], initial_timing[property], |
| 31 property + " is the same after in document navig
ation."); |
| 32 } |
| 33 done(); |
| 34 } |
| 35 |
| 36 var initial_timing = {}; |
| 37 function save_timing_after_load() |
| 38 { |
| 39 for (var i = 0; i < timingAttributes.length; ++i) |
| 40 { |
| 41 var property = timingAttributes[i]; |
| 42 initial_timing[property] = timing[property]; |
| 43 } |
| 44 window.location.href = "#1"; |
| 45 setTimeout("check_timing_not_changed()", 0); |
| 46 } |
| 47 |
| 48 function load_handler() |
| 49 { |
| 50 if (performanceNamespace === undefined) |
| 51 { |
| 52 // avoid script errors |
| 53 done(); |
| 54 return; |
| 55 } |
| 56 |
| 57 timing = performanceNamespace.timing; |
| 58 |
| 59 window.removeEventListener("load", load_handler); |
| 60 setTimeout("save_timing_after_load()", 0); |
| 61 } |
| 62 |
| 63 window.addEventListener("load", load_handler, false); |
| 64 </script> |
| 65 </body> |
| 66 </html> |
OLD | NEW |