[go: nahoru, domu]

[ResourceTiming]: Refactor initiatorType tests

This CL updates WPTs checking the behaviour of the initiatorType field
of PerformanceResourceTiming entries.

For resources corresponding to elements present in the initial page
response, the tests have been split into separate files grouped
(roughly) by the element type.

For resources corresponding to elements added to the page dynamically,
coverage has also been added for fonts, scripts and XMLHttpRequests.

Bug: 1171767
Change-Id: I547aab0db42d8f32bcbdfb310b16b4fddc103b18
GitHubIssue: https://github.com/w3c/resource-timing/issues/254
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2961075
Commit-Queue: Tom McKee <tommckee@chromium.org>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#905732}
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations
index 139f1632..019167e7 100644
--- a/third_party/blink/web_tests/TestExpectations
+++ b/third_party/blink/web_tests/TestExpectations
@@ -1909,6 +1909,10 @@
 # through wpt.fyi
 crbug.com/1218565 external/wpt/resource-timing/TAO-match.html [ Failure Timeout ]
 
+# During work on crbug.com/1171767, we discovered a bug demonstrable through
+# WPT. Marking as a failing test until we update our implementation.
+crbug.com/1223118 external/wpt/resource-timing/initiator-type/link.html [ Failure ]
+
 # Chrome touch-action computation ignores div transforms.
 crbug.com/715148 external/wpt/pointerevents/pointerevent_touch-action-rotated-divs_touch-manual.html [ Skip ]
 
diff --git a/third_party/blink/web_tests/external/wpt/lint.ignore b/third_party/blink/web_tests/external/wpt/lint.ignore
index 5cdfb48d..c0f474d 100644
--- a/third_party/blink/web_tests/external/wpt/lint.ignore
+++ b/third_party/blink/web_tests/external/wpt/lint.ignore
@@ -750,9 +750,8 @@
 
 # Tests that are false positives for using Ahem as a system font
 AHEM SYSTEM FONT: acid/acid3/test.html
-AHEM SYSTEM FONT: resource-timing/entry-attributes.html
 AHEM SYSTEM FONT: resource-timing/font-timestamps.html
