| 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>window.performance User Timing mark() method is working properly<
/title> | 5 <title>window.performance User Timing mark() method is working properly<
/title> |
| 6 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> | 6 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> |
| 7 <link rel="help" href="http://127.0.0.1:8000/webperf/specs/UserTiming/#d
om-performance-mark"/> | 7 <link rel="help" href="http://www.w3.org/TR/user-timing/#dom-performance
-mark"/> |
| 8 <script src="/w3c/resources/testharness.js"></script> | 8 <script src="../../../resources/testharness.js"></script> |
| 9 <script src="/w3c/resources/testharnessreport.js"></script> | 9 <script src="../../../resources/testharnessreport.js"></script> |
| 10 <script src="/w3c/webperf/resources/webperftestharness.js"></script> | 10 <script src="resources/webperftestharness.js"></script> |
| 11 | 11 |
| 12 <script type="text/javascript"> | 12 <script type="text/javascript"> |
| 13 // test data | 13 // test data |
| 14 var markTestDelay = 200; | 14 var markTestDelay = 200; |
| 15 var testThreshold = 20; | 15 var testThreshold = 20; |
| 16 var marks; | 16 var marks; |
| 17 | 17 |
| 18 var TEST_MARKS = | 18 var TEST_MARKS = |
| 19 [ | 19 [ |
| 20 { | 20 { |
| 21 name: "mark1", | 21 name: "mark1", |
| 22 expectedStartTime: undefined, | 22 expectedStartTime: undefined, |
| 23 entryMatch: undefined | 23 entryMatch: undefined |
| 24 }, | 24 }, |
| 25 { | 25 { |
| 26 name: "mark1", | 26 name: "mark1", |
| 27 expectedStartTime: undefined, | 27 expectedStartTime: undefined, |
| 28 entryMatch: undefined | 28 entryMatch: undefined |
| 29 } | 29 } |
| 30 ]; | 30 ]; |
| 31 | 31 |
| 32 setup({timeout:1000, explicit_done: true}); | 32 setup({explicit_done: true}); |
| 33 | 33 |
| 34 test_namespace(); | 34 test_namespace(); |
| 35 | 35 |
| 36 function onload_test() | 36 function onload_test() |
| 37 { | 37 { |
| 38 // test for existance of User Timing and Performance Timeline interf
ace | 38 // test for existance of User Timing and Performance Timeline interf
ace |
| 39 if (window.performance.mark == undefined || | 39 if (window.performance.mark == undefined || |
| 40 window.performance.clearMarks == undefined || | 40 window.performance.clearMarks == undefined || |
| 41 window.performance.measure == undefined || | 41 window.performance.measure == undefined || |
| 42 window.performance.clearMeasures == undefined || | 42 window.performance.clearMeasures == undefined || |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 176 } |
| 177 | 177 |
| 178 function test_mark(markEntry, markEntryCommand, expectedName, expectedSt
artTime) | 178 function test_mark(markEntry, markEntryCommand, expectedName, expectedSt
artTime) |
| 179 { | 179 { |
| 180 // test name | 180 // test name |
| 181 test_equals(markEntry.name, expectedName, markEntryCommand + ".name
== \"" + expectedName + "\""); | 181 test_equals(markEntry.name, expectedName, markEntryCommand + ".name
== \"" + expectedName + "\""); |
| 182 | 182 |
| 183 // test startTime, allow for an acceptable threshold in the differen
ce between the startTime and the | 183 // test startTime, allow for an acceptable threshold in the differen
ce between the startTime and the |
| 184 // expected value for the startTime (loadEventStart + markTestDelay) | 184 // expected value for the startTime (loadEventStart + markTestDelay) |
| 185 test_true(Math.abs(markEntry.startTime - expectedStartTime) <= testT
hreshold, | 185 test_true(Math.abs(markEntry.startTime - expectedStartTime) <= testT
hreshold, |
| 186 markEntryCommand + ".startTime ~== " + " (up to " + testT
hreshold + | 186 markEntryCommand + ".startTime ~== " + expectedStartTime +
" (up to " + testThreshold + |
| 187 "ms difference allowed)"); | 187 "ms difference allowed)"); |
| 188 | 188 |
| 189 // verify entryType | 189 // verify entryType |
| 190 test_equals(markEntry.entryType, "mark", markEntryCommand + ".entryT
ype == \"mark\""); | 190 test_equals(markEntry.entryType, "mark", markEntryCommand + ".entryT
ype == \"mark\""); |
| 191 | 191 |
| 192 // verify duration | 192 // verify duration |
| 193 test_equals(markEntry.duration, 0, markEntryCommand + ".duration ==
0"); | 193 test_equals(markEntry.duration, 0, markEntryCommand + ".duration ==
0"); |
| 194 } | 194 } |
| 195 | 195 |
| 196 function get_test_entries(entryList, entryType) | 196 function get_test_entries(entryList, entryType) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 219 <li>"mark1": duplicate of the first mark, used to confirm names
can be re-used</li> | 219 <li>"mark1": duplicate of the first mark, used to confirm names
can be re-used</li> |
| 220 </ul> | 220 </ul> |
| 221 After creating each mark, the existence of these marks is validated b
y calling | 221 After creating each mark, the existence of these marks is validated b
y calling |
| 222 performance.getEntriesByName() (both with and without the entryType p
arameter provided), | 222 performance.getEntriesByName() (both with and without the entryType p
arameter provided), |
| 223 performance.getEntriesByType(), and performance.getEntries() | 223 performance.getEntriesByType(), and performance.getEntries() |
| 224 </p> | 224 </p> |
| 225 | 225 |
| 226 <div id="log"></div> | 226 <div id="log"></div> |
| 227 </body> | 227 </body> |
| 228 </html> | 228 </html> |
| OLD | NEW |