Import html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html from WPT.

Because of additional support files, some tests in the same directory change their behavior.

TBR=kochi@chromium.org

Bug: 742104
Change-Id: I5d68b248c2f34023524aeff3afb2ad436d1f9271
No-Export: true
Reviewed-on: https://chromium-review.googlesource.com/569841
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486371}
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index d9acbda4..8e3ff7e 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -871,6 +871,8 @@
 crbug.com/490511 external/wpt/html/rendering/non-replaced-elements/the-hr-element-0/color.html [ Failure ]
 crbug.com/490511 external/wpt/html/rendering/non-replaced-elements/the-hr-element-0/width.html [ Failure ]
 crbug.com/490511 external/wpt/html/rendering/replaced-elements/embedded-content-rendering-rules/canvas-fallback.html [ Failure ]
+# [Slow] didn't help.
+crbug.com/742104 external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html [ Timeout ]
 crbug.com/692560 external/wpt/html/semantics/document-metadata/styling/LinkStyle.html [ Failure Pass ]
 crbug.com/627706 external/wpt/html/semantics/embedded-content/the-img-element/invalid-src.html [ Skip ]
 
diff --git a/third_party/WebKit/LayoutTests/W3CImportExpectations b/third_party/WebKit/LayoutTests/W3CImportExpectations
index 634d815..67c1b94 100644
--- a/third_party/WebKit/LayoutTests/W3CImportExpectations
+++ b/third_party/WebKit/LayoutTests/W3CImportExpectations
@@ -638,10 +638,6 @@
 external/wpt/css/css-writing-modes-3/text-combine-upright-value-digits4-002.html [ Skip ]
 external/wpt/css/css-writing-modes-3/text-combine-upright-value-digits4-003.html [ Skip ]
 
