mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326
This commit is contained in:
parent
462c272380
commit
1f531f66ea
5377 changed files with 174916 additions and 84369 deletions
|
@ -23,11 +23,20 @@ interface Performance {
|
|||
};
|
||||
|
||||
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 EventHandler {
|
||||
};
|
||||
|
||||
typedef double DOMHighResTimeStamp;
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
partial interface Performance {
|
||||
PerformanceEntryList getEntries();
|
||||
PerformanceEntryList getEntriesByType(DOMString entryType);
|
||||
|
@ -40,9 +49,11 @@ partial interface Window {
|
|||
</pre>
|
||||
|
||||
<pre id='idl'>
|
||||
[Exposed=(Window)]
|
||||
[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;
|
||||
|
@ -54,8 +65,12 @@ interface PerformanceResourceTiming : PerformanceEntry {
|
|||
readonly attribute DOMHighResTimeStamp requestStart;
|
||||
readonly attribute DOMHighResTimeStamp responseStart;
|
||||
readonly attribute DOMHighResTimeStamp responseEnd;
|
||||
serializer = {inherit, attribute};
|
||||
readonly attribute unsigned long long transferSize;
|
||||
readonly attribute unsigned long long encodedBodySize;
|
||||
readonly attribute unsigned long long decodedBodySize;
|
||||
[Default] object toJSON();
|
||||
};
|
||||
|
||||
partial interface Performance {
|
||||
void clearResourceTimings();
|
||||
void setResourceTimingBufferSize(unsigned long maxSize);
|
||||
|
@ -71,7 +86,8 @@ partial interface Performance {
|
|||
idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
|
||||
idl_array.add_idls(document.getElementById("idl").textContent);
|
||||
|
||||
idl_array.add_objects({Performance: ['window.performance']});
|
||||
idl_array.add_objects({Performance: ['window.performance'],
|
||||
PerformanceResourceTiming: ["window.performance.getEntriesByType('resource')[0]"]});
|
||||
|
||||
idl_array.test();
|
||||
})();
|
||||
|
|
BIN
tests/wpt/web-platform-tests/resource-timing/resources/blue.png
Normal file
BIN
tests/wpt/web-platform-tests/resource-timing/resources/blue.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1,010 B |
|
@ -1,8 +1,11 @@
|
|||
import gzip as gzip_module
|
||||
from cStringIO import StringIO
|
||||
import os
|
||||
|
||||
def main(request, response):
|
||||
f = open('resource-timing/resources/resource_timing_test0.xml', 'r')
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
file_path = os.path.join(dir_path, 'resource_timing_test0.xml')
|
||||
f = open(file_path, 'r')
|
||||
output = f.read()
|
||||
|
||||
out = StringIO()
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>One resource when reusing data</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
var img_entries = 0;
|
||||
var observed = 0;
|
||||
var img_url = "resources/blue.png";
|
||||
var observer = new PerformanceObserver(
|
||||
function (entryList, obs) {
|
||||
var entries = entryList.getEntriesByType("resource");
|
||||
for (var i = 0; i < entries.length; ++i) {
|
||||
++observed;
|
||||
if (entries[i].name.indexOf(img_url) != -1)
|
||||
++img_entries;
|
||||
}
|
||||
});
|
||||
observer.observe({entryTypes: ["resource"]});
|
||||
window.onload = function() {
|
||||
// A timeout is needed as PerformanceObserver is not guaranteed to run before onload triggered.
|
||||
setTimeout(function() {
|
||||
test(function(){
|
||||
assert_equals(observed, 1);
|
||||
assert_equals(img_entries, 1);
|
||||
}, "Only one resource entry per resource");
|
||||
},0)
|
||||
};
|
||||
// Images are added dynamically to make sure the observer is registered before their download finishes.
|
||||
var img1 = document.createElement("img");
|
||||
img1.src = img_url;
|
||||
document.body.appendChild(img1);
|
||||
var img2 = document.createElement("img");
|
||||
img2.src = img_url;
|
||||
document.body.appendChild(img2);
|
||||
</script>
|
||||
<h1>One resource when reusing data</h1>
|
||||
<p>
|
||||
If the user agent is to reuse the data from another existing or completed fetch initiated from the current document, abort the remaining steps.
|
||||
</p>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
|
|
@ -162,7 +162,11 @@ function resource_load(expected)
|
|||
assert_equals(entries_by_name_type.length, 1, "should have a single entry for each resource (with type)");
|
||||
assert_not_equals(entries_by_name, entries_by_name_type, "values should be copies");
|
||||
for (p in entries_by_name[0]) {
|
||||
assert_equals(entries_by_name[0][p], entries_by_name_type[0][p], "Property " + p + " should match");
|
||||
var assertMethod = assert_equals
|
||||
if (Array.isArray(entries_by_name[0][p]) && Array.isArray(entries_by_name_type[0][p])) {
|
||||
assertMethod = assert_array_equals
|
||||
}
|
||||
assertMethod(entries_by_name[0][p], entries_by_name_type[0][p], "Property " + p + " should match");
|
||||
}
|
||||
this.done();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue