Added some more response cases for nsIHttpChannel tests. Not part of the build.

This commit is contained in:
depstein%netscape.com 2003-01-16 06:44:49 +00:00
Родитель 10429ee29d
Коммит 3ee4a64317
4 изменённых файлов: 60 добавлений и 6 удалений

Просмотреть файл

@ -554,10 +554,8 @@ NS_IMETHODIMP CBrowserImpl::OnStartRequest(nsIRequest *request,
if (!httpObj)
QAOutput("No object to run GetResponseStatusTest().", 1);
else {
httpObj->GetResponseStatusTest(httpChannel, 1);
httpObj->GetResponseStatusTextTest(httpChannel, 1);
}
else
httpObj->CallResponseTests(httpChannel, 1);
if (!ctxt)
QAOutput("OnStartRequest():We didn't get the nsISupports object.", 1);

Просмотреть файл

@ -71,7 +71,6 @@ CnsICommandMgr::~CnsICommandMgr()
{
}
// 1st column: command; 2nd column: DoCommand state, 3rd column: CmdParam state;
CommandTest CommandTable[] = {
{"cmd_bold", "", "state_all", PR_TRUE, 50000, 5.798, "hello", "HELLO"},

Просмотреть файл

@ -45,6 +45,7 @@ nsIHttpChannel * CnsIHttpChannelTests::GetHttpChannelObject(nsCAutoString theSpe
NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, nsnull);
if (!theChannel)
QAOutput("Didn't get Channel object. GetChannelObject Test failed.", 2);
theHttpChannel = do_QueryInterface(theChannel);
if (!theHttpChannel)
QAOutput("Didn't get httpChannel object. Test failed.", 2);
@ -269,12 +270,18 @@ void CnsIHttpChannelTests::GetRedirectionLimitTest(nsIHttpChannel *theHttpChann
}
// Response tests
// called from OnStartRequest
void CnsIHttpChannelTests::CallResponseTests(nsIHttpChannel *theHttpChannel,
PRInt16 displayMode)
{
GetResponseStatusTest(theHttpChannel, displayMode);
GetResponseStatusTextTest(theHttpChannel, displayMode);
GetRequestSucceededTest(theHttpChannel, displayMode);
GetResponseHeaderTest(theHttpChannel, displayMode);
SetResponseHeaderTest(theHttpChannel, displayMode);
IsNoStoreResponseTest(theHttpChannel, displayMode);
IsNoCacheResponseTest(theHttpChannel, displayMode);
}
void CnsIHttpChannelTests::GetResponseStatusTest(nsIHttpChannel *theHttpChannel,
@ -298,4 +305,50 @@ void CnsIHttpChannelTests::GetResponseStatusTextTest(nsIHttpChannel *theHttpChan
}
void CnsIHttpChannelTests::GetRequestSucceededTest(nsIHttpChannel *theHttpChannel,
PRInt16 displayMode)
{
PRBool mRequest;
rv = theHttpChannel->GetRequestSucceeded(&mRequest);
RvTestResult(rv, "GetRequestSucceeded()", displayMode);
FormatAndPrintOutput("GetRequestSucceeded = ", mRequest, displayMode);
}
void CnsIHttpChannelTests::GetResponseHeaderTest(nsIHttpChannel *theHttpChannel,
PRInt16 displayMode)
{
nsCAutoString mResponse;
rv = theHttpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Set-Cookie"), mResponse);
RvTestResult(rv, "GetResponseHeader()", displayMode);
FormatAndPrintOutput("GetResponseHeader = ", mResponse, displayMode);
}
void CnsIHttpChannelTests::SetResponseHeaderTest(nsIHttpChannel *theHttpChannel,
PRInt16 displayMode)
{
rv = theHttpChannel->SetResponseHeader(NS_LITERAL_CSTRING("Refresh"),
NS_LITERAL_CSTRING(""), PR_FALSE);
RvTestResult(rv, "SetResponseHeader()", displayMode);
}
void CnsIHttpChannelTests::IsNoStoreResponseTest(nsIHttpChannel *theHttpChannel,
PRInt16 displayMode)
{
PRBool mNoResponse;
rv = theHttpChannel->IsNoStoreResponse(&mNoResponse);
RvTestResult(rv, "IsNoStoreResponse()", displayMode);
FormatAndPrintOutput("IsNoStoreResponse = ", mNoResponse, displayMode);
}
void CnsIHttpChannelTests::IsNoCacheResponseTest(nsIHttpChannel *theHttpChannel,
PRInt16 displayMode)
{
PRBool mNoResponse;
rv = theHttpChannel->IsNoCacheResponse(&mNoResponse);
RvTestResult(rv, "IsNoCacheResponse()", displayMode);
FormatAndPrintOutput("IsNoCacheResponse = ", mNoResponse, displayMode);
}

Просмотреть файл

@ -39,7 +39,11 @@ public:
void CallResponseTests(nsIHttpChannel *, PRInt16);
void GetResponseStatusTest(nsIHttpChannel *, PRInt16);
void GetResponseStatusTextTest(nsIHttpChannel *, PRInt16);
void GetRequestSucceededTest(nsIHttpChannel *, PRInt16);
void GetResponseHeaderTest(nsIHttpChannel *, PRInt16);
void SetResponseHeaderTest(nsIHttpChannel *, PRInt16);
void IsNoStoreResponseTest(nsIHttpChannel *, PRInt16);
void IsNoCacheResponseTest(nsIHttpChannel *, PRInt16);
public:
// Operations