OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8" /> |
| 5 <title>window.performance.timing attribute ordering on a simple navigati
on</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-timing-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 test_namespace('timing'); |
| 15 |
| 16 var step = 1; |
| 17 function onload_test() |
| 18 { |
| 19 if (step === 1 && window.performance === undefined) |
| 20 { |
| 21 // avoid script errors |
| 22 done(); |
| 23 return; |
| 24 } |
| 25 |
| 26 var navigation_frame = document.getElementById("frameContext").c
ontentWindow; |
| 27 performanceNamespace = navigation_frame.performance; |
| 28 switch (step) |
| 29 { |
| 30 case 1: |
| 31 { |
| 32 navigation_frame.location.href = '/navigation-timing/res
ources/blank_page_green.html'; |
| 33 step++; |
| 34 break; |
| 35 } |
| 36 case 2: |
| 37 { |
| 38 test_namespace('navigation', true); |
| 39 |
| 40 // |
| 41 // Tests |
| 42 // |
| 43 test_equals(performanceNamespace.navigation.type, |
| 44 performanceNamespace.navigation.TYPE_NAVIGATE, |
| 45 'window.performance.navigation.type == TYPE_NAVI
GATE',{help:"http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interfa
ce"}); |
| 46 |
| 47 // navigiation must be non-0 |
| 48 test_timing_greater_than('navigationStart', 0); |
| 49 |
| 50 // must be no redirection for this test case |
| 51 test_timing_equals('redirectStart', 0); |
| 52 test_timing_equals('redirectEnd', 0); |
| 53 |
| 54 // validate attribute ordering |
| 55 test_timing_order('fetchStart', 'navigationStart'); |
| 56 test_timing_order('domainLookupStart', 'fetchStart'); |
| 57 test_timing_order('domainLookupEnd', 'domainLookupStart'
); |
| 58 test_timing_order('connectStart', 'domainLookupEnd'); |
| 59 test_timing_order('connectEnd', 'connectStart'); |
| 60 test_timing_order('requestStart', 'connectEnd'); |
| 61 test_timing_order('responseStart', 'requestStart'); |
| 62 test_timing_order('responseEnd', 'responseStart'); |
| 63 test_timing_order('domLoading', 'fetchStart'); |
| 64 test_timing_order('domInteractive', 'responseEnd'); |
| 65 test_timing_order('domContentLoadedEventStart', 'domInte
ractive'); |
| 66 test_timing_order('domContentLoadedEventEnd', 'domConten
tLoadedEventStart'); |
| 67 test_timing_order('domComplete', 'domContentLoadedEventE
nd'); |
| 68 test_timing_order('loadEventStart', 'domContentLoadedEve
ntEnd'); |
| 69 test_timing_order('loadEventEnd', 'loadEventStart'); |
| 70 |
| 71 // setup requires the frame to have a previous page with
an onunload event handler. |
| 72 test_timing_order('unloadEventStart', 'navigationStart')
; |
| 73 test_timing_order('unloadEventEnd', 'unloadEventStart'); |
| 74 |
| 75 step++; |
| 76 done(); |
| 77 break; |
| 78 } |
| 79 default: |
| 80 break; |
| 81 } |
| 82 } |
| 83 </script> |
| 84 </head> |
| 85 <body> |
| 86 <h1>Description</h1> |
| 87 <p>This test validates the ordering of the window.performance.timing att
ributes.</p> |
| 88 |
| 89 <p>This page should be loaded with a yellow background frame below which
contains an unload event |
| 90 handler.</p> |
| 91 |
| 92 <p>After the page loads, the frame is navigated to a new blank page with
a green background. At this point, the navigation timeline is verified</p> |
| 93 |
| 94 <p>This test passes if all of the checks to the frame.window.performance
.timing attributes are |
| 95 correct throughout the navigation scenario and the frame below ends w
ith a green background. |
| 96 Otherwise, this test fails.</p> |
| 97 |
| 98 <h1>Setup</h1> |
| 99 |
| 100 <div id="log"></div> |
| 101 <br /> |
| 102 <iframe id="frameContext" |
| 103 onload="/* Need to make sure we don't examine loadEventEnd |
| 104 until after the load event has finished firing */ |
| 105 setTimeout(onload_test, 0);" |
| 106 src="resources/blank_page_unload.html" |
| 107 style="width: 250px; height: 250px;"></iframe> |
| 108 </body> |
| 109 </html> |
OLD | NEW |