summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/resource-timing/redirects.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/resource-timing/redirects.html')
-rw-r--r--testing/web-platform/tests/resource-timing/redirects.html61
1 files changed, 61 insertions, 0 deletions
diff --git a/testing/web-platform/tests/resource-timing/redirects.html b/testing/web-platform/tests/resource-timing/redirects.html
new file mode 100644
index 0000000000..ba69907a5f
--- /dev/null
+++ b/testing/web-platform/tests/resource-timing/redirects.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing: resources fetched through same-origin redirects</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#sec-performanceresourcetiming"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<script src="resources/resource-loaders.js"></script>
+<script src="resources/entry-invariants.js"></script>
+<script>
+const {HTTPS_NOTSAMESITE_ORIGIN} = get_host_info();
+const redirect_url = `/common/redirect.py`;
+const url_prefix = `${redirect_url}?location=/resource-timing/resources/`;
+const https_url_prefix = `${redirect_url}?location=${HTTPS_NOTSAMESITE_ORIGIN}/resource-timing/resources/`;
+
+attribute_test(
+ load.stylesheet, url_prefix + "resource_timing_test0.css",
+ invariants.assert_same_origin_redirected_resource,
+ "Verify attributes of a redirected stylesheet's PerformanceResourceTiming");
+
+attribute_test(
+ load.image, url_prefix + "blue.png",
+ invariants.assert_same_origin_redirected_resource,
+ "Verify attributes of a redirected image's PerformanceResourceTiming");
+
+attribute_test(
+ load.iframe, url_prefix + "green.html",
+ invariants.assert_same_origin_redirected_resource,
+ "Verify attributes of a redirected iframe's PerformanceResourceTiming");
+
+attribute_test(
+ load.script, url_prefix + "empty_script.js",
+ invariants.assert_same_origin_redirected_resource,
+ "Verify attributes of a redirected script's PerformanceResourceTiming");
+
+attribute_test(
+ load.xhr_sync, url_prefix + "green.html?id=xhr",
+ invariants.assert_same_origin_redirected_resource,
+ "Verify attributes of a redirected synchronous XMLHttpRequest's " +
+ "PerformanceResourceTiming");
+
+attribute_test(
+ load.xhr_sync, https_url_prefix + "green.html?id=xhr",
+ invariants.assert_cross_origin_redirected_resource,
+ "Verify attributes of a synchronous XMLHttpRequest's " +
+ "PerformanceResourceTiming where the initial HTTP request is redirected " +
+ "to a cross-origin HTTPS resource."
+);
+
+</script>
+</head>
+<body>
+<h1>Description</h1>
+<p>This test validates that, when a fetching resources that encounter
+same-origin redirects, attributes of the PerformanceResourceTiming entry
+conform to the specification.</p>
+</body>
+</html>