Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/external/wpt/server-timing/resources/webperftestharness.js |
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/server-timing/resources/webperftestharness.js b/third_party/WebKit/LayoutTests/external/wpt/server-timing/resources/webperftestharness.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..055fb326bf02324010a69a8a1099c58961a5899f |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/external/wpt/server-timing/resources/webperftestharness.js |
| @@ -0,0 +1,21 @@ |
| +/* |
| +Distributed under both the W3C Test Suite License [1] and the W3C |
| +3-clause BSD License [2]. To contribute to a W3C Test Suite, see the |
| +policies and contribution forms [3]. |
| + |
| +[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license |
| +[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license |
| +[3] http://www.w3.org/2004/10/27-testcases |
| + */ |
| + |
| +// assert for every entry in `expectedEntries`, there is a matching entry _somewhere_ in `actualEntries` |
| +function test_entries(actualEntries, expectedEntries) { |
|
panicker
2017/04/14 19:31:04
why not move this to the common util?
(There is no
|
| + test_equals(actualEntries.length, expectedEntries.length) |
| + expectedEntries.forEach(function (expectedEntry) { |
| + test_true(!!actualEntries.find(function (actualEntry) { |
| + return typeof Object.keys(expectedEntry).find(function (key) { |
| + return actualEntry[key] !== expectedEntry[key] |
| + }) === 'undefined' |
| + })) |
| + }) |
| +} |