diff --git a/mozilla/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp b/mozilla/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp index 15ba026d7d0..e3a4cf6538a 100644 --- a/mozilla/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp +++ b/mozilla/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp @@ -108,6 +108,7 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * if (progressStateFlags & STATE_IS_DOCUMENT) // DOCUMENT { + displayMode = 1; strcpy(theDocType, "DOCUMENT"); if (progressStateFlags & STATE_START) { @@ -117,10 +118,6 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * if(m_pBrowserFrameGlue) m_pBrowserFrameGlue->UpdateBusyState(PR_TRUE); - - CString strMsg; - strMsg.Format("OnStateChange:: status = %d", status); - AfxMessageBox(strMsg); } else if (progressStateFlags & STATE_REDIRECTING) @@ -154,6 +151,7 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * } // end STATE_IS_DOCUMENT if (progressStateFlags & STATE_IS_REQUEST) // REQUEST { + displayMode = 1; strcpy(theDocType, "REQUEST"); if (progressStateFlags & STATE_START) { @@ -166,11 +164,13 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * CTests::SuspendReqTest(request); CQaUtils::QAOutput("Between Suspend and Resume."); CTests::ResumeReqTest(request); +/* // CTests::CancelReqTest(request); nsCOMPtr theLoadGroup(do_CreateInstance(NS_LOADGROUP_CONTRACTID)); // CTests::SetLoadGroupTest(request, theLoadGroup); // getting a crash. investigate! // CTests::GetLoadGroupTest(request); +*/ } else if (progressStateFlags & STATE_REDIRECTING) strcpy(theStateType, "STATE_REDIRECTING"); @@ -187,6 +187,7 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * if (progressStateFlags & STATE_IS_NETWORK) // NETWORK { + displayMode = 1; strcpy(theDocType, "NETWORK"); if (progressStateFlags & STATE_START) strcpy(theStateType, "STATE_START"); @@ -204,6 +205,7 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * } if (progressStateFlags & STATE_IS_WINDOW) // WINDOW { + displayMode = 1; strcpy(theDocType, "WINDOW"); if (progressStateFlags & STATE_START) strcpy(theStateType, "STATE_START"); diff --git a/mozilla/embedding/qa/testembed/QaUtils.cpp b/mozilla/embedding/qa/testembed/QaUtils.cpp index c88f2f0c63a..e0b34c7b2bd 100644 --- a/mozilla/embedding/qa/testembed/QaUtils.cpp +++ b/mozilla/embedding/qa/testembed/QaUtils.cpp @@ -144,6 +144,31 @@ void CQaUtils::FormatAndPrintOutput(const char *theInput, const char *theVar, in } } +void CQaUtils::FormatAndPrintOutput(const char *theInput, int theVar, int outputMode) +{ + nsCString outStr; + CString strMsg; + + outStr = theInput; + outStr.AppendInt(theVar); + + strMsg = outStr.get(); + + switch (outputMode) + { + case 0: + AfxMessageBox(strMsg); + break; + case 1: + WriteToOutputFile(outStr.get()); + break; + case 2: + WriteToOutputFile(outStr.get()); + AfxMessageBox(strMsg); + break; + } +} + // stringMsg is returned in case embeddor wishes to use it in the calling method. void CQaUtils::RequestName(nsIRequest *request, nsCString &stringMsg, int displayMethod) diff --git a/mozilla/embedding/qa/testembed/QaUtils.h b/mozilla/embedding/qa/testembed/QaUtils.h index 33adcce33b3..268d339d250 100644 --- a/mozilla/embedding/qa/testembed/QaUtils.h +++ b/mozilla/embedding/qa/testembed/QaUtils.h @@ -48,6 +48,7 @@ public: void static WriteToOutputFile(const char *); void static QAOutput(const char *pLine, int displayMethod=1); void static FormatAndPrintOutput(const char *, const char *, int); + void static FormatAndPrintOutput(const char *, int, int); void static RequestName(nsIRequest *, nsCString &, int displayMethod=1); void static WebProgDOMWindowTest(nsIWebProgress *, const char *, int displayMethod=1); diff --git a/mozilla/embedding/qa/testembed/Tests.cpp b/mozilla/embedding/qa/testembed/Tests.cpp index 4fc52729f18..e780d15deb4 100644 --- a/mozilla/embedding/qa/testembed/Tests.cpp +++ b/mozilla/embedding/qa/testembed/Tests.cpp @@ -181,9 +181,7 @@ void CTests::OnTestsGlobalHistory() // see if url is already in the GH file (pre-AddPage() test) rv = myHistory->IsVisited(theUrl, &theRetVal); CQaUtils::RvTestResult(rv, "rv IsVisited() test", 1); - - strMsg.Format("The IsVisited() return value = %d", theRetVal); - AfxMessageBox(strMsg); + CQaUtils::FormatAndPrintOutput("The IsVisited() boolean return value = ", theRetVal, 1); if (theRetVal) CQaUtils::QAOutput("URL has been visited. Won't execute AddPage().", 2); @@ -563,9 +561,8 @@ void CTests::OnInterfacesNsishistory() // getEntryAtIndex() tests for (theIndex = 0; theIndex < numEntries; theIndex++) - { - strMsg.Format("the index = %d", theIndex); - AfxMessageBox(strMsg); + { + CQaUtils::FormatAndPrintOutput("the index = ", theIndex, 2); // GetEntryAtIndexTest(theSessionHistory, theHistoryEntry, theIndex); theSessionHistory->GetEntryAtIndex(theIndex, PR_FALSE, getter_AddRefs(theHistoryEntry)); @@ -693,8 +690,7 @@ void CTests::GetIsSubFrameTest(nsIHistoryEntry* theHistoryEntry) CQaUtils::QAOutput("isSubFrame for GetIsSubFrame() invalid. Test failed.", 1); else CQaUtils::RvTestResult(rv, "GetIsSubFrame() (isSubFrame attribute) test", 1); - strMsg.Format("The subFrame value = %d", isSubFrame); - AfxMessageBox(strMsg); + CQaUtils::FormatAndPrintOutput("The subFrame boolean value = ", isSubFrame, 2); } /* @@ -774,7 +770,7 @@ void CTests::OnInterfacesNsiwebnav() ReloadTest(nsIWebNavigation::LOAD_FLAGS_NONE); LoadUriTest("http://www.cisco.com/", nsIWebNavigation::LOAD_FLAGS_MASK); - ReloadTest(nsIWebNavigation::LOAD_FLAGS_MASK); + // ReloadTest(nsIWebNavigation::LOAD_FLAGS_MASK); LoadUriTest("http://www.netscape.com/", nsIWebNavigation::LOAD_FLAGS_IS_LINK); LoadUriTest("http://www.aol.com/", nsIWebNavigation::LOAD_FLAGS_BYPASS_HISTORY); @@ -803,8 +799,7 @@ void CTests::CanGoBackTest() CQaUtils::QAOutput("canGoBack for GetCanGoBack() invalid. Test failed.", 1); else CQaUtils::RvTestResult(rv, "GetCanGoBack() attribute test", 2); - strMsg.Format("canGoBack value = %d", canGoBack); - AfxMessageBox(strMsg); + CQaUtils::FormatAndPrintOutput("canGoBack value = ", canGoBack, 2); } void CTests::GoBackTest() @@ -821,8 +816,7 @@ void CTests::CanGoForwardTest() CQaUtils::QAOutput("canGoForward for GetCanGoForward() invalid. Test failed.", 1); else CQaUtils::RvTestResult(rv, "GetCanGoForward() attribute test", 2); - strMsg.Format("canGoForward value = %d", canGoForward); - AfxMessageBox(strMsg); + CQaUtils::FormatAndPrintOutput("canGoForward value = ", canGoForward, 2); } void CTests::GoForwardTest() @@ -972,9 +966,8 @@ void CTests::GetSHTest() rv = theSessionHistory->GetCount(&numOfElements); CQaUtils::RvTestResult(rv, "nsISHistory::GetCount() for nsIWebNav test", 1); - - strMsg.Format("the sHist entry count = %d", numOfElements); - AfxMessageBox(strMsg); + + CQaUtils::FormatAndPrintOutput("the sHist entry count = ", numOfElements, 2); } // *********************************************************************** @@ -1002,7 +995,7 @@ void CTests::OnInterfacesNsirequest() nsIWebNavigation::LOAD_FLAGS_NONE); } - // note: individual nsIRequest tests are found in BrowserImplWebProgLstner.cpp, OnStateChange(). + // note: individual nsIRequest tests are called in BrowserImplWebProgLstner.cpp, OnStateChange(). }