Title: [220304] trunk/LayoutTests
- Revision
- 220304
- Author
- [email protected]
- Date
- 2017-08-04 16:22:00 -0700 (Fri, 04 Aug 2017)
Log Message
Add test coverage for sendBeacon() keepalive flag
https://bugs.webkit.org/show_bug.cgi?id=175212
Reviewed by Youenn Fablet.
* http/wpt/beacon/keepalive-after-navigation-expected.txt: Added.
* http/wpt/beacon/keepalive-after-navigation.html: Added.
* http/wpt/beacon/support/sendBeacon-onunload-iframe.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (220303 => 220304)
--- trunk/LayoutTests/ChangeLog 2017-08-04 23:09:24 UTC (rev 220303)
+++ trunk/LayoutTests/ChangeLog 2017-08-04 23:22:00 UTC (rev 220304)
@@ -1,5 +1,16 @@
2017-08-04 Chris Dumez <[email protected]>
+ Add test coverage for sendBeacon() keepalive flag
+ https://bugs.webkit.org/show_bug.cgi?id=175212
+
+ Reviewed by Youenn Fablet.
+
+ * http/wpt/beacon/keepalive-after-navigation-expected.txt: Added.
+ * http/wpt/beacon/keepalive-after-navigation.html: Added.
+ * http/wpt/beacon/support/sendBeacon-onunload-iframe.html: Added.
+
+2017-08-04 Chris Dumez <[email protected]>
+
[Beacon] Update sendBeacon to use the CachedResourceLoader
https://bugs.webkit.org/show_bug.cgi?id=175192
<rdar://problem/33725923>
Added: trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation-expected.txt (0 => 220304)
--- trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation-expected.txt (rev 0)
+++ trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation-expected.txt 2017-08-04 23:22:00 UTC (rev 220304)
@@ -0,0 +1,4 @@
+frame "testFrame" - has 1 onunload handler(s)
+
+PASS Test that beacon sent from unload event handler is properly received
+
Added: trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation.html (0 => 220304)
--- trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation.html (rev 0)
+++ trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation.html 2017-08-04 23:22:00 UTC (rev 220304)
@@ -0,0 +1,43 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>SendBeacon keepalive flag</title>
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script src=""
+ <script src=""
+ <script>
+const RESOURCES_DIR = "/beacon/resources/";
+
+function pollResult(test, id) {
+ var checkUrl = RESOURCES_DIR + "content-type.py?cmd=get&id=" + id;
+
+ return new Promise(resolve => {
+ step_timeout(test.step_func(() => {
+ fetch(checkUrl).then(response => {
+ response.text().then(body => {
+ resolve(body);
+ });
+ });
+ }), 50);
+ });
+}
+
+_onload_ = function() {
+ promise_test(function(test) {
+ let testFrame = document.getElementById("testFrame");
+ let id = testFrame.contentWindow.id;
+ testFrame.remove();
+
+ return pollResult(test, id).then(result => {
+ assert_equals(result, "text/plain;charset=UTF-8", "Correct content-type header result");
+ });
+ }, "Test that beacon sent from unload event handler is properly received");
+}
+ </script>
+ <iframe id="testFrame" src=""
+ </body>
+</html>
Added: trunk/LayoutTests/http/wpt/beacon/support/sendBeacon-onunload-iframe.html (0 => 220304)
--- trunk/LayoutTests/http/wpt/beacon/support/sendBeacon-onunload-iframe.html (rev 0)
+++ trunk/LayoutTests/http/wpt/beacon/support/sendBeacon-onunload-iframe.html 2017-08-04 23:22:00 UTC (rev 220304)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<body _onunload_="unload()">
+<script src=""
+<script src=""
+
+<script>
+const RESOURCES_DIR = "/beacon/resources/";
+var id = self.token();
+
+function unload() {
+ var testUrl = RESOURCES_DIR + "content-type.py?cmd=put&id=" + id;
+ navigator.sendBeacon(testUrl, "test");
+}
+</script>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes