diff --git a/embedding/qa/testembed/BrowserImpl.cpp b/embedding/qa/testembed/BrowserImpl.cpp index d951f75200e..cd0b74c6e89 100644 --- a/embedding/qa/testembed/BrowserImpl.cpp +++ b/embedding/qa/testembed/BrowserImpl.cpp @@ -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 channel = do_QueryInterface(request); + nsCOMPtr 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 diff --git a/embedding/qa/testembed/Tests.cpp b/embedding/qa/testembed/Tests.cpp index 3066172c061..c19a2f09bcd 100644 --- a/embedding/qa/testembed/Tests.cpp +++ b/embedding/qa/testembed/Tests.cpp @@ -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() diff --git a/embedding/qa/testembed/nsichanneltests.cpp b/embedding/qa/testembed/nsichanneltests.cpp index 6421ade6d17..5de9121f116 100644 --- a/embedding/qa/testembed/nsichanneltests.cpp +++ b/embedding/qa/testembed/nsichanneltests.cpp @@ -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) { diff --git a/embedding/qa/testembed/nsihttpchanneltests.cpp b/embedding/qa/testembed/nsihttpchanneltests.cpp index ee314323db7..16d4c6ae14f 100644 --- a/embedding/qa/testembed/nsihttpchanneltests.cpp +++ b/embedding/qa/testembed/nsihttpchanneltests.cpp @@ -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); -} \ No newline at end of file +} + +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); +} + + diff --git a/embedding/qa/testembed/nsihttpchanneltests.h b/embedding/qa/testembed/nsihttpchanneltests.h index 96325cf51b1..573ddf88e21 100644 --- a/embedding/qa/testembed/nsihttpchanneltests.h +++ b/embedding/qa/testembed/nsihttpchanneltests.h @@ -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 diff --git a/embedding/qa/testembed/resource.h b/embedding/qa/testembed/resource.h index 78538a363ba..c4ee9b6bb50 100644 --- a/embedding/qa/testembed/resource.h +++ b/embedding/qa/testembed/resource.h @@ -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 diff --git a/embedding/qa/testembed/testembed.aps b/embedding/qa/testembed/testembed.aps index 0a3670addbb..e39c8b6483d 100644 Binary files a/embedding/qa/testembed/testembed.aps and b/embedding/qa/testembed/testembed.aps differ diff --git a/embedding/qa/testembed/testembed.rc b/embedding/qa/testembed/testembed.rc index c901a9c344e..48e7e70508d 100644 --- a/embedding/qa/testembed/testembed.rc +++ b/embedding/qa/testembed/testembed.rc @@ -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"