Revision ac4966fa4dcda8e22ade19e03ed6690de7b9cece authored by Henrik Boström on 28 March 2018, 15:48:04 UTC, committed by Chromium WPT Sync on 28 March 2018, 15:48:04 UTC
This exposes RTCRtpSender.getStats() in JavaScript (behind flag) which implements the stats selection algorithm[1] for senders. [1] https://w3c.github.io/webrtc-pc/#dfn-stats-selection-algorithm Bug: 680172 Change-Id: I8117c87f475d1c78fa3301fc2d821f0c3a21281f Reviewed-on: https://chromium-review.googlesource.com/975306 Commit-Queue: Henrik Boström <hbos@chromium.org> Reviewed-by: Philip Jägenstedt <foolip@chromium.org> Reviewed-by: Harald Alvestrand <hta@chromium.org> Reviewed-by: Taylor Brandstetter <deadbeef@chromium.org> Cr-Commit-Position: refs/heads/master@{#546493}
1 parent f9c1a50
modulepreload.html
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
function verifyNumberOfDownloads(url, number) {
var numDownloads = 0;
let absoluteURL = new URL(url, location.href).href;
performance.getEntriesByName(absoluteURL).forEach(entry => {
if (entry.transferSize > 0) {
numDownloads++;
}
});
assert_equals(numDownloads, number, url);
}
function attachAndWaitForLoad(element) {
return new Promise((resolve, reject) => {
element.onload = resolve;
element.onerror = reject;
document.body.appendChild(element);
});
}
function attachAndWaitForError(element) {
return new Promise((resolve, reject) => {
element.onload = reject;
element.onerror = resolve;
document.body.appendChild(element);
});
}
promise_test(function(t) {
var link = document.createElement('link');
link.rel = 'modulepreload';
link.href = 'resources/dummy.js';
return attachAndWaitForLoad(link).then(() => {
verifyNumberOfDownloads('resources/dummy.js', 1);
// Verify that <script> doesn't fetch the module again.
var script = document.createElement('script');
script.type = 'module';
script.src = 'resources/dummy.js';
return attachAndWaitForLoad(script);
}).then(() => {
verifyNumberOfDownloads('resources/dummy.js', 1);
});
}, 'link rel=modulepreload');
promise_test(function(t) {
var link = document.createElement('link');
link.rel = 'modulepreload';
link.href = 'resources/module1.js';
return attachAndWaitForLoad(link).then(() => {
verifyNumberOfDownloads('resources/module1.js', 1);
// The load event fires before (optional) submodules fetch.
verifyNumberOfDownloads('resources/module2.js', 0);
var script = document.createElement('script');
script.type = 'module';
script.src = 'resources/module1.js';
return attachAndWaitForLoad(script);
}).then(() => {
verifyNumberOfDownloads('resources/module1.js', 1);
verifyNumberOfDownloads('resources/module2.js', 1);
});
}, 'link rel=modulepreload with submodules');
promise_test(function(t) {
var link = document.createElement('link');
link.rel = 'modulepreload';
link.href = 'resources/syntax-error.js';
return attachAndWaitForLoad(link);
}, 'link rel=modulepreload for a module with syntax error');
promise_test(function(t) {
var link = document.createElement('link');
link.rel = 'modulepreload';
link.href = 'resources/not-exist.js';
return attachAndWaitForError(link);
}, 'link rel=modulepreload for a module with network error');
promise_test(function(t) {
var link = document.createElement('link');
link.rel = 'modulepreload';
link.href = null;
return attachAndWaitForError(link);
}, 'link rel=modulepreload with bad href attribute');
promise_test(function(t) {
var link = document.createElement('link');
link.rel = 'modulepreload';
link.href = 'resources/module1.js?as-script';
link.as = 'script'
return attachAndWaitForLoad(link);
}, 'link rel=modulepreload as=script');
promise_test(function(t) {
var link = document.createElement('link');
link.rel = 'modulepreload';
link.href = 'resources/module1.js?as-image';
link.as = 'image'
return attachAndWaitForError(link);
}, 'link rel=modulepreload with invalid as= value');
promise_test(function(t) {
var link = document.createElement('link');
link.rel = 'modulepreload';
link.href = 'resources/module1.js?integrity-match';
link.integrity = 'sha256-ZPBZ+J9CiHzZXaBBluSeCpjzuTUkT+rSWIdXUV3AtVo='
return attachAndWaitForLoad(link);
}, 'link rel=modulepreload with integrity match');
promise_test(function(t) {
var link = document.createElement('link');
link.rel = 'modulepreload';
link.href = 'resources/module1.js?integrity-doesnotmatch';
link.integrity = 'sha384-doesnotmatch'
return attachAndWaitForError(link);
}, 'link rel=modulepreload with integrity mismatch');
</script>
</body>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...