From c0472dafe5a1df66a3c537272929406929fdfdff Mon Sep 17 00:00:00 2001 From: "depstein%netscape.com" Date: Thu, 12 Dec 2002 02:38:49 +0000 Subject: [PATCH] Added post-AsyncOpen() tests to OnStartRequest() impl in BrowserImpl.cpp. not part of the build. git-svn-id: svn://10.0.0.236/trunk@135162 18797224-902f-48f8-a5cc-f745e15eee43 --- .../embedding/qa/testembed/BrowserImpl.cpp | 16 +++++++++++++-- .../qa/testembed/nsichanneltests.cpp | 20 +++++++++++-------- .../embedding/qa/testembed/nsichanneltests.h | 1 + 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/mozilla/embedding/qa/testembed/BrowserImpl.cpp b/mozilla/embedding/qa/testembed/BrowserImpl.cpp index 62a4332d2e3..4594758b1f1 100644 --- a/mozilla/embedding/qa/testembed/BrowserImpl.cpp +++ b/mozilla/embedding/qa/testembed/BrowserImpl.cpp @@ -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 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); diff --git a/mozilla/embedding/qa/testembed/nsichanneltests.cpp b/mozilla/embedding/qa/testembed/nsichanneltests.cpp index d6aa804697e..c5fad24b8a4 100644 --- a/mozilla/embedding/qa/testembed/nsichanneltests.cpp +++ b/mozilla/embedding/qa/testembed/nsichanneltests.cpp @@ -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"); } diff --git a/mozilla/embedding/qa/testembed/nsichanneltests.h b/mozilla/embedding/qa/testembed/nsichanneltests.h index f546f95696c..85e90746084 100644 --- a/mozilla/embedding/qa/testembed/nsichanneltests.h +++ b/mozilla/embedding/qa/testembed/nsichanneltests.h @@ -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: