зеркало из https://github.com/mozilla/pjs.git
Added some more nsIHttpChannel attribute tests. Not part of the build.
This commit is contained in:
Родитель
1fa4f13d59
Коммит
07515d1d72
|
@ -90,6 +90,7 @@
|
|||
#include "Tests.h"
|
||||
#include "prmem.h"
|
||||
#include "nsichanneltests.h"
|
||||
#include "nsihttpchanneltests.h"
|
||||
|
||||
CBrowserImpl::CBrowserImpl()
|
||||
{
|
||||
|
@ -544,13 +545,21 @@ NS_IMETHODIMP CBrowserImpl::OnStartRequest(nsIRequest *request,
|
|||
// these are for nsIChannel tests found in nsichanneltests.cpp (post AsyncOpen() tests)
|
||||
// they will only be run if a nsISupports context was passed to AsyncOpen()
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(channel);
|
||||
CBrowserImpl *aBrowserImpl = new CBrowserImpl();
|
||||
CnsIChannelTests *obj = new CnsIChannelTests(mWebBrowser, aBrowserImpl);
|
||||
if (obj && ctxt)
|
||||
CnsIHttpChannelTests *httpObj = new CnsIHttpChannelTests(mWebBrowser, aBrowserImpl);
|
||||
if (obj && ctxt && channel)
|
||||
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
|
||||
httpObj->GetResponseStatusTest(httpChannel, 1);
|
||||
|
||||
|
||||
if (!ctxt)
|
||||
QAOutput("OnStartRequest():We didn't get the nsISupports object.", 1);
|
||||
else
|
||||
|
|
|
@ -303,7 +303,13 @@ BEGIN_MESSAGE_MAP(CTests, CWnd)
|
|||
ON_COMMAND(ID_INTERFACES_NSIHTTPCHANNEL_SETREQUESTHEADER, OnInterfacesNsihttpchannel)
|
||||
ON_COMMAND(ID_INTERFACES_NSIHTTPCHANNEL_GETREQUESTHEADER, OnInterfacesNsihttpchannel)
|
||||
ON_COMMAND(ID_INTERFACES_NSIHTTPCHANNEL_VISITREQUESTHEADERS, OnInterfacesNsihttpchannel)
|
||||
ON_COMMAND(ID_INTERFACES_NSIHTTPCHANNEL_SETALLOWPIPELINING, OnInterfacesNsihttpchannel)
|
||||
ON_COMMAND(ID_INTERFACES_NSIHTTPCHANNEL_GETALLOWPIPELINING, OnInterfacesNsihttpchannel)
|
||||
ON_COMMAND(ID_INTERFACES_NSIHTTPCHANNEL_SETREDIRECTIONLIMIT, OnInterfacesNsihttpchannel)
|
||||
ON_COMMAND(ID_INTERFACES_NSIHTTPCHANNEL_GETREDIRECTIONLIMIT, OnInterfacesNsihttpchannel)
|
||||
ON_COMMAND(ID_INTERFACES_NSIHTTPCHANNEL_GETRESPONSESTATUS, OnInterfacesNsihttpchannel)
|
||||
ON_COMMAND(ID_INTERFACES_RUNALLTESTCASES, OnInterfacesRunalltestcases)
|
||||
|
||||
//}}AFX_MSG_MAP
|
||||
|
||||
END_MESSAGE_MAP()
|
||||
|
|
|
@ -332,7 +332,7 @@ void CnsIChannelTests::PostAsyncTests(nsIChannel *theChannel, PRInt16 displayMod
|
|||
|
||||
void CnsIChannelTests::OnStartTests(UINT nMenuID)
|
||||
{
|
||||
theSpec = "ftp://ftp.netscape.com";
|
||||
theSpec = "http://www.netscape.com";
|
||||
theChannel = GetChannelObject(theSpec);
|
||||
if (!theChannel)
|
||||
{
|
||||
|
|
|
@ -87,6 +87,24 @@ void CnsIHttpChannelTests::OnStartTests(UINT nMenuID)
|
|||
case ID_INTERFACES_NSIHTTPCHANNEL_VISITREQUESTHEADERS :
|
||||
VisitRequestHeadersTest(theHttpChannel, 2);
|
||||
break;
|
||||
case ID_INTERFACES_NSIHTTPCHANNEL_SETALLOWPIPELINING :
|
||||
SetAllowPipeliningTest(theHttpChannel, PR_FALSE, 2);
|
||||
break;
|
||||
case ID_INTERFACES_NSIHTTPCHANNEL_GETALLOWPIPELINING :
|
||||
GetAllowPipeliningTest(theHttpChannel, 2);
|
||||
break;
|
||||
case ID_INTERFACES_NSIHTTPCHANNEL_SETREDIRECTIONLIMIT :
|
||||
SetRedirectionLimitTest(theHttpChannel, 100, 2);
|
||||
break;
|
||||
case ID_INTERFACES_NSIHTTPCHANNEL_GETREDIRECTIONLIMIT :
|
||||
GetRedirectionLimitTest(theHttpChannel, 2);
|
||||
break;
|
||||
|
||||
// response methods
|
||||
|
||||
case ID_INTERFACES_NSIHTTPCHANNEL_GETRESPONSESTATUS :
|
||||
GetResponseStatusTest(theHttpChannel, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +125,16 @@ void CnsIHttpChannelTests::RunAllTests()
|
|||
SetRequestHeaderTest(theHttpChannel, 1);
|
||||
GetRequestHeaderTest(theHttpChannel, 1);
|
||||
VisitRequestHeadersTest(theHttpChannel, 1);
|
||||
SetAllowPipeliningTest(theHttpChannel, PR_FALSE, 1);
|
||||
SetAllowPipeliningTest(theHttpChannel, PR_TRUE, 1);
|
||||
GetAllowPipeliningTest(theHttpChannel, 1);
|
||||
SetRedirectionLimitTest(theHttpChannel, 0, 1);
|
||||
SetRedirectionLimitTest(theHttpChannel, 5, 1);
|
||||
GetRedirectionLimitTest(theHttpChannel, 1);
|
||||
|
||||
// see nsIRequestObserver->OnStartRequest for response tests
|
||||
|
||||
GetResponseStatusTest(theHttpChannel, 1);
|
||||
QAOutput("\n");
|
||||
}
|
||||
|
||||
|
@ -194,4 +221,56 @@ void CnsIHttpChannelTests::VisitRequestHeadersTest(nsIHttpChannel *theHttpChann
|
|||
|
||||
rv = theHttpChannel->VisitRequestHeaders(theVisitor);
|
||||
RvTestResult(rv, "VisitRequestHeaders()", displayMode);
|
||||
}
|
||||
}
|
||||
|
||||
void CnsIHttpChannelTests::SetAllowPipeliningTest(nsIHttpChannel *theHttpChannel,
|
||||
PRBool mAllowPipelining,
|
||||
PRInt16 displayMode)
|
||||
{
|
||||
rv = theHttpChannel->SetAllowPipelining(mAllowPipelining);
|
||||
RvTestResult(rv, "SetAllowPipelining()", displayMode);
|
||||
FormatAndPrintOutput("SetAllowPipelining value = ", mAllowPipelining, displayMode);
|
||||
|
||||
rv = theHttpChannel->GetAllowPipelining(&mAllowPipelining);
|
||||
FormatAndPrintOutput("GetAllowPipelining value = ", mAllowPipelining, displayMode);
|
||||
}
|
||||
|
||||
void CnsIHttpChannelTests::GetAllowPipeliningTest(nsIHttpChannel *theHttpChannel,
|
||||
PRInt16 displayMode)
|
||||
{
|
||||
PRBool mAllowPipelining;
|
||||
|
||||
rv = theHttpChannel->GetAllowPipelining(&mAllowPipelining);
|
||||
RvTestResult(rv, "GetAllowPipelining()", displayMode);
|
||||
FormatAndPrintOutput("GetAllowPipelining value = ", mAllowPipelining, displayMode);
|
||||
}
|
||||
|
||||
void CnsIHttpChannelTests::SetRedirectionLimitTest(nsIHttpChannel *theHttpChannel,
|
||||
PRUint32 mRedirectionLimit,
|
||||
PRInt16 displayMode)
|
||||
{
|
||||
rv = theHttpChannel->SetRedirectionLimit(mRedirectionLimit);
|
||||
RvTestResult(rv, "SetRedirectionLimit()", displayMode);
|
||||
}
|
||||
|
||||
void CnsIHttpChannelTests::GetRedirectionLimitTest(nsIHttpChannel *theHttpChannel,
|
||||
PRInt16 displayMode)
|
||||
{
|
||||
PRUint32 mRedirectionLimit;
|
||||
|
||||
rv = theHttpChannel->GetRedirectionLimit(&mRedirectionLimit);
|
||||
RvTestResult(rv, "GetRedirectionLimit()", displayMode);
|
||||
FormatAndPrintOutput("GetRedirectionLimit value = ", mRedirectionLimit, displayMode);
|
||||
}
|
||||
|
||||
void CnsIHttpChannelTests::GetResponseStatusTest(nsIHttpChannel *theHttpChannel,
|
||||
PRInt16 displayMode)
|
||||
{
|
||||
PRUint32 mResponseStatus;
|
||||
|
||||
rv = theHttpChannel->GetResponseStatus(&mResponseStatus);
|
||||
RvTestResult(rv, "GetResponseStatus()", displayMode);
|
||||
FormatAndPrintOutput("GetResponseStatus value = ", mResponseStatus, displayMode);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,15 @@ public:
|
|||
void GetReferrerTest(nsIHttpChannel *, PRInt16);
|
||||
void SetRequestHeaderTest(nsIHttpChannel *, PRInt16);
|
||||
void GetRequestHeaderTest(nsIHttpChannel *, PRInt16);
|
||||
void VisitRequestHeadersTest(nsIHttpChannel *, PRInt16 );
|
||||
void VisitRequestHeadersTest(nsIHttpChannel *, PRInt16);
|
||||
void SetAllowPipeliningTest(nsIHttpChannel *, PRBool, PRInt16);
|
||||
void GetAllowPipeliningTest(nsIHttpChannel *, PRInt16);
|
||||
void SetRedirectionLimitTest(nsIHttpChannel *, PRUint32, PRInt16);
|
||||
void GetRedirectionLimitTest(nsIHttpChannel *, PRInt16);
|
||||
|
||||
// response methods
|
||||
void GetResponseStatusTest(nsIHttpChannel *, PRInt16);
|
||||
|
||||
public:
|
||||
|
||||
// Operations
|
||||
|
|
|
@ -300,6 +300,11 @@
|
|||
#define ID_INTERFACES_NSIHTTPCHANNEL_SETREQUESTHEADER 33036
|
||||
#define ID_INTERFACES_NSIHTTPCHANNEL_GETREQUESTHEADER 33038
|
||||
#define ID_INTERFACES_NSIHTTPCHANNEL_VISITREQUESTHEADERS 33039
|
||||
#define ID_INTERFACES_NSIHTTPCHANNEL_SETALLOWPIPELINING 33040
|
||||
#define ID_INTERFACES_NSIHTTPCHANNEL_GETALLOWPIPELINING 33041
|
||||
#define ID_INTERFACES_NSIHTTPCHANNEL_SETREDIRECTIONLIMIT 33042
|
||||
#define ID_INTERFACES_NSIHTTPCHANNEL_GETREDIRECTIONLIMIT 33043
|
||||
#define ID_INTERFACES_NSIHTTPCHANNEL_GETRESPONSESTATUS 33044
|
||||
#define ID_CLIPBOARDCMD_PASTE 42789
|
||||
#define ID_CLIPBOARDCMD_COPYSELECTION 42790
|
||||
#define ID_CLIPBOARDCMD_SELECTALL 42791
|
||||
|
@ -316,7 +321,7 @@
|
|||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 153
|
||||
#define _APS_NEXT_COMMAND_VALUE 33039
|
||||
#define _APS_NEXT_COMMAND_VALUE 33045
|
||||
#define _APS_NEXT_CONTROL_VALUE 1033
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
|
Двоичные данные
embedding/qa/testembed/testembed.aps
Двоичные данные
embedding/qa/testembed/testembed.aps
Двоичный файл не отображается.
|
@ -659,6 +659,17 @@ BEGIN
|
|||
|
||||
MENUITEM "VisitRequestHeaders", ID_INTERFACES_NSIHTTPCHANNEL_VISITREQUESTHEADERS
|
||||
|
||||
MENUITEM "SetAllowPipelining", ID_INTERFACES_NSIHTTPCHANNEL_SETALLOWPIPELINING
|
||||
|
||||
MENUITEM "GetAllowPipelining", ID_INTERFACES_NSIHTTPCHANNEL_GETALLOWPIPELINING
|
||||
|
||||
MENUITEM "SetRedirectionLimit", ID_INTERFACES_NSIHTTPCHANNEL_SETREDIRECTIONLIMIT
|
||||
|
||||
MENUITEM "GetRedirectionLimit", ID_INTERFACES_NSIHTTPCHANNEL_GETREDIRECTIONLIMIT
|
||||
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "GetResponseStatus", ID_INTERFACES_NSIHTTPCHANNEL_GETRESPONSESTATUS
|
||||
|
||||
END
|
||||
END
|
||||
POPUP "T&ools"
|
||||
|
|
Загрузка…
Ссылка в новой задаче