Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326

This commit is contained in:
Josh Matthews 2017-10-12 09:25:50 -04:00
parent 462c272380
commit 1f531f66ea
5377 changed files with 174916 additions and 84369 deletions

View file

@ -17,47 +17,75 @@
<div id="log"></div>
<pre id='untested_idl' style='display:none'>
typedef double DOMHighResTimeStamp;
[PrimaryGlobal]
interface Window {
[Replaceable]
readonly attribute Performance performance;
};
callback interface EventListener {
void handleEvent(Event event);
[Exposed=(Window,Worker)]
interface Performance {
};
interface Event {
// PhaseType
const unsigned short NONE = 0;
const unsigned short CAPTURING_PHASE = 1;
const unsigned short AT_TARGET = 2;
const unsigned short BUBBLING_PHASE = 3;
readonly attribute DOMString type;
readonly attribute EventTarget? target;
readonly attribute EventTarget? currentTarget;
readonly attribute unsigned short eventPhase;
readonly attribute boolean bubbles;
readonly attribute boolean cancelable;
readonly attribute DOMTimeStamp timeStamp;
void stopPropagation ();
void preventDefault ();
void initEvent (DOMString eventTypeArg, boolean bubblesArg, boolean cancelableArg);
// Introduced in DOM Level 3
void stopImmediatePropagation ();
readonly attribute boolean defaultPrevented;
readonly attribute boolean isTrusted;
};
interface EventTarget {
// Modified in DOM Level 3
void addEventListener (DOMString type, EventListener? listener, optional boolean useCapture = false);
void removeEventListener (DOMString type, EventListener? listener, optional boolean useCapture = false);
boolean dispatchEvent (Event event);
};
[Exposed=(Window,Worker)]
interface PerformanceEntry {
readonly attribute DOMString name;
readonly attribute DOMString entryType;
readonly attribute DOMHighResTimeStamp startTime;
readonly attribute DOMHighResTimeStamp duration;
[Default] object toJSON();
};
[Exposed=(Window,Worker)]
interface PerformanceResourceTiming : PerformanceEntry {
readonly attribute DOMString initiatorType;
readonly attribute DOMString nextHopProtocol;
readonly attribute DOMHighResTimeStamp workerStart;
readonly attribute DOMHighResTimeStamp redirectStart;
readonly attribute DOMHighResTimeStamp redirectEnd;
readonly attribute DOMHighResTimeStamp fetchStart;
readonly attribute DOMHighResTimeStamp domainLookupStart;
readonly attribute DOMHighResTimeStamp domainLookupEnd;
readonly attribute DOMHighResTimeStamp connectStart;
readonly attribute DOMHighResTimeStamp connectEnd;
readonly attribute DOMHighResTimeStamp secureConnectionStart;
readonly attribute DOMHighResTimeStamp requestStart;
readonly attribute DOMHighResTimeStamp responseStart;
readonly attribute DOMHighResTimeStamp responseEnd;
readonly attribute unsigned long long transferSize;
readonly attribute unsigned long long encodedBodySize;
readonly attribute unsigned long long decodedBodySize;
[Default] object toJSON();
};
</pre>
<pre id='idl'>
[Exposed=Window]
interface PerformanceNavigationTiming : PerformanceResourceTiming {
readonly attribute DOMHighResTimeStamp unloadEventStart;
readonly attribute DOMHighResTimeStamp unloadEventEnd;
readonly attribute DOMHighResTimeStamp domInteractive;
readonly attribute DOMHighResTimeStamp domContentLoadedEventStart;
readonly attribute DOMHighResTimeStamp domContentLoadedEventEnd;
readonly attribute DOMHighResTimeStamp domComplete;
readonly attribute DOMHighResTimeStamp loadEventStart;
readonly attribute DOMHighResTimeStamp loadEventEnd;
readonly attribute NavigationType type;
readonly attribute unsigned short redirectCount;
[Default] object toJSON();
};
enum NavigationType {
"navigate",
"reload",
"back_forward",
"prerender"
};
[Exposed=Window]
interface PerformanceTiming {
readonly attribute unsigned long long navigationStart;
readonly attribute unsigned long long unloadEventStart;
@ -80,8 +108,11 @@ interface PerformanceTiming {
readonly attribute unsigned long long domComplete;
readonly attribute unsigned long long loadEventStart;
readonly attribute unsigned long long loadEventEnd;
[Default] object toJSON();
};
[Exposed=Window]
interface PerformanceNavigation {
const unsigned short TYPE_NAVIGATE = 0;
const unsigned short TYPE_RELOAD = 1;
@ -89,16 +120,17 @@ interface PerformanceNavigation {
const unsigned short TYPE_RESERVED = 255;
readonly attribute unsigned short type;
readonly attribute unsigned short redirectCount;
[Default] object toJSON();
};
interface Performance : EventTarget {
// [Exposed=Window]
partial interface Performance {
[SameObject]
readonly attribute PerformanceTiming timing;
[SameObject]
readonly attribute PerformanceNavigation navigation;
};
partial interface Window {
[Replaceable] readonly attribute Performance performance;
};
</pre>
<script>
@ -108,10 +140,9 @@ partial interface Window {
idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
idl_array.add_idls(document.getElementById("idl").textContent);
idl_array.add_objects({Window: ["window"],
Performance: ["window.performance"],
PerformanceNavigation: ["window.performance.navigation"],
PerformanceTiming: ["window.performance.timing"]});
idl_array.add_objects({PerformanceNavigation: ["window.performance.navigation"],
PerformanceTiming: ["window.performance.timing"],
PerformanceNavigationTiming: ["window.performance.getEntriesByType('navigation')[0]"] });
idl_array.test();
})();

View file

@ -53,6 +53,7 @@ interface PerformanceNavigationTiming : PerformanceResourceTiming {
readonly attribute DOMHighResTimeStamp loadEventEnd;
readonly attribute NavigationType type;
readonly attribute unsigned short redirectCount;
[Default] object toJSON();
};
</pre>

View file

@ -31,6 +31,7 @@
'loadEventEnd',
'loadEventStart',
'name',
'nextHopProtocol',
'redirectCount',
'redirectEnd',
'redirectStart',

View file

@ -50,6 +50,24 @@
'connectEnd'
];
// Navigation Timing attributes for comparison.
var navTiming1EventOrder = [
'fetchStart',
'domainLookupStart',
'domainLookupEnd',
'connectStart',
'connectEnd',
'requestStart',
'responseStart',
'responseEnd',
'domInteractive',
'domContentLoadedEventStart',
'domContentLoadedEventEnd',
'domComplete',
'loadEventStart',
'loadEventEnd'
];
function verifyTimingEventOrder(eventOrder, timingEntry) {
for (var i = 0; i < eventOrder.length - 1; i++) {
assert_true(timingEntry[eventOrder[i]] <= timingEntry[eventOrder[i + 1]],
@ -70,13 +88,24 @@
"Expected duration to be equal to loadEventEnd.");
assert_equals(entries[0].initiatorType, "navigation",
"Expected initiatorType to be: navigation.");
assert_equals(entries[0].nextHopProtocol, "http/1.1");
// This test may fail when response is from cach. Disable or clean cach before
// running this test.
assert_true(entries[0].transferSize > entries[0].encodedBodySize,
"Expected transferSize to be greater than encodedBodySize in uncached navigation.");
assert_equals(entries[0].encodedBodySize, 4154);
assert_equals(entries[0].decodedBodySize, 4154);
assert_equals(entries[0].encodedBodySize, 5328);
assert_equals(entries[0].decodedBodySize, 5328);
verifyTimingEventOrder(entries[0], navTiming2EventOrder1);
// Verify if the reported timing is not that different
// from what is reported by Navigation Timing 1.
navTiming1EventOrder.forEach(
function(event) {
if (window.performance.timing[event] -
window.performance.timing.navigationStart > 0) {
assert_greater_than(entries[0][event], 0,
"Expected " + event + " to be greater than 0");
}
});
// When unloadEvent happens
if (entries[0]["unloadEventStart"] != 0) {
verifyTimingEventOrder(entries[0], navTiming2EventOrder2);

View file

@ -72,6 +72,11 @@ function test_timing_order(attribute_name, greater_than_attribute, properties)
// ensure it's in the right order
msg = "window.performance.timing." + attribute_name + " >= window.performance.timing." + greater_than_attribute;
wp_test(function() { assert_true(performanceNamespace.timing[attribute_name] >= performanceNamespace.timing[greater_than_attribute], msg); }, msg, properties);
// ensure we have at least 5 microseconds difference or it's 0
msg = "window.performance.timing." + attribute_name + " difference with window.performance.timing." + greater_than_attribute + " is 0 or at least 5 microseconds";
var diff = performanceNamespace.timing[attribute_name] - performanceNamespace.timing[greater_than_attribute];
wp_test(function() { assert_true((diff === 0) || ((diff * 1000) >= 5), msg); }, msg, properties);
}
function test_timing_greater_than(attribute_name, greater_than, properties)