Index: LayoutTests/http/tests/fetch/script-tests/response.js |
diff --git a/LayoutTests/http/tests/fetch/script-tests/response.js b/LayoutTests/http/tests/fetch/script-tests/response.js |
index 46dde766908b3a85a8c2428812c88695792c76b0..fc89b22f7a8584f95d837de5c448f0e90e2f1b6b 100644 |
--- a/LayoutTests/http/tests/fetch/script-tests/response.js |
+++ b/LayoutTests/http/tests/fetch/script-tests/response.js |
@@ -119,6 +119,31 @@ test(function() { |
}, |
'new Response with status = ' + status + ' should throw'); |
}); |
+ |
+ [300, 0, 304, 305, 306, 309, 500].forEach(function(status) { |
+ assert_throws({name: 'RangeError'}, |
+ function() { |
+ Response.redirect('https://www.example.com/test.html', |
+ status); |
+ }, |
+ 'new Response with status code (' + status + |
tyoshino (SeeGerritForStatus)
2015/04/20 04:50:00
use the same text as L120 or update the line, too.
shiva.jm
2015/04/27 10:50:54
Done. changed both line to wrap to 80 columns.
|
+ ') should throw'); |
+ }); |
+ |
+ assert_throws( |
+ {name: 'TypeError'}, |
+ function() { |
hiroshige
2015/04/20 07:53:53
-1 indent (L135, L136, L142, L143).
shiva.jm
2015/04/27 10:50:54
Done.
|
+ Response.redirect('https://', 301); |
+ }, |
+ 'new Response with invalid URL http:// should throw'); |
hiroshige
2015/04/20 07:53:52
The message (http://) and the test code (https://)
shiva.jm
2015/04/27 10:50:54
Done.
|
+ |
hiroshige
2015/04/20 07:53:52
Could you add a test with invalid URL and invalid
shiva.jm
2015/04/27 10:50:54
Done.
|
+ assert_throws( |
+ {name: 'TypeError'}, |
+ function() { |
+ Response.redirect('https://'); |
+ }, |
+ 'new Response with invalid URL http:// should throw'); |
hiroshige
2015/04/20 07:53:53
Could you add tests of invalid URLs that contains
shiva.jm
2015/04/27 10:50:54
Done.
|
+ |
[200, 300, 400, 500, 599].forEach(function(status) { |
var response = new Response(new Blob(), {status: status}); |
assert_equals(response.status, status, 'Response.status should match'); |
@@ -425,4 +450,27 @@ promise_test(function(t) { |
}); |
}, 'Read after text()'); |
+promise_test(function() { |
+ var response = Response.redirect('https://www.example.com/test.html'); |
+ return response.text().then(function(text) { |
+ assert_equals(response.status, 302, |
+ 'default value of status is always 302'); |
+ assert_equals(response.headers.get('location'), |
+ 'https://www.example.com/test.html', |
+ 'Location header should be correct absoulte URL'); |
hiroshige
2015/04/20 07:53:53
Could you add assertion that response.headers has
shiva.jm
2015/04/27 10:50:54
Done.
hiroshige
2015/04/27 11:47:25
Not added? e.g.
assert_equals(size(respons
|
+ }); |
+ }, 'Response.redirect() with default value'); |
+ |
+promise_test(function() { |
+ var response = Response.redirect('https://www.example.com/test.html', |
+ 301); |
+ return response.text().then(function(text) { |
+ assert_equals(response.status, 301, |
+ 'value of status is 301'); |
+ assert_equals(response.headers.get('location'), |
+ 'https://www.example.com/test.html', |
+ 'Location header should be correct absoulte URL'); |
+ }); |
+ }, 'Response.redirect()'); |
hiroshige
2015/04/20 07:53:52
optional: How about 'Response.redirect() with 301'
shiva.jm
2015/04/27 10:50:54
Done.
|
+ |
done(); |