Diff
Modified: trunk/LayoutTests/ChangeLog (199821 => 199822)
--- trunk/LayoutTests/ChangeLog 2016-04-21 17:02:57 UTC (rev 199821)
+++ trunk/LayoutTests/ChangeLog 2016-04-21 18:03:38 UTC (rev 199822)
@@ -1,3 +1,29 @@
+2016-04-21 Daniel Bates <daba...@apple.com>
+
+ Add tests for <area ping>
+ https://bugs.webkit.org/show_bug.cgi?id=79438
+ <rdar://problem/22586699>
+
+ Reviewed by Alexey Proskuryakov.
+
+ * http/tests/navigation/ping-attribute/anchor-cookie.html: Extracted out code into functions setCookie(),
+ clearLastPingResultAndRunTest() and clickElement() (defined in utilities.js) so that they can be
+ used by this test and others. Also added HTML5 doctype declaration since it is unnecessary to run
+ this test in quirks mode.
+ * http/tests/navigation/ping-attribute/area-cookie-expected.txt: Added.
+ * http/tests/navigation/ping-attribute/area-cookie.html: Added.
+ * http/tests/navigation/ping-attribute/area-cross-origin-expected.txt: Added.
+ * http/tests/navigation/ping-attribute/area-cross-origin-from-https-expected.txt: Added.
+ * http/tests/navigation/ping-attribute/area-cross-origin-from-https.html: Added.
+ * http/tests/navigation/ping-attribute/area-cross-origin.html: Added.
+ * http/tests/navigation/ping-attribute/area-same-origin-expected.txt: Added.
+ * http/tests/navigation/ping-attribute/area-same-origin.html: Added.
+ * http/tests/navigation/ping-attribute/resources/utilities.js: Added.
+ (setCookie):
+ (clearLastPingResultAndRunTest.done):
+ (clearLastPingResultAndRunTest):
+ (clickElement):
+
2016-04-21 Antoine Quint <grao...@apple.com>
Creating a large number of WebGL contexts should recycle older contexts
Modified: trunk/LayoutTests/http/tests/navigation/ping-attribute/anchor-cookie.html (199821 => 199822)
--- trunk/LayoutTests/http/tests/navigation/ping-attribute/anchor-cookie.html 2016-04-21 17:02:57 UTC (rev 199821)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/anchor-cookie.html 2016-04-21 18:03:38 UTC (rev 199822)
@@ -1,46 +1,27 @@
+<!DOCTYPE html>
<html><head>
<title>Ping</title>
+<script src=""
<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.overridePreference("WebKitHyperlinkAuditingEnabled", 1);
+ testRunner.waitUntilDone();
+}
-var testCalled = false;
-
-function test() {
- if (!testCalled) {
- if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.overridePreference("WebKitHyperlinkAuditingEnabled", 1);
- testRunner.waitUntilDone();
- }
- testCalled = true;
- return;
- }
- try {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", "../../cookies/resources/setCookies.cgi", false);
- xhr.setRequestHeader("SET-COOKIE", "hello=world;path=/");
- xhr.send(null);
- if (xhr.status != 200) {
- document.getElementsByTagName("body")[0].appendChild(document.createTextNode("FAILED: cookie not set"));
- if (window.testRunner)
- testRunner.notifyDone();
- }
- } catch (e) {
- document.getElementsByTagName("body")[0].appendChild(document.createTextNode("FAILED: cookie not set"));
- if (window.testRunner)
- testRunner.notifyDone();
- }
-
- if (window.eventSender) {
- var a = document.getElementById("a");
- eventSender.mouseMoveTo(a.offsetLeft + 2, a.offsetTop + 2);
- eventSender.mouseDown();
- eventSender.mouseUp();
- }
+function test()
+{
+ setCookie();
+ clickElement(document.getElementById("a"));
}
+window._onload_ = function ()
+{
+ clearLastPingResultAndRunTest(test);
+}
</script>
</head>
-<body _onload_="test();">
-<img src="" _onload_="test();" _onerror_="test();"></img>
+<body>
+<img src=""
<a id="a" href="" ping="../resources/save-Ping.php">Navigate and send ping</a>
</body></html>
Added: trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cookie-expected.txt (0 => 199822)
--- trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cookie-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cookie-expected.txt 2016-04-21 18:03:38 UTC (rev 199822)
@@ -0,0 +1,6 @@
+Ping sent successfully
+CONTENT_TYPE: text/ping
+HTTP_COOKIE: hello=world
+HTTP_PING_FROM: http://127.0.0.1:8000/navigation/ping-attribute/area-cookie.html
+HTTP_PING_TO: http://127.0.0.1:8000/navigation/resources/check-ping.php
+REQUEST_METHOD: POST
Added: trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cookie.html (0 => 199822)
--- trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cookie.html (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cookie.html 2016-04-21 18:03:38 UTC (rev 199822)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.overridePreference("WebKitHyperlinkAuditingEnabled", 1);
+ testRunner.waitUntilDone();
+}
+
+function test()
+{
+ setCookie();
+ clickElement(document.querySelector("img"));
+}
+
+window._onload_ = function ()
+{
+ clearLastPingResultAndRunTest(test);
+}
+</script>
+</head>
+<body>
+ <img src="" width="128" height="128" usemap=""
+ <map name="imagemap">
+ <area shape="rect" coords="0,0,128,128" href="" ping="../resources/save-Ping.php">
+ </map>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin-expected.txt (0 => 199822)
--- trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin-expected.txt 2016-04-21 18:03:38 UTC (rev 199822)
@@ -0,0 +1,6 @@
+Ping sent successfully
+CONTENT_TYPE: text/ping
+HTTP_PING_FROM: http://127.0.0.1:8000/navigation/ping-attribute/area-cross-origin.html
+HTTP_PING_TO: http://127.0.0.1:8000/navigation/resources/check-ping.php
+HTTP_REFERER: http://127.0.0.1:8000/navigation/ping-attribute/area-cross-origin.html
+REQUEST_METHOD: POST
Added: trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin-from-https-expected.txt (0 => 199822)
--- trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin-from-https-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin-from-https-expected.txt 2016-04-21 18:03:38 UTC (rev 199822)
@@ -0,0 +1,4 @@
+Ping sent successfully
+CONTENT_TYPE: text/ping
+HTTP_PING_TO: https://127.0.0.1:8443/navigation/resources/check-ping.php
+REQUEST_METHOD: POST
Added: trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin-from-https.html (0 => 199822)
--- trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin-from-https.html (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin-from-https.html 2016-04-21 18:03:38 UTC (rev 199822)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.overridePreference("WebKitHyperlinkAuditingEnabled", 1);
+ testRunner.waitUntilDone();
+}
+
+if (location.protocol != "https:")
+ location = "https://127.0.0.1:8443/navigation/ping-attribute/area-cross-origin-from-https.html"
+
+function test()
+{
+ clickElement(document.querySelector("img"));
+}
+
+window._onload_ = function ()
+{
+ clearLastPingResultAndRunTest(test);
+}
+</script>
+</head>
+<body>
+ <img src="" width="128" height="128" usemap=""
+ <map name="imagemap">
+ <area shape="rect" coords="0,0,128,128" href="" ping="http://localhost:8000/navigation/resources/save-Ping.php?test=/navigation/ping-attribute/area-cross-origin-from-https.html">
+ </map>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin.html (0 => 199822)
--- trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin.html (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin.html 2016-04-21 18:03:38 UTC (rev 199822)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.overridePreference("WebKitHyperlinkAuditingEnabled", 1);
+ testRunner.waitUntilDone();
+}
+
+function test()
+{
+ clickElement(document.querySelector("img"));
+}
+
+window._onload_ = function ()
+{
+ clearLastPingResultAndRunTest(test);
+}
+</script>
+</head>
+<body>
+ <img src="" width="128" height="128" usemap=""
+ <map name="imagemap">
+ <area shape="rect" coords="0,0,128,128" href="" ping="http://localhost:8000/navigation/resources/save-Ping.php">
+ </map>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/navigation/ping-attribute/area-same-origin-expected.txt (0 => 199822)
--- trunk/LayoutTests/http/tests/navigation/ping-attribute/area-same-origin-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/area-same-origin-expected.txt 2016-04-21 18:03:38 UTC (rev 199822)
@@ -0,0 +1,5 @@
+Ping sent successfully
+CONTENT_TYPE: text/ping
+HTTP_PING_FROM: http://127.0.0.1:8000/navigation/ping-attribute/area-same-origin.html
+HTTP_PING_TO: http://127.0.0.1:8000/navigation/resources/check-ping.php
+REQUEST_METHOD: POST
Added: trunk/LayoutTests/http/tests/navigation/ping-attribute/area-same-origin.html (0 => 199822)
--- trunk/LayoutTests/http/tests/navigation/ping-attribute/area-same-origin.html (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/area-same-origin.html 2016-04-21 18:03:38 UTC (rev 199822)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.overridePreference("WebKitHyperlinkAuditingEnabled", 1);
+ testRunner.waitUntilDone();
+}
+
+function test()
+{
+ clickElement(document.querySelector("img"));
+}
+
+window._onload_ = function ()
+{
+ clearLastPingResultAndRunTest(test);
+}
+</script>
+</head>
+<body>
+ <img src="" width="128" height="128" usemap=""
+ <map name="imagemap">
+ <area shape="rect" coords="0,0,128,128" href="" ping="../resources/save-Ping.php">
+ </map>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/utilities.js (0 => 199822)
--- trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/utilities.js (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/utilities.js 2016-04-21 18:03:38 UTC (rev 199822)
@@ -0,0 +1,42 @@
+function setCookie()
+{
+ try {
+ var xhr = new XMLHttpRequest;
+ xhr.open("GET", "../../cookies/resources/setCookies.cgi", false);
+ xhr.setRequestHeader("SET-COOKIE", "hello=world;path=/");
+ xhr.send(null);
+ if (xhr.status != 200) {
+ document.getElementsByTagName("body")[0].appendChild(document.createTextNode("FAILED: cookie not set"));
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ } catch (e) {
+ document.getElementsByTagName("body")[0].appendChild(document.createTextNode("FAILED: cookie not set"));
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+}
+
+function clearLastPingResultAndRunTest(callback)
+{
+ function done()
+ {
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+
+ var xhr = new XMLHttpRequest;
+ xhr.open("GET", "resources/delete-ping.php", true /* async */);
+ xhr.send(null);
+ xhr._onload_ = callback;
+ xhr._onerror_ = done;
+}
+
+function clickElement(element)
+{
+ if (!window.eventSender)
+ return;
+ eventSender.mouseMoveTo(element.offsetLeft + 2, element.offsetTop + 2);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}