| Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-preload/resource-timing.https.html
|
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-preload/resource-timing.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-preload/resource-timing.https.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2057d59a8986a909115c65173c239dc630d89ce3
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-preload/resource-timing.https.html
|
| @@ -0,0 +1,72 @@
|
| +<!DOCTYPE html>
|
| +<meta charset="utf-8">
|
| +<title>Navigation Preload Resource Timing</title>
|
| +<script src="/resources/testharness.js"></script>
|
| +<script src="/resources/testharnessreport.js"></script>
|
| +<script src="../resources/test-helpers.sub.js"></script>
|
| +<script>
|
| +
|
| +function check_timing_entry(entry) {
|
| + var name = entry.name;
|
| + assert_greater_than(entry.startTime, 0, 'startTime of ' + name);
|
| + assert_greater_than_equal(entry.fetchStart, entry.startTime,
|
| + 'fetchStart >= startTime of ' + name);
|
| + assert_greater_than_equal(entry.domainLookupStart, entry.fetchStart,
|
| + 'domainLookupStart >= fetchStart of ' + name);
|
| + assert_greater_than_equal(entry.domainLookupEnd, entry.domainLookupStart,
|
| + 'domainLookupEnd >= domainLookupStart of ' + name);
|
| + assert_greater_than_equal(entry.connectStart, entry.domainLookupEnd,
|
| + 'connectStart >= domainLookupEnd of ' + name);
|
| + assert_greater_than_equal(entry.connectEnd, entry.connectStart,
|
| + 'connectEnd >= connectStart of ' + name);
|
| + assert_greater_than_equal(entry.requestStart, entry.connectEnd,
|
| + 'requestStart >= connectEnd of ' + name);
|
| + assert_greater_than_equal(entry.responseStart, entry.requestStart,
|
| + 'domainLookupStart >= requestStart of ' + name);
|
| + assert_greater_than_equal(entry.responseEnd, entry.responseStart,
|
| + 'responseEnd >= responseStart of ' + name);
|
| + assert_greater_than(entry.duration, 0, 'duration of ' + name);
|
| +}
|
| +
|
| +promise_test(t => {
|
| + var script = 'resources/resource-timing-worker.js';
|
| + var scope = 'resources/resource-timing-scope.py';
|
| + var registration;
|
| + return service_worker_unregister_and_register(t, script, scope)
|
| + .then(reg => {
|
| + registration = reg;
|
| + add_completion_callback(_ => registration.unregister());
|
| + return wait_for_state(t, registration.installing, 'activated');
|
| + })
|
| + .then(_ => with_iframe(scope))
|
| + .then(frame => {
|
| + var result = JSON.parse(frame.contentDocument.body.textContent);
|
| + assert_equals(
|
| + result.timingEntries.length, 1,
|
| + 'performance.getEntriesByName() must returns one ' +
|
| + 'PerformanceResourceTiming entry for the navigation preload.');
|
| + var entry = result.timingEntries[0];
|
| + assert_equals(
|
| + entry.entryType, 'resource',
|
| + 'The entryType of preload response timing entry must be "resource' +
|
| + '".');
|
| + assert_equals(
|
| + entry.initiatorType, 'other',
|
| + 'The initiatorType of preload response timing entry must be ' +
|
| + '"other".');
|
| + assert_equals(
|
| + entry.decodedBodySize, Number(result.decodedBodySize),
|
| + 'decodedBodySize must same as the decoded size in the server.');
|
| + assert_equals(
|
| + entry.encodedBodySize, Number(result.encodedBodySize),
|
| + 'encodedBodySize must same as the encoded size in the server.');
|
| + assert_greater_than(
|
| + entry.transferSize, entry.decodedBodySize,
|
| + 'transferSize must greater then encodedBodySize.');
|
| + check_timing_entry(entry);
|
| + frame.remove();
|
| + return registration.unregister();
|
| + });
|
| + }, 'Navigation Preload Resource Timing.');
|
| +
|
| +</script>
|
|
|