-# crbug.com/561421: Update meta refresh parsing to match the new spec
-external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html [ Skip ]
-external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support [ Skip ]
-
 # Untriaged: Tests don't complete.
 external/wpt/html/browsers/browsing-the-web/navigating-across-documents/008.html [ Skip ]
 external/wpt/html/browsers/browsing-the-web/navigating-across-documents/009.html [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1-expected.txt
index f103a2d..69454e1 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1-expected.txt
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1-expected.txt
@@ -1,4 +1,4 @@
 This is a testharness.js-based test.
-FAIL Meta refresh is blocked by the allow-scripts sandbox flag at its creation time, not when refresh comes due Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
+FAIL Meta refresh is blocked by the allow-scripts sandbox flag at its creation time, not when refresh comes due Uncaught Error: assert_unreached: The iframe into which the meta was moved must not refresh Reached unreachable code
 Harness: the test ran to completion.
 
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-2-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-2-expected.txt
deleted file mode 100644
index 94c3e1c..0000000
--- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-2-expected.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-This is a testharness.js-based test.
-FAIL Meta refresh of the original iframe is not blocked if moved into a sandboxed iframe Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
-Harness: the test ran to completion.
-
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/dynamic-append-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/dynamic-append-expected.txt
deleted file mode 100644
index cc33bb6..0000000
--- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/dynamic-append-expected.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-This is a testharness.js-based test.
-FAIL Meta refresh applies even when dynamically appended Uncaught Error: assert_equals: expected "foo" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-Harness: the test ran to completion.
-
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/moving-documents-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/moving-documents-expected.txt
deleted file mode 100644
index 5ade47d..0000000
--- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/moving-documents-expected.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-This is a testharness.js-based test.
-FAIL When moving between documents, must refresh the original document Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
-Harness: the test ran to completion.
-
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html
new file mode 100644
index 0000000..cbfc180
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html
@@ -0,0 +1,112 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Parsing of meta refresh</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<style>
+iframe { display:none }
+</style>
+<body>
+<script>
+
+// failure to parse is []
+// success to parse is [time, url] where url is unresolved
+
+var tests_arr = [
+  {input: '', expected: []},
+  {input: '1', expected: [1, 'refresh.sub.html']},
+  {input: '1 ', expected: [1, 'refresh.sub.html']},
+  {input: '1\t', expected: [1, 'refresh.sub.html']},
+  {input: '1\r', expected: [1, 'refresh.sub.html']},
+  {input: '1\n', expected: [1, 'refresh.sub.html']},
+  {input: '1\f', expected: [1, 'refresh.sub.html']},
+  {input: '1;', expected: [1, 'refresh.sub.html']},
+  {input: '1,', expected: [1, 'refresh.sub.html']},
+  {input: '1; url=foo', expected: [1, 'foo']},
+  {input: '1, url=foo', expected: [1, 'foo']},
+  {input: '1 url=foo', expected: [1, 'foo']},
+  {input: '1;\turl=foo', expected: [1, 'foo']},
+  {input: '1,\turl=foo', expected: [1, 'foo']},
+  {input: '1\turl=foo', expected: [1, 'foo']},
+  {input: '1;\rurl=foo', expected: [1, 'foo']},
+  {input: '1,\rurl=foo', expected: [1, 'foo']},
+  {input: '1\rurl=foo', expected: [1, 'foo']},
+  {input: '1;\nurl=foo', expected: [1, 'foo']},
+  {input: '1,\nurl=foo', expected: [1, 'foo']},
+  {input: '1\nurl=foo', expected: [1, 'foo']},
+  {input: '1;\furl=foo', expected: [1, 'foo']},
+  {input: '1,\furl=foo', expected: [1, 'foo']},
+  {input: '1\furl=foo', expected: [1, 'foo']},
+  {input: '1url=foo', expected: []},
+  {input: '1x;url=foo', expected: []},
+  {input: '1 x;url=foo', expected: [1, 'x;url=foo']},
+  {input: '1;;url=foo', expected: [1, ';url=foo']},
+  {input: '  1  ;  url  =  foo', expected: [1, 'foo']},
+  {input: '  1  ,  url  =  foo', expected: [1, 'foo']},
+  {input: '  1  ;  foo', expected: [1, 'foo']},
+  {input: '  1  ,  foo', expected: [1, 'foo']},
+  {input: '  1  url  =  foo', expected: [1, 'foo']},
+  {input: '1; url=foo ', expected: [1, 'foo']},
+  {input: '1; url=f\to\no', expected: [1, 'foo']},
+  {input: '1; url="foo"bar', expected: [1, 'foo']},
+  {input: '1; url=\'foo\'bar', expected: [1, 'foo']},
+  {input: '1; url="foo\'bar', expected: [1, 'foo\'bar']},
+  {input: '1; url foo', expected: [1, 'url foo']},
+  {input: '1; urlfoo', expected: [1, 'urlfoo']},
+  {input: '1; urfoo', expected: [1, 'urfoo']},
+  {input: '1; ufoo', expected: [1, 'ufoo']},
+  {input: '1; "foo"bar', expected: [1, 'foo']},
+  {input: '; foo', expected: []},
+  {input: ', foo', expected: []},
+  {input: 'foo', expected: []},
+  {input: '+1; url=foo', expected: []},
+  {input: '-1; url=foo', expected: []},
+  {input: '+0; url=foo', expected: []},
+  {input: '-0; url=foo', expected: []},
+  {input: '0; url=foo', expected: [0, 'foo']},
+  {input: '+1; foo', expected: []},
+  {input: '-1; foo', expected: []},
+  {input: '+0; foo', expected: []},
+  {input: '-0; foo', expected: []},
+  {input: '0; foo', expected: [0, 'foo']},
+  {input: '+1', expected: []},
+  {input: '-1', expected: []},
+  {input: '+0', expected: []},
+  {input: '-0', expected: []},
+  {input: '0', expected: [0, 'refresh.sub.html']},
+  {input: '1.9; url=foo', expected: [1, 'foo']},
+  {input: '1.9..5.; url=foo', expected: [1, 'foo']},
+  {input: '.9; url=foo', expected: []},
+];
+
+tests_arr.forEach(function(test_obj) {
+  async_test(function(t) {
+    var iframe = document.createElement('iframe');
+    t.add_cleanup(function() {
+      document.body.removeChild(iframe);
+    });
+    iframe.src = 'support/refresh.sub.html?input=' + encodeURIComponent(test_obj.input);
+    document.body.appendChild(iframe);
+    var loadCount = 0;
+    iframe.onload = t.step_func(function() {
+      loadCount++;
+      var got = iframe.contentDocument.body.textContent.trim();
+      if (test_obj.expected.length === 0) {
+        assert_equals(got, 'refresh.sub.html');
+        if (loadCount === 1) {
+          setTimeout(function() {
+            t.done();
+          }, 3000); // want to make sure it doesn't redirect when it shouldn't
+        } else {
+          assert_unreached('Got > 1 load events');
+        }
+      } else {
+        if (loadCount === 2) {
+          assert_equals(got, test_obj.expected[1]);
+          t.done();
+        }
+      }
+    });
+  }, format_value(test_obj.input));
+});
+</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/;url=foo b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/;url=foo
new file mode 100644
index 0000000..622ff11
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/;url=foo
@@ -0,0 +1 @@
+;url=foo
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/__dir__.headers b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/__dir__.headers
new file mode 100644
index 0000000..156209f9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/__dir__.headers
@@ -0,0 +1 @@
+Content-Type: text/html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/foo b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/foo
new file mode 100644
index 0000000..257cc564
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/foo
@@ -0,0 +1 @@
+foo
diff --git "a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/foo\047bar" "b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/foo\047bar"
new file mode 100644
index 0000000..80e7410
--- /dev/null
+++ "b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/foo\047bar"
@@ -0,0 +1 @@
+foo'bar
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/refresh.sub.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/refresh.sub.html
new file mode 100644
index 0000000..bc97f29
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/refresh.sub.html
@@ -0,0 +1 @@
+<!doctype html><meta http-equiv=refresh content="{{GET[input]}}">refresh.sub.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/ufoo b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/ufoo
new file mode 100644
index 0000000..8fff3cf
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/ufoo
@@ -0,0 +1 @@
+ufoo
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/urfoo b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/urfoo
new file mode 100644
index 0000000..7d7373f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/urfoo
@@ -0,0 +1 @@
+urfoo
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/url foo b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/url foo
new file mode 100644
index 0000000..a1e6a92
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/url foo
@@ -0,0 +1 @@
+url foo
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/urlfoo b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/urlfoo
new file mode 100644
index 0000000..3e67b2f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/urlfoo
@@ -0,0 +1 @@
+urlfoo
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/x;url=foo b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/x;url=foo
new file mode 100644
index 0000000..f10371a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/x;url=foo
@@ -0,0 +1 @@
+x;url=foo