Add WPT for Early Hints with arbitrary header

It should have no effect.

Bug: 1305896
Change-Id: I088f0aa4dd8f992140c3a62fabff2bd1d4dd1f95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3539727
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#984026}
diff --git a/loading/early-hints/arbitrary-header-in-early-hints.h2.window.js b/loading/early-hints/arbitrary-header-in-early-hints.h2.window.js
new file mode 100644
index 0000000..f0e848e
--- /dev/null
+++ b/loading/early-hints/arbitrary-header-in-early-hints.h2.window.js
@@ -0,0 +1,4 @@
+test(() => {
+    const test_url = "resources/arbitrary-header-in-early-hints.h2.py";
+    window.location.replace(new URL(test_url, window.location));
+});
diff --git a/loading/early-hints/resources/arbitrary-header-in-early-hints.h2.py b/loading/early-hints/resources/arbitrary-header-in-early-hints.h2.py
new file mode 100644
index 0000000..bb118c3
--- /dev/null
+++ b/loading/early-hints/resources/arbitrary-header-in-early-hints.h2.py
@@ -0,0 +1,24 @@
+import os
+
+
+def handle_headers(frame, request, response):
+    # Send an early hints response with an unsupported header.
+    # User agents should ignore it.
+    early_hints = [
+        (b":status", b"103"),
+        (b"x-arbitrary-header", b"foobar"),
+    ]
+    response.writer.write_raw_header_frame(headers=early_hints,
+                                           end_headers=True)
+
+    response.status = 200
+    response.headers[b"content-type"] = "text/html"
+    response.write_status_headers()
+
+
+def main(request, response):
+    current_dir = os.path.dirname(os.path.realpath(__file__))
+    file_path = os.path.join(current_dir, "arbitrary-header-in-early-hints.html")
+    with open(file_path, "r") as f:
+        test_content = f.read()
+    response.writer.write_data(item=test_content, last=True)
diff --git a/loading/early-hints/resources/arbitrary-header-in-early-hints.html b/loading/early-hints/resources/arbitrary-header-in-early-hints.html
new file mode 100644
index 0000000..cc939f5
--- /dev/null
+++ b/loading/early-hints/resources/arbitrary-header-in-early-hints.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<script>
+promise_test(async (t) => {
+    // Pass when the page is successfully loaded.
+}, "An Early hints response contains an arbitrary header and it should have no effect.");
+</script>
+</body>