Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: LayoutTests/http/tests/xmlhttprequest/responseURL.html

Issue 312493004: Introduce XMLHttpRequest.responseURL. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/xmlhttprequest/responseURL-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/xmlhttprequest/responseURL.html
diff --git a/LayoutTests/http/tests/xmlhttprequest/responseURL.html b/LayoutTests/http/tests/xmlhttprequest/responseURL.html
new file mode 100644
index 0000000000000000000000000000000000000000..0d2e13dd55cd47792eef0d0c89e47d391154b62d
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/responseURL.html
@@ -0,0 +1,58 @@
+<html>
+<head></head>
+<body>
+
+<script src="/js-test-resources/js-test.js"></script>
+<script>
+description('Test XMLHttpRequest.responseURL');
+window.jsTestIsAsync = true;
+
+function get(url, type) {
+ return new Promise(function(resolve, reject) {
+ var xhr = new XMLHttpRequest();
+ window.responseURL = xhr.responseURL;
+ shouldBeEqualToString('responseURL', '');
+
+ xhr.open('GET', url);
+ xhr.responseType = type;
+ window.responseURL = xhr.responseURL;
+ shouldBeEqualToString('responseURL', '');
+
+ xhr.onreadystatechange = function() {
+ debug('xhr.readyState = ' + xhr.readyState + ': responseURL = ' + xhr.responseURL);
+ if (xhr.readyState === 4) {
+ resolve(xhr);
+ }
+ }
+ xhr.send();
+ });
+}
+
+get('resources/reply2.txt', 'text').then(function(xhr) {
+ window.status = xhr.status;
+ shouldBeEqualToString('status', '2000');
+ window.responseURL = xhr.responseURL;
+ shouldBeEqualToString('responseURL', 'http://127.0.0.1:8000/xmlhttprequest/resources/reply2.txt');
+
+ return get('resources/redirect.php?url=reply2.xml', 'document');
+}).then(function(xhr) {
+ window.status = xhr.status;
+ shouldBeEqualToString('status', '200');
+ window.responseURL = xhr.responseURL;
+ shouldBeEqualToString('responseURL', 'http://127.0.0.1:8000/xmlhttprequest/resources/reply2.xml');
+
+ return get('resources/redirect.php?url=not-found.txt', 'text');
+}).then(function(xhr) {
+ window.status = xhr.status;
+ shouldBeEqualToString('status', '404');
+ window.responseURL = xhr.responseURL;
+ shouldBeEqualToString('responseURL', 'http://127.0.0.1:8000/xmlhttprequest/resources/not-found.txt');
+
+ xhr.open('GET', xhr.responseURL);
+}).catch(function(reason) {
+ testFailed(String(reason));
+}).then(finishJSTest, finishJSTest);
+
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/http/tests/xmlhttprequest/responseURL-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698