-AHEM SYSTEM FONT: resource-timing/resources/all_resource_types.html
+AHEM SYSTEM FONT: resource-timing/initiator-type/style.html
 AHEM SYSTEM FONT: resource-timing/resources/iframe-reload-TAO.sub.html
 AHEM SYSTEM FONT: html/canvas/element/drawing-text-to-the-canvas/2d.text.measure.fontBoundingBox.ahem.html
 AHEM SYSTEM FONT: css/css-font-loading/fontface-override-descriptors.html
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/audio.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/audio.html
new file mode 100644
index 0000000..f09fc61
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/audio.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: audio</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+</head>
+<body>
+<audio src="/resource-timing/resources/empty.py?id=src"></audio>
+<audio>
+  <source src="/resource-timing/resources/empty.py?id=source-wav"
+    type="audio/wav" />
+</audio>
+<audio>
+  <source src="/resource-timing/resources/empty.py?id=source-mpeg"
+    type="audio/mpeg" />
+</audio>
+<audio>
+  <source src="/resource-timing/resources/empty.py?id=source-ogg"
+    type="audio/ogg" />
+</audio>
+<script>
+  initiator_type_test("empty.py?id=src", "audio", "<audio src> without 'type' attribute");
+  initiator_type_test("empty.py?id=source-wav", "audio", "<source src> with type 'audio/wav'");
+  initiator_type_test("empty.py?id=source-mpeg", "audio", "<source src> with type 'audio/mpeg'");
+  initiator_type_test("empty.py?id=source-ogg", "audio", "<source src> with type 'audio/ogg'");
+</script>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/dynamic-insertion.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/dynamic-insertion.html
new file mode 100644
index 0000000..8ce05b3c
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/dynamic-insertion.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing - initiatorType with dynamic insertion</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/entry-invariants.js"></script>
+<script src="/resource-timing/resources/resource-loaders.js"></script>
+<script>
+  const dynamic_initiator_type_test = (loader, path, expected_type,
+      resource_type) => {
+    attribute_test(loader, path, entry => {
+      assert_equals(entry.initiatorType, expected_type);
+    }, `A ${resource_type} should have the '${expected_type}' initiator type.`);
+  };
+
+  dynamic_initiator_type_test(load.image, "resources/resource_timing_test0.png",
+    "img", "image");
+  // Note that, to download a font, 'load.font' uses a <style> element to
+  // construct a font-face that is then applied to a <div>. Since it's a <style>
+  // element requesting the resource, the initiator type is 'css', not 'font'.
+  dynamic_initiator_type_test(load.font, "/fonts/Ahem.ttf", "css", "font");
+  dynamic_initiator_type_test(load.stylesheet,
+    "resources/resource_timing_test0.css", "link", "stylesheet");
+  dynamic_initiator_type_test(load.iframe, "resources/green.html", "iframe",
+    "iframe");
+  dynamic_initiator_type_test(load.script, "resources/empty.js", "script",
+    "script");
+  dynamic_initiator_type_test(load.xhr_sync, "resources/empty.py",
+    "xmlhttprequest", "XMLHttpRequest");
+</script>
+</head>
+<body>
+<h1>Description</h1>
+<p>This test validates that the initiatorType field is correct even when an
+element is dynamically inserted.</p>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/embed.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/embed.html
new file mode 100644
index 0000000..c7a505af
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/embed.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: embed</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+</head>
+<body>
+<embed src="/resource-timing/resources/resource_timing_test0.css"
+    type="text/css">
+<script>
+  initiator_type_test("resource_timing_test0.css", "embed", "<embed>");
+</script>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/frameset.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/frameset.html
new file mode 100644
index 0000000..697549a
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/frameset.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: frameset</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+<script>
+  initiator_type_test("green.html", "frame", "<frame> in a <frameset>");
+</script>
+</head>
+<!-- Although framesets were deprecated in HTML5, we still want to make sure
+  Resource Timing is emitting entries for the underlying resources' requests.
+-->
+<frameset>
+  <frame src="/resource-timing/resources/green.html">
+</frameset>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/iframe.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/iframe.html
new file mode 100644
index 0000000..0becd86
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/iframe.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: iframe</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+</head>
+<body>
+<iframe src="/resource-timing/resources/green.html"></iframe>
+<script>
+  initiator_type_test("green.html", "iframe", "<iframe>");
+</script>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/img-srcset.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/img-srcset.html
new file mode 100644
index 0000000..b8c81fbb
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/img-srcset.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: img with srcset attribute</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+</head>
+<body>
+<img src="/resource-timing/resources/resource_timing_test0.png"
+    srcset="/resource-timing/resources/resource_timing_test0.png?id=srcset 67w"
+    sizes="67px"></img>
+<script>
+  initiator_type_test("resource_timing_test0.png?id=srcset", "img", "<img srcset>");
+</script>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/img.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/img.html
new file mode 100644
index 0000000..8e2d3050
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/img.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: img</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+</head>
+<body>
+<img src="/resource-timing/resources/resource_timing_test0.png"></img>
+<script>
+  initiator_type_test("resource_timing_test0.png", "img", "<img>");
+</script>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/link.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/link.html
new file mode 100644
index 0000000..6213ed8
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/link.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: link</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+</head>
+<body>
+<link rel="stylesheet" href="/resource-timing/resources/nested.css">
+<link rel="prefetch"
+    href="/resource-timing/resources/resource_timing_test0.css?id=prefetch">
+<link rel="preload" as="style"
+    href="/resource-timing/resources/resource_timing_test0.css?id=preload">
+<link rel="prerender" href="/resource-timing/resources/green.html?id=prerender">
+<link rel="manifest" href="/resource-timing/resources/manifest.json">
+<script>
+  initiator_type_test("nested.css", "link", "<link>");
+
+  // Verify there are enries for each of nested.css' nested resources.
+  initiator_type_test("resource_timing_test0.css?id=n1", "css", "css resources embedded in css");
+  initiator_type_test("fonts/Ahem.ttf?id=n1", "css", "font resources embedded in css");
+  initiator_type_test("blue.png?id=n1", "css", "image resources embedded in css");
+
+  initiator_type_test("resource_timing_test0.css?id=prefetch", "link", "<link prefetch>");
+  initiator_type_test("resource_timing_test0.css?id=preload", "link", "<link preload>");
+  initiator_type_test("green.html?id=prerender", "link", "<link prerender>");
+  initiator_type_test("manifest.json", "link", "<link manifest>");
+</script>
+<ol>This content forces a font to get fetched</ol>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/misc.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/misc.html
new file mode 100644
index 0000000..02d01a1
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/misc.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: miscellaneous elements</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+</head>
+<body background="/resource-timing/resources/blue.png?id=body">
+<input type="image" src="/resource-timing/resources/blue.png?id=input">
+<object type="image/png" data="/resource-timing/resources/blue.png?id=object">
+</object>
+<script>
+  navigator.sendBeacon('/resource-timing/resources/empty.py?id=beacon');
+  fetch('/resource-timing/resources/empty.py?id=fetch');
+  const evtSource = new EventSource('/resource-timing/resources/eventsource.py?id=eventsource');
+</script>
+<script>
+  initiator_type_test("blue.png?id=body", "body", "<body background>");
+  initiator_type_test("blue.png?id=input", "input", "<input type='image'>");
+  initiator_type_test("blue.png?id=object", "object", "<object type='image/png'>");
+  initiator_type_test("empty.py?id=beacon", "beacon", "sendBeacon()");
+  initiator_type_test("empty.py?id=fetch", "fetch", "for fetch()");
+  initiator_type_test("eventsource.py?id=eventsource", "other", "new EventSource()");
+</script>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/picture.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/picture.html
new file mode 100644
index 0000000..e384b9e9
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/picture.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: picture</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+</head>
+<body>
+<picture>
+  <source srcset="blue.png?id=picture-source" type="image/png" />
+  <img src="blue.png?id=picture-img" />
+</picture>
+<picture>
+  <source srcset="blue.png?id=picture-notsupported-source" type="image/notsupported" />
+  <img src="blue.png?id=picture-notsupported-img" />
+</picture>
+<picture>
+  <img src="blue.png?id=picture-img-src"
+    srcset="blue.png?id=picture-img-srcset"
+    sizes="67px"></img>
+</picture>
+<picture>
+  <img src="blue.png?id=picture-99x-img-src"
+    srcset="blue.png?id=picture-99x-img-srcset 99x"
+    sizes="67px"></img>
+</picture>
+<script>
+  initiator_type_test("blue.png?id=picture-source", "img", "<source> in a <picture>");
+  initiator_type_test("blue.png?id=picture-notsupported-img", "img", "<img> in a <picture>");
+  initiator_type_test("blue.png?id=picture-img-srcset", "img", "<img srcset> in a <picture>");
+  initiator_type_test("blue.png?id=picture-99x-img-src", "img", "<img src> in a <picture>");
+</script>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/resources/initiator-type-test.js b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/resources/initiator-type-test.js
new file mode 100644
index 0000000..2b1f844
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/resources/initiator-type-test.js
@@ -0,0 +1,15 @@
+
+if (observe_entry === undefined) {
+  throw new Error("You must include resource-timing/resources/observe-entry.js "
+    + "before including this script.");
+}
+
+// Asserts that, for the given name, there is/will-be a
+// PerformanceResourceTiming entry that has the given 'initiatorType'. The test
+// is labeled according to the given descriptor.
+const initiator_type_test = (entry_name, expected_initiator, descriptor) => {
+  promise_test(async () => {
+    const entry = await observe_entry(entry_name);
+    assert_equals(entry.initiatorType, expected_initiator);
+  }, `The initiator type for ${descriptor} must be '${expected_initiator}'`);
+};
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/script.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/script.html
new file mode 100644
index 0000000..dbd6a13
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/script.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: script</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+</head>
+<body>
+<script src="/resource-timing/resources/empty_script.js"></script>
+<script>
+  const async_xhr = new XMLHttpRequest;
+  async_xhr.open('GET', '/resource-timing/resources/blue.png?id=async_xhr',
+    true);
+  async_xhr.send();
+</script>
+<script>
+  initiator_type_test("empty_script.js", "script", "<script>");
+  initiator_type_test("blue.png?id=async_xhr", "xmlhttprequest", "an asynchronous XmlHTTPRequest");
+</script>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/style.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/style.html
new file mode 100644
index 0000000..051496b7
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/style.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: style</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+</head>
+<body>
+<style>
+  iframe {
+    background: url('/resource-timing/resources/blue.png?id=background');
+  }
+  body {
+    cursor: url('/resource-timing/resources/blue.png?id=cursor'), pointer;
+  }
+  ul {
+    list-style-image: url('/resource-timing/resources/blue.png?id=list-style');
+  }
+
+  @font-face {
+    font-family: remoteFontAhem;
+    src: url('/fonts/Ahem.ttf');
+  }
+  .ahem {
+    font-family: remoteFontAhem;
+  }
+</style>
+<iframe>This iframe forces the 'background' resource to be fetched.</iframe>
+<ul>
+  <li>This content forces the 'list-style-image' resource to be fetched.</li>
+</ul>
+<div class="ahem">This content forces the '@font-face' resource to be fetched.</div>
+<script>
+  initiator_type_test("blue.png?id=background", "css", "'background' attributes in <style> elements");
+  initiator_type_test("blue.png?id=cursor", "css", "'cursor' attributes in <style> elements");
+  initiator_type_test("blue.png?id=list-style", "css", "'list-style-image' attributes in <style> elements");
+  initiator_type_test("fonts/Ahem.ttf", "css", "'@font-face' resources");
+</script>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/svg.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/svg.html
new file mode 100644
index 0000000..d92f593
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/svg.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: svg</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+</head>
+<body>
+<svg width=200 height=200
+  xmlns="http://www.w3.org/2000/svg"
+  xmlns:xlink="http://www.w3.org/1999/xlink">
+  <image href="/resource-timing/resources/blue.png" height="200" width="200"/>
+</svg>
+<script>
+  initiator_type_test("blue.png", "image", "<image> in an <svg>");
+</script>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/video.html b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/video.html
new file mode 100644
index 0000000..16f3b3d
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/initiator-type/video.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing initiator type: video</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resource-timing/resources/observe-entry.js"></script>
+<script src="resources/initiator-type-test.js"></script>
+</head>
+<body>
+<video poster="/resource-timing/resources/blue.png?id=poster"></video>
+<video src="/media/test.mp4?id=src" autoplay="true"></video>
+<video autoplay="true">
+  <source src="/media/test.mp4?id=source-mp4" type="video/mp4">
+  <track kind="subtitles" srclang="en" default
+    src="/resource-timing/resources/empty.py?id=track">
+</video>
+<video autoplay="true">
+  <source src="/media/test.ogv?id=source-ogv" type="video/ogg">
+</video>
+<script>
+  initiator_type_test("blue.png?id=poster", "video", "<video poster>");
+  initiator_type_test("media/test.mp4?id=src", "video", "<video src>");
+  initiator_type_test("media/test.mp4?id=source-mp4", "video", "<source src> with type=\"video/mp4\"");
+  initiator_type_test("empty.py?id=track", "track", "<track src>");
+  initiator_type_test("media/test.ogv?id=source-ogv", "video", "<source src> with type=\"video/ogg\"");
+</script>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resource_dynamic_insertion.html b/third_party/blink/web_tests/external/wpt/resource-timing/resource_dynamic_insertion.html
deleted file mode 100644
index de3c3d01..0000000
--- a/third_party/blink/web_tests/external/wpt/resource-timing/resource_dynamic_insertion.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8" />
-<title>Resource Timing initiator types with dynamic insertion</title>
-<link rel="author" title="Google" href="http://www.google.com/" />
-<link rel="help" href="https://www.w3.org/TR/resource-timing/#dom-performanceresourcetiming-initiatortype"/>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/webperftestharness.js"></script>
-<script src="resources/webperftestharnessextension.js"></script>
-<script>
-// Explicitly test the namespace before we start testing.
-test_namespace("getEntriesByType");
-
-
-let iframe;
-function setup_iframe() {
-    iframe = document.getElementById('frameContext');
-    const d = iframe.contentWindow.document;
-    const body = d.createElement('body');
-    d.getElementsByTagName('html')[0].appendChild(body);
-
-    const style = d.createElement('link');
-    style.rel = 'stylesheet';
-    style.href = 'resource_timing_test0.css';
-    body.appendChild(style);
-
-    const image = d.createElement('img');
-    image.src = 'resource_timing_test0.png';
-    body.appendChild(image);
-
-    const subframe = d.createElement('iframe');
-    subframe.src = 'inject_resource_test.html';
-    body.appendChild(subframe);
-}
-function onload_test() {
-    if (window.performance.getEntriesByType === undefined) {
-      done();
-      return;
-    }
-    const context = new PerformanceContext(iframe.contentWindow.performance);
-    const entries = context.getEntriesByType('resource');
-
-    const index = window.location.pathname.lastIndexOf('/');
-    const pathname = window.location.pathname.substring(0, index) + '/';
-
-    let expected_entries = { };
-    expected_entries[ pathname + 'resources/resource_timing_test0.css' ] = 'link',
-    expected_entries[ pathname + 'resources/resource_timing_test0.png' ] = 'img',
-    expected_entries[ pathname + 'resources/inject_resource_test.html' ] = 'iframe',
-
-    test_resource_entries(entries, expected_entries);
-}
-window.setup_iframe = setup_iframe;
-</script>
-</head>
-<body>
-<h1>Description</h1>
-<p>This test validates that initiator types are represented even when dynamically inserted.</p>
-<div id="log"></div>
-<iframe id="frameContext"  src="resources/inject_resource_test.html"></iframe>
-</body>
-</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resource_initiator_types.html b/third_party/blink/web_tests/external/wpt/resource-timing/resource_initiator_types.html
deleted file mode 100644
index 2e52f0e4..0000000
--- a/third_party/blink/web_tests/external/wpt/resource-timing/resource_initiator_types.html
+++ /dev/null
@@ -1,164 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8" />
-<title>Resource Timing initiator types</title>
-<link rel="author" title="Google" href="http://www.google.com/" />
-<link rel="help" href="http://www.w3.org/TR/resource-timing/#dom-performanceresourcetiming-initiatortype"/>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/webperftestharness.js"></script>
-<script src="resources/webperftestharnessextension.js"></script>
-<script>
-setup({explicit_done: true, timeout: 30000});
-
-let background_loaded = false;
-let page_loaded = false;
-let ol_font_loaded = false;
-let ul_font_loaded = false;
-let xhr_loaded = false;
-let tests_run = false;
-let frameset_loaded = false;
-
-function check_finished() {
-    if (!ul_font_loaded) {
-        ul_font_loaded = check_font_loaded('ul');
-    }
-    if (!ol_font_loaded) {
-        ol_font_loaded = check_font_loaded('ol');
-    }
-    if (page_loaded && ol_font_loaded && ul_font_loaded && background_loaded && xhr_loaded && frameset_loaded) {
-        perform_test();
-    } else {
-        step_timeout(check_finished, 100);
-    }
-}
-
-function check_font_loaded(type) {
-    const width_var_name = 'original_width_' + type;
-    const element_var_name = 'element_' + type;
-    if (!this.hasOwnProperty(width_var_name)) {
-        const d = document.getElementById('frameContext').contentWindow.document;
-        const list = d.createElement(type);
-        const li = d.createElement('li');
-        li.innerHTML = 'width_test';
-        list.appendChild(li);
-        d.getElementsByTagName('body')[0].appendChild(list);
-        this[element_var_name] = list;
-        this[width_var_name] = li.offsetHeight;
-    }
-    return this[width_var_name] != this[element_var_name].offsetHeight;
-}
-
-function onload_test() {
-    page_loaded = true;
-
-    const image = document.createElement('img');
-    image.src = 'resources/blue.png?id=n1';
-    background_loaded = image.complete;
-    if (!background_loaded) {
-        image. {
-            background_loaded = true;
-        }
-    }
-
-    step_timeout(check_finished, 100);
-}
-
-function frameset_onload() {
-    frameset_loaded = true;
-
-    step_timeout(check_finished, 100);
-}
-
-function perform_test() {
-    if (tests_run) {
-        return;
-    }
-    tests_run = true;
-    const context = new PerformanceContext(document.getElementById('frameContext').contentWindow.performance);
-    let entries = context.getEntriesByType('resource');
-
-    // check for frameset
-    if (document.getElementById('frameContext2') &&
-        document.getElementById('frameContext2').contentWindow) {
-        const context2 = new PerformanceContext(document.getElementById('frameContext2').contentWindow.performance);
-        entries = entries.concat(context2.getEntriesByType('resource'));
-    }
-
-    const index = window.location.pathname.lastIndexOf('/');
-    const pathname = window.location.pathname.substring(0, index) + '/resources/';
-    const font_pathname = window.location.pathname.substring(0, index - 15) + 'fonts/Ahem.ttf';
-
-    let expected_entries = {};
-    addEntryIfExists(entries, expected_entries, font_pathname, 'css');
-    addEntryIfExists(entries, expected_entries, pathname + 'resource_timing_test0.png', 'img');
-    addEntryIfExists(entries, expected_entries, pathname + 'resource_timing_test0.png?id=srcset-srcset', 'img');
-    addEntryIfExists(entries, expected_entries, pathname + 'resource_timing_test0.png?id=srcset-src', 'img');
-    addEntryIfExists(entries, expected_entries, pathname + 'green.html', 'iframe');
-    addEntryIfExists(entries, expected_entries, pathname + 'green.html?id=frame', 'frame');
-    addEntryIfExists(entries, expected_entries, pathname + 'empty_script.js', 'script');
-    addEntryIfExists(entries, expected_entries, pathname + 'resource_timing_test0.css?id=embed', 'embed');
-    addEntryIfExists(entries, expected_entries, pathname + 'resource_timing_test0.css?id=n1', 'css');
-    addEntryIfExists(entries, expected_entries, font_pathname + '?id=n1', 'css');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=cursor', 'css');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=1', 'css');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=2', 'css');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=async_xhr', 'xmlhttprequest');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=body', 'body');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=input', 'input');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=n1', 'css');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=object', 'object');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=video-poster', 'video');
-    addEntryIfExists(entries, expected_entries, '/media/test.mp4?id=video-src', 'video');
-    addEntryIfExists(entries, expected_entries, '/media/test.mp4?id=video-source', 'video');
-    addEntryIfExists(entries, expected_entries, '/media/test.ogv?id=video-source', 'video');
-    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=video-track', 'track');
-    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=audio-src', 'audio');
-    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=audio-source-wav', 'audio');
-    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=audio-source-mpeg', 'audio');
-    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=audio-source-ogg', 'audio');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=picture-source', 'img');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=picture-img', 'img');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=picture-notsupported-img', 'img');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=picture-img-src', 'img');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=picture-img-srcset', 'img');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=picture-99x-img-src', 'img');
-    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=svg-image', 'image');
-    addEntryIfExists(entries, expected_entries, pathname + 'nested.css', 'link');
-    addEntryIfExists(entries, expected_entries, pathname + 'nested.css?id=prefetch', 'link');
-    addEntryIfExists(entries, expected_entries, pathname + 'nested.css?id=preload', 'link');
-    addEntryIfExists(entries, expected_entries, pathname + 'green.html?id=prerender', 'link');
-    addEntryIfExists(entries, expected_entries, pathname + 'manifest.json', 'link');
-    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=beacon', 'beacon');
-    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=fetch', 'fetch');
-    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?favicon', 'link');
-    addEntryIfExists(entries, expected_entries, pathname + 'eventsource.py?id=eventsource', 'other');
-
-    test_resource_entries(entries, expected_entries);
-    done();
-}
-
-function addEntryIfExists(entries, expected_entries, path, initiatorType) {
-    const url = window.location.protocol + "//" + window.location.host + path;
-
-    if (entries.find(function(entry) { return entry.name === url; })) {
-        expected_entries[path] = initiatorType;
-    }
-}
-
-window.on_test_body_created = check_finished;
-window.on_async_xhr_done = function() {
-    xhr_loaded = true;
-    check_finished();
-}
-</script>
-</head>
-<body>
-<h1>Description</h1>
-<p>This test validates that all of the initiator types are represented.</p>
-<div id="log"></div>
-<iframe id="frameContext"  src="resources/all_resource_types.html" style="width: 250px; height: 250px;"></iframe>
-<iframe id="frameContext2"  src="resources/green-frame.html" style="width: 250px; height: 250px;"></iframe>
-</body>
-</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resources/manifest.json b/third_party/blink/web_tests/external/wpt/resource-timing/resources/manifest.json
new file mode 100644
index 0000000..e107c04
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/resources/manifest.json
@@ -0,0 +1,4 @@
+{
+    "name": "Dummy manifest",
+    "start_url": "/start.html"
+}
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resources/observe-entry.js b/third_party/blink/web_tests/external/wpt/resource-timing/resources/observe-entry.js
new file mode 100644
index 0000000..260b5929
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/resource-timing/resources/observe-entry.js
@@ -0,0 +1,25 @@
+// Given a resource name, returns a promise that will resolve to the
+// corresponding PerformanceResourceTiming entry. The promise will reject,
+// however, if the PerformanceResourceTiming entry isn't observed within ~2
+// seconds (scaled according to WPT timeout scaling).
+const observe_entry = entry_name => {
+  const entry = new Promise(resolve => {
+    new PerformanceObserver((entry_list, observer) => {
+      for (const entry of entry_list.getEntries()) {
+        if (entry.name.endsWith(entry_name)) {
+          resolve(entry);
+          observer.disconnect();
+          return;
+        }
+      }
+    }).observe({"type": "resource", "buffered": true});
+  });
+  const timeout = new Promise((resolve, reject) => {
+    step_timeout(() => {
+      reject(new Error("observe_entry: timeout"));
+    }, 2000);
+  });
+  // If the entry isn't observed within 2 seconds, assume it will never show
+  // up.
+  return Promise.race([entry, timeout]);
+};