Tests for
WebClient .
version: $Revision: 2161 $ author: Mike Bowler author: Christian Sell author: Ben Curren author: Marc Guillemot author: David D. Kilzer author: Chris Erskine author: Hans Donner author: Paul King author: Ahmed Ashour
testGetPageFailingStatusCode() Verifies that exceptions are thrown on failing status code and the returned page
is still set as the current page in the WebWindow.
testRedirection301_MovedPermanently_PostMethod() From the http spec: If the 301 status code is received in response
to a request other than GET or HEAD, the user agent MUST NOT automatically
redirect the request unless it can be confirmed by the user, since this
might change the conditions under which the request was issued.
testScriptPreProcessor_UnimplementedJavascript() Test the ScriptPreProcessor's ability to filter out a javascript method
that is not implemented without affecting the rest of the page.
Apparently if the browsers receive a charset that they don't understand, they ignore
it and assume ISO-8895-1. Ensure we do the same.
throws: Exception - If the test fails.
testBinaryFileFromFileSystem
public void testBinaryFileFromFileSystem() throws Exception(Code)
Test that no encoding disturb file reads from filesystem.
For instance this test failed under Linux with LANG=de_DE.UTF-8 or LANG=C
but worked for LANG=de_DE.ISO-8859-1
throws: Exception - if the test fails.
testContentTypeCaseInsensitive
public void testContentTypeCaseInsensitive() throws Exception(Code)
Test that content type is looked in a case insensitive way.
Cf RFC 2045:
"All media type values, subtype values, and parameter names as defined
are case-insensitive".
throws: Exception - If something goes wrong.
testCredentialProvider_NoCredentials
public void testCredentialProvider_NoCredentials() throws Exception(Code)
Test the situation where credentials are required but they haven't been specified.
throws: Exception - If something goes wrong.
public void testExpandUrlHandlesColonsInRelativeUrl() throws Exception(Code)
Colons are legal in the path of a url but
WebClient.expandUrl(URLString) was
blowing up on this case. Ensure it's fixed.
throws: Exception - If the test fails.
public void testGetPageFailingStatusCode() throws Exception(Code)
Verifies that exceptions are thrown on failing status code and the returned page
is still set as the current page in the WebWindow.
throws: Exception - if test fails
testGetPageWithStringArg
public void testGetPageWithStringArg() throws Exception(Code)
Test that WebClient.getPage(String) calls WebClient.getPage(URL) with the right URL
throws: Exception - if the test fails
public void testProxyConfigWithRedirect() throws Exception(Code)
Regression test for
https://sourceforge.net/tracker/index.php?func=detail&aid=1669097&group_id=47038&atid=448266
throws: Exception - If the test fails.
testRedirectViaJavaScriptDuringInitialPageLoad
public void testRedirectViaJavaScriptDuringInitialPageLoad() throws Exception(Code)
Test redirecting with javascript during page load.
throws: Exception - If something goes wrong.
testRedirection301_MovedPermanently_GetMethod
public void testRedirection301_MovedPermanently_GetMethod() throws Exception(Code)
Test a 301 redirection code where the original request was a GET.
throws: Exception - If something goes wrong.
testRedirection301_MovedPermanently_PostMethod
public void testRedirection301_MovedPermanently_PostMethod() throws Exception(Code)
From the http spec: If the 301 status code is received in response
to a request other than GET or HEAD, the user agent MUST NOT automatically
redirect the request unless it can be confirmed by the user, since this
might change the conditions under which the request was issued.
BUT Firefox follows the redirection
throws: Exception - If something goes wrong.
public void testRedirection302_MovedTemporarily_CommaInParameters() throws Exception(Code)
Test a 302 redirection code with "," in url parameters.
throws: Exception - If something goes wrong.
testRedirection302_MovedTemporarily_GetMethod
public void testRedirection302_MovedTemporarily_GetMethod() throws Exception(Code)
Test a 302 redirection code.
throws: Exception - If something goes wrong.
testRedirection302_MovedTemporarily_PostMethod
public void testRedirection302_MovedTemporarily_PostMethod() throws Exception(Code)
From the http spec: Note: RFC 1945 and RFC 2068 specify that the client
is not allowed to change the method on the redirected request. However,
most existing user agent implementations treat 302 as if it were a 303
response, performing a GET on the Location field-value regardless
of the original request method. The status codes 303 and 307 have
been added for servers that wish to make unambiguously clear which
kind of reaction is expected of the client.
throws: Exception - If something goes wrong.
testRedirection303_SeeOther_GetMethod
public void testRedirection303_SeeOther_GetMethod() throws Exception(Code)
Tests a 303 redirection code. This should be the same as a 302.
throws: Exception - If something goes wrong.
testRedirection303_SeeOther_PostMethod
public void testRedirection303_SeeOther_PostMethod() throws Exception(Code)
Tests a 303 redirection code - this should be the same as a 302.
throws: Exception - If something goes wrong.
testRedirection307_TemporaryRedirect_GetMethod
public void testRedirection307_TemporaryRedirect_GetMethod() throws Exception(Code)
Tests a 307 redirection code.
throws: Exception - If something goes wrong.
testRedirection307_TemporaryRedirect_PostMethod
public void testRedirection307_TemporaryRedirect_PostMethod() throws Exception(Code)
Tests a 307 redirection code.
throws: Exception - If something goes wrong.
Browsers allow many redirections to the same url before to stop redirections.
See Bug 1619765 and feature request 1472343.
throws: Exception - if the test fails.
Test the script preprocessor
throws: IOException - if the test fails
testScriptPreProcessor_UnimplementedJavascript
public void testScriptPreProcessor_UnimplementedJavascript() throws Exception(Code)
Test the ScriptPreProcessor's ability to filter out a javascript method
that is not implemented without affecting the rest of the page.
throws: Exception - if the test fails