Add tests for <area ping>
[WebKit-https.git] / LayoutTests / http / tests / navigation / ping-attribute / anchor-cookie.html
index e5360a9..1773500 100644 (file)
@@ -1,46 +1,27 @@
+<!DOCTYPE html>
 <html><head>
 <title>Ping</title>
+<script src="resources/utilities.js"></script>
 <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="../resources/delete-ping.php" onload="test();" onerror="test();"></img>
+<body>
+<img src="non-existent-image.jpg">
 <a id="a" href="../resources/check-ping.php" ping="../resources/save-Ping.php">Navigate and send ping</a>
 </body></html>