From 58238a1346790f5a125c0d3858192e28194e997e Mon Sep 17 00:00:00 2001 From: "depstein%netscape.com" Date: Sat, 2 Feb 2002 02:34:27 +0000 Subject: [PATCH] Fixed web prog lstnr logging bug; added onStateChangeString() method to QaUtils. Also added entry to url table in nsIWebNav.cpp --- .../qa/testembed/BrowserImplWebPrgrsLstnr.cpp | 43 +++++++++++-------- embedding/qa/testembed/QaUtils.cpp | 17 ++++++++ embedding/qa/testembed/QaUtils.h | 3 +- embedding/qa/testembed/nsIWebNav.cpp | 8 +++- 4 files changed, 51 insertions(+), 20 deletions(-) diff --git a/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp b/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp index b0846dea76f7..d1da9300a28b 100644 --- a/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp +++ b/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp @@ -84,13 +84,15 @@ NS_IMETHODIMP CBrowserImpl::OnProgressChange(nsIWebProgress *progress, nsIReques if (nProgressMax == 0) nProgressMax = LONG_MAX; + FormatAndPrintOutput("OnProgressChange(): curSelfProgress value = ", curSelfProgress, 1); + FormatAndPrintOutput("OnProgressChange(): maxSelfProgress value = ", maxSelfProgress, 1); + FormatAndPrintOutput("OnProgressChange(): curTotalProgress value = ", nProgress, 1); + FormatAndPrintOutput("OnProgressChange(): maxTotalProgress value = ", nProgressMax, 1); + if (curSelfProgress == maxSelfProgress) { QAOutput("nsIWebProgLstnr::OnProgressChange(): Self progress complete!", 1); - FormatAndPrintOutput("OnProgressChange(): curSelfProgress value = ", curSelfProgress, 1); - FormatAndPrintOutput("OnProgressChange(): maxSelfProgress value = ", maxSelfProgress, 1); - // web progress DOMWindow test WebProgDOMWindowTest(progress, "OnProgressChange()", 1); } @@ -100,9 +102,6 @@ NS_IMETHODIMP CBrowserImpl::OnProgressChange(nsIWebProgress *progress, nsIReques nProgress = nProgressMax; // Progress complete QAOutput("nsIWebProgLstnr::OnProgressChange(): Progress Update complete!", 1); - - FormatAndPrintOutput("OnProgressChange(): curTotalProgress value = ", nProgress, 1); - FormatAndPrintOutput("OnProgressChange(): maxTotalProgress value = ", nProgressMax, 1); } m_pBrowserFrameGlue->UpdateProgress(nProgress, nProgressMax); @@ -167,7 +166,11 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * WebProgDOMWindowTest(progress, "OnStateChange()", 1); } + + onStateChangeString(theStateType, theDocType, stringMsg, status, displayMode); + } // end STATE_IS_DOCUMENT + if (progressStateFlags & STATE_IS_REQUEST) // REQUEST { displayMode = 1; @@ -185,6 +188,8 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * else if (progressStateFlags & STATE_STOP) strcpy(theStateType, "STATE_STOP"); + + onStateChangeString(theStateType, theDocType, stringMsg, status, displayMode); } if (progressStateFlags & STATE_IS_NETWORK) // NETWORK @@ -204,6 +209,9 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * else if (progressStateFlags & STATE_STOP) strcpy(theStateType, "STATE_STOP"); + + onStateChangeString(theStateType, theDocType, stringMsg, status, displayMode); + } if (progressStateFlags & STATE_IS_WINDOW) // WINDOW { @@ -222,18 +230,11 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * else if (progressStateFlags & STATE_STOP) strcpy(theStateType, "STATE_STOP"); + + onStateChangeString(theStateType, theDocType, stringMsg, status, displayMode); + } - totalMsg = "OnStateChange(): "; - totalMsg += theStateType; - totalMsg += ", "; - totalMsg += theDocType; - totalMsg += ", "; - totalMsg += stringMsg; - totalMsg += ", status = "; - totalMsg.AppendInt(status); - - QAOutput(totalMsg.get(), displayMode); QAOutput("Exiting nsIWebProgLstnr::OnStateChange().\r\n"); return NS_OK; @@ -323,10 +324,18 @@ CBrowserImpl::OnSecurityChange(nsIWebProgress *aWebProgress, RequestName(aRequest, stringMsg); if (state & STATE_IS_SECURE) + { QAOutput("OnSecurityChange():STATE_IS_SECURE. All docs & subdocs are https."); + if ((state & 0xFFFF0000) == STATE_SECURE_HIGH) + QAOutput("OnSecurityChange(): STATE_SECURE_HIGH state"); + else if (state & STATE_SECURE_MED) + QAOutput("OnSecurityChange(): STATE_SECURE_MED state"); + else if (state & STATE_SECURE_LOW) + QAOutput("OnSecurityChange(): STATE_SECURE_LOW state"); + } else if (state & STATE_IS_BROKEN) QAOutput("OnSecurityChange():STATE_IS_BROKEN. Mixed: some docs are https."); - else if (state & STATE_IS_INSECURE) + else if ((state & 0xFFFF) == STATE_IS_INSECURE) QAOutput("OnSecurityChange():STATE_IS_INSECURE. Nothing is https."); // web progress DOMWindow test diff --git a/embedding/qa/testembed/QaUtils.cpp b/embedding/qa/testembed/QaUtils.cpp index c79ddbd92dc1..a25af3176c2c 100644 --- a/embedding/qa/testembed/QaUtils.cpp +++ b/embedding/qa/testembed/QaUtils.cpp @@ -234,6 +234,23 @@ void GetTheUri(nsIURI *theUri, int displayMethod) FormatAndPrintOutput("the uri = ", uriSpec, displayMethod); } +// used for web progress listener in BrowserImplWebPrgrsLstnr.cpp +void onStateChangeString(char *theStateType, char *theDocType, + nsCString stringMsg, PRUint32 status, int displayMode) +{ + nsCString totalMsg; + + totalMsg = "OnStateChange(): "; + totalMsg += theStateType; + totalMsg += ", "; + totalMsg += theDocType; + totalMsg += ", "; + totalMsg += stringMsg; + totalMsg += ", status = "; + totalMsg.AppendInt(status); + QAOutput(totalMsg.get(), displayMode); +} + ///////////////////////////////////////////////////////////////////////////// // CShowTestResults dialog diff --git a/embedding/qa/testembed/QaUtils.h b/embedding/qa/testembed/QaUtils.h index f416f1e81ffe..9ca86b43dd1f 100644 --- a/embedding/qa/testembed/QaUtils.h +++ b/embedding/qa/testembed/QaUtils.h @@ -60,7 +60,8 @@ extern void FormatAndPrintOutput(const char *, const char *, int); extern void FormatAndPrintOutput(const char *, int, int); extern void RequestName(nsIRequest *, nsCString &, int displayMethod=1); extern void WebProgDOMWindowTest(nsIWebProgress *, const char *,int displayMethod=1); -extern void GetTheUri(nsIURI *theUri, int displayMethod); +extern void GetTheUri(nsIURI *theUri, int displayMethod=1); +extern void onStateChangeString(char *, char *, nsCString, PRUint32, int displayMethod=1); extern nsresult rv; #endif //_QAUTILS_H///////////////////////////////////////////////////////////////////////////// diff --git a/embedding/qa/testembed/nsIWebNav.cpp b/embedding/qa/testembed/nsIWebNav.cpp index 9f64849b46e0..86ef4f239555 100644 --- a/embedding/qa/testembed/nsIWebNav.cpp +++ b/embedding/qa/testembed/nsIWebNav.cpp @@ -80,7 +80,8 @@ NavElement UrlTable[] = { {"http://www.oracle.com/", nsIWebNavigation::LOAD_FLAGS_NONE}, {"http://www.sun.com/", nsIWebNavigation::LOAD_FLAGS_IS_REFRESH}, {"http://www.netscape.com/", nsIWebNavigation::LOAD_FLAGS_IS_LINK}, - {"http://www.aol.com/", nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY} + {"http://www.aol.com/", nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY}, + {"https://www.yahoo.com/", nsIWebNavigation::LOAD_FLAGS_NONE}, }; @@ -139,7 +140,7 @@ void CNsIWebNav::LoadUriandReload() QAOutput("Run a few LoadURI() tests.", 2); - for (i=0; i < 5; i++) + for (i=0; i < 6; i++) { LoadUriTest(UrlTable[i].theUri, UrlTable[i].theFlag); switch (i) @@ -161,6 +162,9 @@ void CNsIWebNav::LoadUriandReload() case 4: ReloadTest(nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE); break; + case 5: + ReloadTest(nsIWebNavigation::LOAD_FLAGS_NONE); + break; } }