| OLD | NEW |
| 1 /* | 1 /* |
| 2 Distributed under both the W3C Test Suite License [1] and the W3C | 2 Distributed under both the W3C Test Suite License [1] and the W3C |
| 3 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the | 3 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the |
| 4 policies and contribution forms [3]. | 4 policies and contribution forms [3]. |
| 5 | 5 |
| 6 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license | 6 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license |
| 7 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license | 7 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license |
| 8 [3] http://www.w3.org/2004/10/27-testcases | 8 [3] http://www.w3.org/2004/10/27-testcases |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 'redirectStart', | 31 'redirectStart', |
| 32 'requestStart', | 32 'requestStart', |
| 33 'responseEnd', | 33 'responseEnd', |
| 34 'responseStart', | 34 'responseStart', |
| 35 'unloadEventEnd', | 35 'unloadEventEnd', |
| 36 'unloadEventStart' | 36 'unloadEventStart' |
| 37 ]; | 37 ]; |
| 38 | 38 |
| 39 var namespace_check = false; | 39 var namespace_check = false; |
| 40 | 40 |
| 41 function has_required_interfaces() |
| 42 { |
| 43 if (window.performance.mark == undefined || |
| 44 window.performance.clearMarks == undefined || |
| 45 window.performance.measure == undefined || |
| 46 window.performance.clearMeasures == undefined || |
| 47 window.performance.getEntriesByName == undefined || |
| 48 window.performance.getEntriesByType == undefined || |
| 49 window.performance.getEntries == undefined) { |
| 50 return false; |
| 51 } |
| 52 |
| 53 return true; |
| 54 } |
| 55 |
| 41 // | 56 // |
| 42 // All test() functions in the WebPerf test suite should use wp_test() instead. | 57 // All test() functions in the WebPerf test suite should use wp_test() instead. |
| 43 // | 58 // |
| 44 // wp_test() validates the window.performance namespace exists prior to running
tests and | 59 // wp_test() validates the window.performance namespace exists prior to running
tests and |
| 45 // immediately shows a single failure if it does not. | 60 // immediately shows a single failure if it does not. |
| 46 // | 61 // |
| 47 | 62 |
| 48 function wp_test(func, msg, properties) | 63 function wp_test(func, msg, properties) |
| 49 { | 64 { |
| 50 // only run the namespace check once | 65 // only run the namespace check once |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 161 |
| 147 function test_greater_or_equals(value, greater_than, msg, properties) | 162 function test_greater_or_equals(value, greater_than, msg, properties) |
| 148 { | 163 { |
| 149 wp_test(function () { assert_true(value >= greater_than, msg); }, msg, prope
rties); | 164 wp_test(function () { assert_true(value >= greater_than, msg); }, msg, prope
rties); |
| 150 } | 165 } |
| 151 | 166 |
| 152 function test_not_equals(value, notequals, msg, properties) | 167 function test_not_equals(value, notequals, msg, properties) |
| 153 { | 168 { |
| 154 wp_test(function() { assert_true(value !== notequals, msg); }, msg, properti
es); | 169 wp_test(function() { assert_true(value !== notequals, msg); }, msg, properti
es); |
| 155 } | 170 } |
| OLD | NEW |