OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
5 <title>Navigation Timing 2 WPT</title> | 5 <title>Navigation Timing 2 WPT</title> |
6 <link rel="author" title="Google" href="http://www.google.com/" /> | 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"/> | 7 <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-Per
formanceNavigationTiming"/> |
8 <script src="/resources/testharness.js"></script> | 8 <script src="/resources/testharness.js"></script> |
9 <script src="/resources/testharnessreport.js"></script> | 9 <script src="/resources/testharnessreport.js"></script> |
10 </head> | 10 </head> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 "Expected " + eventOrder[i] + " to be no greater than " + ev
entOrder[i + 1] + "."); | 56 "Expected " + eventOrder[i] + " to be no greater than " + ev
entOrder[i + 1] + "."); |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 async_test(function (t) { | 60 async_test(function (t) { |
61 var observer = new PerformanceObserver( | 61 var observer = new PerformanceObserver( |
62 t.step_func(function (entryList) { | 62 t.step_func(function (entryList) { |
63 var entries = entryList.getEntries(); | 63 var entries = entryList.getEntries(); |
64 assert_equals(entries[0].entryType, "navigation", | 64 assert_equals(entries[0].entryType, "navigation", |
65 "Expected entryType to be: navigation."); | 65 "Expected entryType to be: navigation."); |
66 assert_equals(entries[0].name, "document", | 66 assert_equals(entries[0].name, "http://127.0.0.1:8000/w3c/we
bperf/approved/navigation-timing/html/nav2_test_attributes_values.html"); |
67 "Expected name to be: document."); | |
68 assert_equals(entries[0].startTime, 0, | 67 assert_equals(entries[0].startTime, 0, |
69 "Expected startTime to be: 0."); | 68 "Expected startTime to be: 0."); |
70 assert_equals(entries[0].duration, entries[0].loadEventEnd, | 69 assert_equals(entries[0].duration, entries[0].loadEventEnd, |
71 "Expected duration to be equal to loadEventEnd."); | 70 "Expected duration to be equal to loadEventEnd."); |
72 assert_equals(entries[0].initiatorType, "navigation", | 71 assert_equals(entries[0].initiatorType, "navigation", |
73 "Expected initiatorType to be equal to navigation."); | 72 "Expected initiatorType to be equal to navigation."); |
74 // This test may fail when response is from cach. Disable or
clean cach before | 73 // This test may fail when response is from cach. Disable or
clean cach before |
75 // running this test. | 74 // running this test. |
76 assert_true(entries[0].transferSize > entries[0].encodedBody
Size, | 75 assert_true(entries[0].transferSize > entries[0].encodedBody
Size, |
77 "Expected transferSize to be greater than encodedBodySiz
e in uncached navigation."); | 76 "Expected transferSize to be greater than encodedBodySiz
e in uncached navigation."); |
78 assert_equals(entries[0].encodedBodySize, 4148); | 77 assert_equals(entries[0].encodedBodySize, 4180); |
79 assert_equals(entries[0].decodedBodySize, 4148); | 78 assert_equals(entries[0].decodedBodySize, 4180); |
80 verifyTimingEventOrder(entries[0], navTiming2EventOrder1); | 79 verifyTimingEventOrder(entries[0], navTiming2EventOrder1); |
81 // When unloadEvent happens | 80 // When unloadEvent happens |
82 if (entries[0]["unloadEventStart"] != 0) { | 81 if (entries[0]["unloadEventStart"] != 0) { |
83 verifyTimingEventOrder(entries[0], navTiming2EventOrder2
); | 82 verifyTimingEventOrder(entries[0], navTiming2EventOrder2
); |
84 } | 83 } |
85 // When a secure transport is used | 84 // When a secure transport is used |
86 if (entries[0]["secureConnectionStart"] != 0) { | 85 if (entries[0]["secureConnectionStart"] != 0) { |
87 verifyTimingEventOrder(entries[0], navTiming2EventOrder3
); | 86 verifyTimingEventOrder(entries[0], navTiming2EventOrder3
); |
88 } | 87 } |
89 observer.disconnect(); | 88 observer.disconnect(); |
90 t.done(); | 89 t.done(); |
91 }) | 90 }) |
92 ); | 91 ); |
93 observer.observe({entryTypes: ["navigation"]}); | 92 observer.observe({entryTypes: ["navigation"]}); |
94 | 93 |
95 }, "Performance navigation timing instance's value is reasonable."); | 94 }, "Performance navigation timing instance's value is reasonable."); |
96 </script> | 95 </script> |
97 </body> | 96 </body> |
98 </html> | 97 </html> |
OLD | NEW |