зеркало из https://github.com/mozilla/gecko-dev.git
updated nsIHttpChannel response cases. not part of the build.
This commit is contained in:
Родитель
9325925842
Коммит
ae9fbc54a8
|
@ -547,15 +547,20 @@ NS_IMETHODIMP CBrowserImpl::OnStartRequest(nsIRequest *request,
|
|||
CBrowserImpl *aBrowserImpl = new CBrowserImpl();
|
||||
CnsIChannelTests *obj = new CnsIChannelTests(mWebBrowser, aBrowserImpl);
|
||||
CnsIHttpChannelTests *httpObj = new CnsIHttpChannelTests(mWebBrowser, aBrowserImpl);
|
||||
if (obj && ctxt && channel)
|
||||
if (obj && ctxt && channel) {
|
||||
QAOutput(" nsIChannel tests:");
|
||||
obj->PostAsyncTests(channel, 1);
|
||||
}
|
||||
else if (!obj && ctxt)
|
||||
QAOutput("No object to run PostAsyncTests().", 1);
|
||||
|
||||
if (!httpObj)
|
||||
QAOutput("No object to run GetResponseStatusTest().", 1);
|
||||
else
|
||||
{
|
||||
QAOutput(" nsIHttpChannel response tests:");
|
||||
httpObj->CallResponseTests(httpChannel, 1);
|
||||
}
|
||||
|
||||
if (!ctxt)
|
||||
QAOutput("OnStartRequest():We didn't get the nsISupports object.", 1);
|
||||
|
|
|
@ -137,10 +137,9 @@ void CnsIHttpChannelTests::RunAllTests()
|
|||
GetRedirectionLimitTest(theHttpChannel, 1);
|
||||
|
||||
// see nsIRequestObserver->OnStartRequest for Successful response tests
|
||||
|
||||
// we're running response tests here to verify they fail when called here.
|
||||
GetResponseStatusTest(theHttpChannel, 1);
|
||||
GetResponseStatusTextTest(theHttpChannel, 1);
|
||||
CnsIChannelTests *channelObj = new CnsIChannelTests(qaWebBrowser, qaBrowserImpl);
|
||||
theChannel = channelObj->GetChannelObject(theSpec);
|
||||
channelObj->AsyncOpenTest(theChannel, 1);
|
||||
QAOutput("\n");
|
||||
}
|
||||
|
||||
|
@ -278,8 +277,12 @@ void CnsIHttpChannelTests::CallResponseTests(nsIHttpChannel *theHttpChannel,
|
|||
GetResponseStatusTest(theHttpChannel, displayMode);
|
||||
GetResponseStatusTextTest(theHttpChannel, displayMode);
|
||||
GetRequestSucceededTest(theHttpChannel, displayMode);
|
||||
GetResponseHeaderTest(theHttpChannel, displayMode);
|
||||
SetResponseHeaderTest(theHttpChannel, displayMode);
|
||||
SetResponseHeaderTest(theHttpChannel, "Refresh", "", PR_TRUE, displayMode);
|
||||
GetResponseHeaderTest(theHttpChannel, "Refresh", displayMode);
|
||||
SetResponseHeaderTest(theHttpChannel, "Set-Cookie", "", PR_FALSE, displayMode);
|
||||
GetResponseHeaderTest(theHttpChannel, "Set-Cookie", displayMode);
|
||||
SetResponseHeaderTest(theHttpChannel, "Cache-control", "no-cache", PR_FALSE, displayMode);
|
||||
GetResponseHeaderTest(theHttpChannel, "Cache-control", displayMode);
|
||||
IsNoStoreResponseTest(theHttpChannel, displayMode);
|
||||
IsNoCacheResponseTest(theHttpChannel, displayMode);
|
||||
}
|
||||
|
@ -316,21 +319,27 @@ void CnsIHttpChannelTests::GetRequestSucceededTest(nsIHttpChannel *theHttpChanne
|
|||
}
|
||||
|
||||
void CnsIHttpChannelTests::GetResponseHeaderTest(nsIHttpChannel *theHttpChannel,
|
||||
const char * responseType,
|
||||
PRInt16 displayMode)
|
||||
{
|
||||
nsCAutoString mResponse;
|
||||
|
||||
rv = theHttpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Set-Cookie"), mResponse);
|
||||
rv = theHttpChannel->GetResponseHeader(NS_LITERAL_CSTRING(responseType), mResponse);
|
||||
RvTestResult(rv, "GetResponseHeader()", displayMode);
|
||||
FormatAndPrintOutput("GetResponseHeader = ", mResponse, displayMode);
|
||||
FormatAndPrintOutput("GetResponseHeader response type = ", responseType, displayMode);
|
||||
}
|
||||
|
||||
void CnsIHttpChannelTests::SetResponseHeaderTest(nsIHttpChannel *theHttpChannel,
|
||||
PRInt16 displayMode)
|
||||
{
|
||||
rv = theHttpChannel->SetResponseHeader(NS_LITERAL_CSTRING("Refresh"),
|
||||
NS_LITERAL_CSTRING(""), PR_FALSE);
|
||||
const char * responseType,
|
||||
const char * value,
|
||||
PRBool merge, PRInt16 displayMode)
|
||||
{ // Refresh
|
||||
rv = theHttpChannel->SetResponseHeader(NS_LITERAL_CSTRING(responseType),
|
||||
NS_LITERAL_CSTRING(value), merge);
|
||||
RvTestResult(rv, "SetResponseHeader()", displayMode);
|
||||
FormatAndPrintOutput("SetResponseHeader value = ", value, displayMode);
|
||||
FormatAndPrintOutput("SetResponseHeader response type = ", responseType, displayMode);
|
||||
}
|
||||
|
||||
void CnsIHttpChannelTests::IsNoStoreResponseTest(nsIHttpChannel *theHttpChannel,
|
||||
|
|
|
@ -40,8 +40,8 @@ public:
|
|||
void GetResponseStatusTest(nsIHttpChannel *, PRInt16);
|
||||
void GetResponseStatusTextTest(nsIHttpChannel *, PRInt16);
|
||||
void GetRequestSucceededTest(nsIHttpChannel *, PRInt16);
|
||||
void GetResponseHeaderTest(nsIHttpChannel *, PRInt16);
|
||||
void SetResponseHeaderTest(nsIHttpChannel *, PRInt16);
|
||||
void GetResponseHeaderTest(nsIHttpChannel *, const char *, PRInt16);
|
||||
void SetResponseHeaderTest(nsIHttpChannel *, const char *, const char *, PRBool, PRInt16);
|
||||
void IsNoStoreResponseTest(nsIHttpChannel *, PRInt16);
|
||||
void IsNoCacheResponseTest(nsIHttpChannel *, PRInt16);
|
||||
public:
|
||||
|
|
Загрузка…
Ссылка в новой задаче