Index: third_party/WebKit/LayoutTests/external/wpt/fetch/api/headers/headers-combine.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/headers/headers-combine.html b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/headers/headers-combine.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..115df7adf4ff7cc6f3014e79deb244922f95e5a9 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/headers/headers-combine.html |
@@ -0,0 +1,58 @@ |
+<!doctype html> |
+<html> |
+ <head> |
+ <meta charset="utf-8"> |
+ <title>Headers nameshake</title> |
+ <meta name="help" href="https://fetch.spec.whatwg.org/#headers"> |
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> |
+ <script src="/resources/testharness.js"></script> |
+ <script src="/resources/testharnessreport.js"></script> |
+ </head> |
+ <body> |
+ <script> |
+ var headerSeqCombine = [["single", "singleValue"], |
+ ["double", "doubleValue1"], |
+ ["double", "doubleValue2"], |
+ ["triple", "tripleValue1"], |
+ ["triple", "tripleValue2"], |
+ ["triple", "tripleValue3"] |
+ ]; |
+ var expectedDict = {"single": "singleValue", |
+ "double": "doubleValue1, doubleValue2", |
+ "triple": "tripleValue1, tripleValue2, tripleValue3" |
+ }; |
+ |
+ test(function() { |
+ var headers = new Headers(headerSeqCombine); |
+ for (name in expectedDict) |
+ assert_equals(headers.get(name), expectedDict[name]); |
+ }, "Create headers using same name for different values"); |
+ |
+ test(function() { |
+ var headers = new Headers(headerSeqCombine); |
+ for (name in expectedDict) { |
+ assert_true(headers.has(name), "name: " + name + " has value(s)"); |
+ headers.delete(name); |
+ assert_false(headers.has(name), "name: " + name + " has no value(s) anymore"); |
+ } |
+ }, "Check delete and has methods when using same name for different values"); |
+ |
+ test(function() { |
+ var headers = new Headers(headerSeqCombine); |
+ for (name in expectedDict) { |
+ headers.set(name,"newSingleValue"); |
+ assert_equals(headers.get(name), "newSingleValue", "name: " + name + " has value: newSingleValue"); |
+ } |
+ }, "Check set methods when called with already used name"); |
+ |
+ test(function() { |
+ var headers = new Headers(headerSeqCombine); |
+ for (name in expectedDict) { |
+ var value = headers.get(name); |
+ headers.append(name,"newSingleValue"); |
+ assert_equals(headers.get(name), (value + ", " + "newSingleValue")); |
+ } |
+ }, "Check append methods when called with already used name"); |
+ </script> |
+ </body> |
+</html> |