Title: [260526] trunk/LayoutTests
- Revision
- 260526
- Author
- cdu...@apple.com
- Date
- 2020-04-22 11:59:39 -0700 (Wed, 22 Apr 2020)
Log Message
Add layout test to validate the User-Agent HTTP header of XMLHttpRequest
https://bugs.webkit.org/show_bug.cgi?id=210863
Reviewed by Youenn Fablet.
* http/tests/xmlhttprequest/xhr-user-agent-expected.txt: Added.
* http/tests/xmlhttprequest/xhr-user-agent.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (260525 => 260526)
--- trunk/LayoutTests/ChangeLog 2020-04-22 18:47:36 UTC (rev 260525)
+++ trunk/LayoutTests/ChangeLog 2020-04-22 18:59:39 UTC (rev 260526)
@@ -1,3 +1,13 @@
+2020-04-22 Chris Dumez <cdu...@apple.com>
+
+ Add layout test to validate the User-Agent HTTP header of XMLHttpRequest
+ https://bugs.webkit.org/show_bug.cgi?id=210863
+
+ Reviewed by Youenn Fablet.
+
+ * http/tests/xmlhttprequest/xhr-user-agent-expected.txt: Added.
+ * http/tests/xmlhttprequest/xhr-user-agent.html: Added.
+
2020-04-22 Antoine Quint <grao...@apple.com>
[Web Animations] Coordinate "update animations and send events" procedure across multiple timelines
Added: trunk/LayoutTests/http/tests/xmlhttprequest/resources/echo-user-agent.php (0 => 260526)
--- trunk/LayoutTests/http/tests/xmlhttprequest/resources/echo-user-agent.php (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/resources/echo-user-agent.php 2020-04-22 18:59:39 UTC (rev 260526)
@@ -0,0 +1 @@
+<?php echo $_SERVER['HTTP_USER_AGENT']; ?>
Added: trunk/LayoutTests/http/tests/xmlhttprequest/xhr-user-agent-expected.txt (0 => 260526)
--- trunk/LayoutTests/http/tests/xmlhttprequest/xhr-user-agent-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/xhr-user-agent-expected.txt 2020-04-22 18:59:39 UTC (rev 260526)
@@ -0,0 +1,19 @@
+Validates User-Agent header of XMLHttpRequest
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+* Synchronous XHR
+PASS syncXHR.status is 200
+PASS syncXHRUserAgent.includes('AppleWebKit/') is true
+
+* Asynchronous XHR
+PASS asyncXHR.status is 200
+PASS asyncXHRUserAgent.includes('AppleWebKit/') is true
+
+PASS syncXHRUserAgent === asyncXHRUserAgent is true
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/xmlhttprequest/xhr-user-agent.html (0 => 260526)
--- trunk/LayoutTests/http/tests/xmlhttprequest/xhr-user-agent.html (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/xhr-user-agent.html 2020-04-22 18:59:39 UTC (rev 260526)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Validates User-Agent header of XMLHttpRequest");
+jsTestIsAsync = true;
+
+_onload_ = () => {
+ debug ("* Synchronous XHR");
+ syncXHR = new XMLHttpRequest();
+ syncXHR.open("GET", 'resources/echo-user-agent.php', false);
+ syncXHR.send("");
+ shouldBe("syncXHR.status", "200");
+ syncXHRUserAgent = syncXHR.responseText;
+ shouldBeTrue("syncXHRUserAgent.includes('AppleWebKit/')");
+
+ debug("");
+ asyncXHR = new XMLHttpRequest();
+ asyncXHR._onload_ = () => {
+ debug("* Asynchronous XHR");
+ shouldBe("asyncXHR.status", "200");
+ asyncXHRUserAgent = asyncXHR.responseText;
+ shouldBeTrue("asyncXHRUserAgent.includes('AppleWebKit/')");
+ debug("");
+ shouldBeTrue("syncXHRUserAgent === asyncXHRUserAgent");
+ debug("");
+ finishJSTest();
+ }
+ asyncXHR.open("GET", 'resources/echo-user-agent.php', true);
+ asyncXHR.send("");
+}
+</script>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes