| Index: third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-multipart.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-multipart.html b/third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-multipart.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d0606796454000f84e014052fdbe53d7670baa96
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-multipart.html
|
| @@ -0,0 +1,37 @@
|
| +<!DOCTYPE html>
|
| +<script src="/resources/testharness.js"></script>
|
| +<script src="/resources/testharnessreport.js"></script>
|
| +<script>
|
| +const minHeaderSize = 100;
|
| +const abePngSize = 12242;
|
| +var t = async_test('PerformanceResourceTiming multipart image');
|
| +
|
| +function waitForEntry() {
|
| + var image = document.getElementById('testingImage');
|
| + var src = image.getAttribute('src');
|
| + var absoluteUrl = new URL(src, location.href).href;
|
| + waitForEntryWithUrl(absoluteUrl);
|
| +}
|
| +
|
| +function waitForEntryWithUrl(absoluteUrl) {
|
| + var entries = performance.getEntriesByName(absoluteUrl, 'resource');
|
| + if (entries.length === 1) {
|
| + t.step(() => checkTransferSize(entries[0]));
|
| + } else {
|
| + // TODO(ricea): Find a better way to know when the entry is available.
|
| + t.step_timeout(() => waitForEntryWithUrl(absoluteUrl), 10);
|
| + }
|
| +}
|
| +
|
| +function checkTransferSize(entry) {
|
| + // These comparisons are not strict because multipart responses are
|
| + // non-standard. Any reasonable answer is acceptable.
|
| + // TODO(ricea): encodedBodySize and decodedBodySize don't pass.
|
| + // Fix the code or make this test even more relaxed. See crbug.com/631004.
|
| + // assert_greater_than(entry.encodedBodySize, abePngSize - 1, 'encodedBodySize');
|
| + // assert_greater_than(entry.decodedBodySize, abePngSize - 1, 'decodedBodySize');
|
| + assert_greater_than(entry.transferSize, abePngSize + minHeaderSize, 'transferSize');
|
| + t.done();
|
| +}
|
| +</script>
|
| +<img id=testingImage src="/multipart/resources/multipart.php?loop=0&interval=0&img1=abe.png" onload="waitForEntry()">
|
|
|