Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/common/performance-timeline-utils.js

Issue 2839683003: Server-Timing (Closed)
Patch Set: make those robots happy, attempt #4 Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 var performanceNamespace = window.performance;
2 var namespace_check = false;
3 function wp_test(func, msg, properties)
4 {
5 // only run the namespace check once
6 if (!namespace_check)
7 {
8 namespace_check = true;
9
10 if (performanceNamespace === undefined || performanceNamespace == null)
11 {
12 // show a single error that window.performance is undefined
13 test(function() { assert_true(performanceNamespace !== undefined && perfor manceNamespace != null, "window.performance is defined and not null"); }, "windo w.performance is defined and not null.", {author:"W3C http://www.w3.org/",help:" http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",assert :"The window.performance attribute provides a hosting area for performance relat ed attributes. "});
14 }
15 }
16
17 test(func, msg, properties);
18 }
19
20 function test_true(value, msg, properties)
21 {
22 wp_test(function () { assert_true(value, msg); }, msg, properties);
23 }
24
25 function test_equals(value, equals, msg, properties)
26 {
27 wp_test(function () { assert_equals(value, equals, msg); }, msg, properties);
28 }
29
30 // assert for every entry in `expectedEntries`, there is a matching entry _somew here_ in `actualEntries`
31 function test_entries(actualEntries, expectedEntries) {
32 test_equals(actualEntries.length, expectedEntries.length)
33 expectedEntries.forEach(function (expectedEntry) {
34 test_true(!!actualEntries.find(function (actualEntry) {
35 return typeof Object.keys(expectedEntry).find(function (key) {
36 return actualEntry[key] !== expectedEntry[key]
37 }) === 'undefined'
38 }))
39 })
40 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698