Added post-AsyncOpen() tests to OnStartRequest() impl in BrowserImpl.cpp. not part of the build.

This commit is contained in:
depstein%netscape.com 2002-12-12 02:38:49 +00:00
Родитель 163a973243
Коммит 35b683c17e
3 изменённых файлов: 27 добавлений и 10 удалений

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

@ -89,6 +89,7 @@
#include "nsirequest.h"
#include "Tests.h"
#include "prmem.h"
#include "nsichanneltests.h"
CBrowserImpl::CBrowserImpl()
{
@ -473,7 +474,7 @@ NS_IMETHODIMP CBrowserImpl::OnDataAvailable(nsIRequest *request,
{
nsCString stringMsg;
PRUint32 readLen;
QAOutput("\n");
QAOutput("##### inside nsIStreamListener::OnDataAvailable(). #####");
RequestName(request, stringMsg, 1);
@ -509,9 +510,20 @@ NS_IMETHODIMP CBrowserImpl::OnStartRequest(nsIRequest *request,
{
nsCString stringMsg;
QAOutput("\n");
QAOutput("##### BEGIN: nsIRequestObserver::OnStartRequest() #####");
RequestName(request, stringMsg, 1);
// these are for nsIChannel tests found in nsichanneltests.cpp (post AsyncOpen() tests)
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
CBrowserImpl *aBrowserImpl = new CBrowserImpl();
CnsIChannelTests *obj = new CnsIChannelTests(mWebBrowser, aBrowserImpl);
if (obj)
obj->PostAsyncTests(channel, 1);
else
QAOutput("No object to run PostAsyncTests().", 1);
if (!ctxt)
QAOutput("OnStartRequest():We didn't get the nsISupports object.", 1);
else
@ -524,7 +536,7 @@ NS_IMETHODIMP CBrowserImpl::OnStopRequest(nsIRequest *request,
nsISupports *ctxt, nsresult rv)
{
nsCString stringMsg;
QAOutput("\n");
RvTestResult(rv, "nsIRequestObserver::OnStopRequest rv input", 1);
RequestName(request, stringMsg, 1);

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

@ -202,7 +202,6 @@ void CnsIChannelTests::SetNotificationsTest(nsIChannel *theChannel, PRInt16 disp
void CnsIChannelTests::GetNotificationsTest(nsIChannel *theChannel, PRInt16 displayMode)
{
rv = theChannel->GetNotificationCallbacks(getter_AddRefs(theIRequestor));
if (!theIRequestor)
RvTestResult(rv, "GetNotificationCallbacks", displayMode);
if (displayMode == 1)
RvTestResultDlg(rv, "GetNotificationCallbacks");
@ -315,6 +314,17 @@ void CnsIChannelTests::AsyncOpenTest(nsIChannel *theChannel, PRInt16 displayMode
RvTestResultDlg(rv, "AsyncOpen()");
}
void CnsIChannelTests::PostAsyncTests(nsIChannel *theChannel, PRInt16 displayMode)
{
// tests which need to be run after the channel is opened (using AsyncOpen())
GetSecurityInfoTest(theChannel, displayMode);
SetContentTypeTest(theChannel, displayMode);
GetContentTypeTest(theChannel, displayMode);
SetContentCharsetTest(theChannel, displayMode);
GetContentCharsetTest(theChannel, displayMode);
SetContentLengthTest(theChannel, displayMode);
GetContentLengthTest(theChannel, displayMode);
}
void CnsIChannelTests::OnStartTests(UINT nMenuID)
{
@ -410,13 +420,7 @@ void CnsIChannelTests::RunAllTests()
SetNotificationsTest(theChannel, 1);
GetNotificationsTest(theChannel, 1);
AsyncOpenTest(theChannel, 1);
GetSecurityInfoTest(theChannel, 1);
SetContentTypeTest(theChannel, 1);
GetContentTypeTest(theChannel, 1);
SetContentCharsetTest(theChannel, 1);
GetContentCharsetTest(theChannel, 1);
SetContentLengthTest(theChannel, 1);
GetContentLengthTest(theChannel, 1);
// PostAsyncTests() called from nsIRequestObservor::OnStartRequest (in BrowserImpl.cpp)
OpenTest(theChannel, 1);
QAOutput("\n");
}

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

@ -85,6 +85,7 @@ public:
void GetContentLengthTest(nsIChannel *, PRInt16);
void OpenTest(nsIChannel *, PRInt16);
void AsyncOpenTest(nsIChannel *, PRInt16);
void PostAsyncTests(nsIChannel *, PRInt16);
void OnStartTests(UINT nMenuID);
void RunAllTests();
public: