diff --git a/mozilla/embedding/qa/testembed/BrowserImpl.cpp b/mozilla/embedding/qa/testembed/BrowserImpl.cpp index bf6ef16f7ad..2a7477463de 100644 --- a/mozilla/embedding/qa/testembed/BrowserImpl.cpp +++ b/mozilla/embedding/qa/testembed/BrowserImpl.cpp @@ -135,8 +135,8 @@ NS_INTERFACE_MAP_BEGIN(CBrowserImpl) NS_INTERFACE_MAP_ENTRY(nsIStreamListener) // de: added 6/29 NS_INTERFACE_MAP_ENTRY(nsIRequestObserver) // de: added 6/29 NS_INTERFACE_MAP_ENTRY(nsITooltipListener) // de: added 7/25 + NS_INTERFACE_MAP_ENTRY(nsIURIContentListener) // NS_INTERFACE_MAP_ENTRY(nsITooltipTextProvider) // de: added 7/26 -// NS_INTERFACE_MAP_ENTRY(nsIURIContentListener) NS_INTERFACE_MAP_END //***************************************************************************** @@ -458,29 +458,93 @@ NS_IMETHODIMP CBrowserImpl::OnStopRequest(nsIRequest *request, NS_IMETHODIMP CBrowserImpl::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText) { - QAOutput("Tool Tip Listened",1); + QAOutput("nsITooltipListener->OnShowTooltip()",1); + FormatAndPrintOutput("OnShowTooltip() aXCoords = ", aXCoords, 1); + FormatAndPrintOutput("OnShowTooltip() aYCoords = ", aYCoords, 1); + FormatAndPrintOutput("OnShowTooltip() aTipText = ", *aTipText, 1); return NS_OK; } NS_IMETHODIMP CBrowserImpl::OnHideTooltip() { - QAOutput("Tool Tip Listened",1); + QAOutput("nsITooltipListener->OnHideTooltip()",1); return NS_OK; } +//***************************************************************************** +// UriContentListener -/*NS_IMETHODIMP CBrowserImpl::GetNodeText(nsIDOMNode *aNode, const PRUnichar *aTipText) -{ - QAOutput("Tool Tip Listened",1); - return NS_OK; -} - - -NS_IMETHODIMP CBrowserImpl::GetParentURIContentListener(nsIURIContentListener *myURIContentListener) +NS_IMETHODIMP CBrowserImpl:: OnStartURIOpen(nsIURI *aURI, PRBool *_retval) { - QAOutput("GetParentURIContentListener", 2); + QAOutput("nsIURIContentListener->OnStartURIOpen()",1); + + GetTheUri(aURI, 1); + *_retval = PR_TRUE; return NS_OK; } -*/ \ No newline at end of file + +NS_IMETHODIMP CBrowserImpl:: DoContent(const char *aContentType, PRBool aIsContentPreferred, nsIRequest *aRequest, nsIStreamListener **aContentHandler, PRBool *_retval) +{ + nsCString stringMsg; + + QAOutput("nsIURIContentListener->DoContent()",1); + + FormatAndPrintOutput("DoContent() content type = ", *aContentType, 1); + FormatAndPrintOutput("DoContent() aIsContentPreferred = ", aIsContentPreferred, 1); + RequestName(aRequest, stringMsg); // nsIRequest::GetName() test + // set nsIStreamListener + + *_retval = PR_TRUE; + return NS_OK; +} +NS_IMETHODIMP CBrowserImpl:: IsPreferred(const char *aContentType, char **aDesiredContentType, PRBool *_retval) +{ + QAOutput("nsIURIContentListener->IsPreferred()",1); + + FormatAndPrintOutput("IsPreferred() content type = ", *aContentType, 1); + FormatAndPrintOutput("IsPreferred() desired content type = ", **aDesiredContentType, 1); + *_retval = PR_TRUE; + return NS_OK; +} + +NS_IMETHODIMP CBrowserImpl:: CanHandleContent(const char *aContentType, PRBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval) +{ + QAOutput("nsIURIContentListener->CanHandleContent()",1); + + FormatAndPrintOutput("CanHandleContent() content type = ", *aContentType, 1); + FormatAndPrintOutput("CanHandleContent() preferred content type = ", aIsContentPreferred, 1); + FormatAndPrintOutput("CanHandleContent() desired content type = ", **aDesiredContentType, 1); + *_retval = PR_TRUE; + return NS_OK; +} + +NS_IMETHODIMP CBrowserImpl:: GetLoadCookie(nsISupports * *aLoadCookie) +{ + QAOutput("nsIURIContentListener->GetLoadCookie()",1); + + return NS_OK; +} + +NS_IMETHODIMP CBrowserImpl:: SetLoadCookie(nsISupports * aLoadCookie) +{ + QAOutput("nsIURIContentListener->SetLoadCookie()",1); + + return NS_OK; +} + +NS_IMETHODIMP CBrowserImpl:: GetParentContentListener(nsIURIContentListener * *aParentContentListener) +{ + QAOutput("nsIURIContentListener->GetParentContentListener()",1); + + return NS_OK; +} + +NS_IMETHODIMP CBrowserImpl:: SetParentContentListener(nsIURIContentListener * aParentContentListener) +{ + QAOutput("nsIURIContentListener->SetParentContentListener()",1); + + return NS_OK; +} + diff --git a/mozilla/embedding/qa/testembed/BrowserImpl.h b/mozilla/embedding/qa/testembed/BrowserImpl.h index 442893666ef..e31e5241bb5 100644 --- a/mozilla/embedding/qa/testembed/BrowserImpl.h +++ b/mozilla/embedding/qa/testembed/BrowserImpl.h @@ -56,11 +56,10 @@ class CBrowserImpl : public nsIWebProgressListener, public nsIContextMenuListener, public nsSupportsWeakReference, - public nsISHistoryListener, // de: added this in 5/11 - public nsIStreamListener, // de: added this in 6/29 - public nsITooltipListener // de: added this in 7/25 -// public nsITooltipTextProvider // de: added this in 7/25 -// public nsIURIContentListener + public nsISHistoryListener, // de: added this in 5/11/01 + public nsIStreamListener, // de: added this in 6/29/01 + public nsITooltipListener, // de: added this in 7/25/01 + public nsIURIContentListener { public: CBrowserImpl(); @@ -80,8 +79,9 @@ public: NS_DECL_NSISTREAMLISTENER // de: added this in 6/29 NS_DECL_NSIREQUESTOBSERVER // de: added this in 6/29 NS_DECL_NSITOOLTIPLISTENER // de: added this in 7/25 - //NS_DECL_NSITOOLTIPTEXTPROVIDER // de: added this in 7/25 - //NS_DECL_NSIURICONTENTLISTENER + NS_DECL_NSIURICONTENTLISTENER +// NS_DECL_NSITOOLTIPTEXTPROVIDER // de: added this in 7/25 + protected: PBROWSERFRAMEGLUE m_pBrowserFrameGlue; diff --git a/mozilla/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp b/mozilla/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp index 8ba4b438a4f..4520cf18be0 100644 --- a/mozilla/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp +++ b/mozilla/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp @@ -69,6 +69,7 @@ NS_IMETHODIMP CBrowserImpl::OnProgressChange(nsIWebProgress *progress, nsIReques PRInt32 curSelfProgress, PRInt32 maxSelfProgress, PRInt32 curTotalProgress, PRInt32 maxTotalProgress) { + // nsCString nsCString stringMsg; if(! m_pBrowserFrameGlue) @@ -118,7 +119,6 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * char theStateType[100]; int displayMode = 1; nsCString stringMsg; - nsCString totalMsg; if(! m_pBrowserFrameGlue) return NS_ERROR_FAILURE; diff --git a/mozilla/embedding/qa/testembed/QaUtils.cpp b/mozilla/embedding/qa/testembed/QaUtils.cpp index ef2ed093305..d728c7101cb 100644 --- a/mozilla/embedding/qa/testembed/QaUtils.cpp +++ b/mozilla/embedding/qa/testembed/QaUtils.cpp @@ -213,17 +213,15 @@ void FormatAndPrintOutput(const char *theInput, int theVar, int outputMode) } // stringMsg is returned in case embeddor wishes to use it in the calling method. -void RequestName(nsIRequest *request, nsCString &stringMsg, +void RequestName(nsIRequest *request, nsCString &stringMsg, int displayMethod) { nsresult rv; rv = request->GetName(stringMsg); - if(NS_SUCCEEDED(rv)) - { + if(NS_SUCCEEDED(rv)) FormatAndPrintOutput("nsIRequest: The request name = ", stringMsg.get(), displayMethod); - } else QAOutput("nsIRequest: We didn't get the request name.", displayMethod); diff --git a/mozilla/embedding/qa/testembed/Tests.cpp b/mozilla/embedding/qa/testembed/Tests.cpp index 1e991ac1539..4d13e069c11 100644 --- a/mozilla/embedding/qa/testembed/Tests.cpp +++ b/mozilla/embedding/qa/testembed/Tests.cpp @@ -275,8 +275,6 @@ void CTests::OnTestsChangeUrl() { CUrlDialog myDialog; - //nsresult rv; - if (!qaWebNav) { QAOutput("Web navigation object not found. Change URL test not performed.", 2); @@ -288,6 +286,7 @@ void CTests::OnTestsChangeUrl() QAOutput("Begin Change URL test.", 1); rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(myDialog.m_urlfield).get(), myDialog.m_flagvalue, nsnull,nsnull, nsnull); + RvTestResult(rv, "rv LoadURI() test", 1); FormatAndPrintOutput("The url = ", myDialog.m_urlfield, 2); FormatAndPrintOutput("The flag = ", myDialog.m_flagvalue, 1); @@ -305,7 +304,6 @@ void CTests::OnTestsGlobalHistory() // create instance of myHistory object. Call's XPCOM // service manager to pass the contract ID. - char *theUrl = "http://www.bogussite.com/"; CUrlDialog myDialog; PRBool theRetVal = PR_FALSE; @@ -321,13 +319,10 @@ void CTests::OnTestsGlobalHistory() if (myDialog.DoModal() == IDOK) { QAOutput("Begin IsVisited() and AddPage() tests.", 2); - - strcpy(theUrl, myDialog.m_urlfield); - - FormatAndPrintOutput("The history url = ", theUrl, 1); + FormatAndPrintOutput("The history url = ", myDialog.m_urlfield, 1); // see if url is already in the GH file (pre-AddPage() test) - rv = myHistory->IsVisited(theUrl, &theRetVal); + rv = myHistory->IsVisited(myDialog.m_urlfield, &theRetVal); RvTestResult(rv, "rv IsVisited() test", 1); FormatAndPrintOutput("The IsVisited() boolean return value = ", theRetVal, 1); @@ -338,7 +333,7 @@ void CTests::OnTestsGlobalHistory() QAOutput("URL hasn't been visited. Will execute AddPage().", 2); // adds a url to the global history file - rv = myHistory->AddPage(theUrl); + rv = myHistory->AddPage(myDialog.m_urlfield); // prints addPage() results to output file if (NS_FAILED(rv)) @@ -350,7 +345,7 @@ void CTests::OnTestsGlobalHistory() QAOutput("Valid results for AddPage(). Url added. Test passed.", 1); // checks if url was visited (post-AddPage() test) - myHistory->IsVisited(theUrl, &theRetVal); + myHistory->IsVisited(myDialog.m_urlfield, &theRetVal); if (theRetVal) QAOutput("URL is visited; post-AddPage() test. IsVisited() test passed.", 1); @@ -457,7 +452,6 @@ void CTests::OnTestsRemovehistorylistener() void CTests::OnToolsRemoveGHPage() { - char *theUrl = "http://www.bogussite.com/"; CUrlDialog myDialog; PRBool theRetVal = PR_FALSE; //nsresult rv; @@ -476,12 +470,11 @@ void CTests::OnToolsRemoveGHPage() if (myDialog.DoModal() == IDOK) { QAOutput("Begin URL removal from the GH file.", 2); - strcpy(theUrl, myDialog.m_urlfield); - myGHistory->IsVisited(theUrl, &theRetVal); + myGHistory->IsVisited(myDialog.m_urlfield, &theRetVal); if (theRetVal) { - rv = myHistory->RemovePage(theUrl); + rv = myHistory->RemovePage(myDialog.m_urlfield); RvTestResult(rv, "RemovePage() test (url removal from GH file)", 2); } else @@ -522,187 +515,18 @@ void CTests::OnToolsRemoveAllGH() void CTests::OnToolsTestYourMethod() { // place your test code here + nsWeakPtr weakling( + dont_AddRef(NS_GetWeakReference(NS_STATIC_CAST(nsIURIContentListener*, qaBrowserImpl)))); + rv = qaWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsIURIContentListener)); - // nsIWebBrowserFind methods - nsCOMPtr qaWBFind(do_GetInterface(qaWebBrowser, &rv)); - if (!qaWBFind) - QAOutput("Didn't get WebBrowserFind object.", 2); - else - RvTestResult(rv, "nsIWebBrowserFind object test", 2); + RvTestResult(rv, "AddWebBrowserListener(). nsIURIContentListener test", 2); - CUrlDialog myDialog; - - nsString searchString; - PRBool didFind = PR_FALSE; - PRBool didFindBackwards = PR_FALSE; - PRBool didWrapFind = PR_FALSE; - PRBool didEntireWord = PR_FALSE; - PRBool didMatchCase = PR_FALSE; - PRBool didSearchFrames = PR_FALSE; - if (myDialog.DoModal() == IDOK) { - - // SetSearchString() - searchString.AssignWithConversion(myDialog.m_urlfield); - rv = qaWBFind->SetSearchString(searchString.get()); - RvTestResult(rv, "nsIWebBrowserFind::SetSearchString() test", 2); - } - // GetSearchString() - nsXPIDLString stringBuf; - CString csSearchStr; - rv = qaWBFind->GetSearchString(getter_Copies(stringBuf)); - RvTestResult(rv, "nsIWebBrowserFind::GetSearchString() test", 2); - csSearchStr = stringBuf.get(); - FormatAndPrintOutput("The searched string value = ", csSearchStr, 2); - - // FindNext() - didFind = PR_TRUE; - rv = qaWBFind->FindNext(&didFind); - RvTestResult(rv, "nsIWebBrowserFind::FindNext(PR_TRUE) object test", 2); - FormatAndPrintOutput("returned didFind = ", didFind, 2); - - didFind = PR_FALSE; - rv = qaWBFind->FindNext(&didFind); - RvTestResult(rv, "nsIWebBrowserFind::FindNext(PR_FALSE) object test", 2); - FormatAndPrintOutput("returned didFind = ", didFind, 2); - - // SetFindBackwards() - didFindBackwards = PR_TRUE; - rv = qaWBFind->SetFindBackwards(didFindBackwards); - RvTestResult(rv, "nsIWebBrowserFind::SetFindBackwards(PR_TRUE) object test", 2); - - didFindBackwards = PR_FALSE; - rv = qaWBFind->SetFindBackwards(didFindBackwards); - RvTestResult(rv, "nsIWebBrowserFind::SetFindBackwards(PR_FALSE) object test", 2); - - // GetFindBackwards() - didFindBackwards = PR_TRUE; - rv = qaWBFind->GetFindBackwards(&didFindBackwards); - RvTestResult(rv, "nsIWebBrowserFind::GetFindBackwards(PR_TRUE) object test", 2); - FormatAndPrintOutput("returned didFindBackwards = ", didFindBackwards, 2); - - didFindBackwards = PR_FALSE; - rv = qaWBFind->GetFindBackwards(&didFindBackwards); - RvTestResult(rv, "nsIWebBrowserFind::GetFindBackwards(PR_FALSE) object test", 2); - FormatAndPrintOutput("returned didFindBackwards = ", didFindBackwards, 2); - - // SetWrapFind() - didWrapFind = PR_TRUE; - rv = qaWBFind->SetWrapFind(didWrapFind); - RvTestResult(rv, "nsIWebBrowserFind::SetWrapFind(PR_TRUE) object test", 2); - - didWrapFind = PR_FALSE; - rv = qaWBFind->SetWrapFind(didWrapFind); - RvTestResult(rv, "nsIWebBrowserFind::SetWrapFind(PR_FALSE) object test", 2); - - // GetWrapFind() - didWrapFind = PR_TRUE; - rv = qaWBFind->GetWrapFind(&didWrapFind); - RvTestResult(rv, "nsIWebBrowserFind::GetWrapFind(PR_TRUE) object test", 2); - FormatAndPrintOutput("returned didWrapFind = ", didWrapFind, 2); - - didWrapFind = PR_FALSE; - rv = qaWBFind->GetWrapFind(&didWrapFind); - RvTestResult(rv, "nsIWebBrowserFind::GetWrapFind(PR_FALSE) object test", 2); - FormatAndPrintOutput("returned didWrapFind = ", didWrapFind, 2); - - // SetEntireWord() - didEntireWord = PR_TRUE; - rv = qaWBFind->SetEntireWord(didEntireWord); - RvTestResult(rv, "nsIWebBrowserFind::SetEntireWord(PR_TRUE) object test", 2); - - didEntireWord = PR_FALSE; - rv = qaWBFind->SetEntireWord(didEntireWord); - RvTestResult(rv, "nsIWebBrowserFind::SetEntireWord(PR_FALSE) object test", 2); - - // GetEntireWord() - didEntireWord = PR_TRUE; - rv = qaWBFind->GetEntireWord(&didEntireWord); - RvTestResult(rv, "nsIWebBrowserFind::GetEntireWord(PR_TRUE) object test", 2); - FormatAndPrintOutput("returned didEntireWord = ", didEntireWord, 2); - - didEntireWord = PR_FALSE; - rv = qaWBFind->GetEntireWord(&didEntireWord); - RvTestResult(rv, "nsIWebBrowserFind::GetEntireWord(PR_FALSE) object test", 2); - FormatAndPrintOutput("returned didEntireWord = ", didEntireWord, 2); - - // SetMatchCase() - didMatchCase = PR_TRUE; - rv = qaWBFind->SetMatchCase(didMatchCase); - RvTestResult(rv, "nsIWebBrowserFind::SetMatchCase(PR_TRUE) object test", 2); - - didMatchCase = PR_FALSE; - rv = qaWBFind->SetMatchCase(didMatchCase); - RvTestResult(rv, "nsIWebBrowserFind::SetMatchCase(PR_FALSE) object test", 2); - - // GetMatchCase() - didMatchCase = PR_TRUE; - rv = qaWBFind->GetMatchCase(&didMatchCase); - RvTestResult(rv, "nsIWebBrowserFind::GetMatchCase(PR_TRUE) object test", 2); - FormatAndPrintOutput("returned didMatchCase = ", didMatchCase, 2); - - didMatchCase = PR_FALSE; - rv = qaWBFind->GetMatchCase(&didMatchCase); - RvTestResult(rv, "nsIWebBrowserFind::GetMatchCase(PR_FALSE) object test", 2); - FormatAndPrintOutput("returned didMatchCase = ", didMatchCase, 2); - - // SetSearchFrames() - didSearchFrames = PR_TRUE; - rv = qaWBFind->SetSearchFrames(didSearchFrames); - RvTestResult(rv, "nsIWebBrowserFind::SetSearchFrames(PR_TRUE) object test", 2); - - didSearchFrames = PR_FALSE; - rv = qaWBFind->SetSearchFrames(didSearchFrames); - RvTestResult(rv, "nsIWebBrowserFind::SetSearchFrames(PR_FALSE) object test", 2); - - // GetSearchFrames() - didSearchFrames = PR_TRUE; - rv = qaWBFind->GetSearchFrames(&didSearchFrames); - RvTestResult(rv, "nsIWebBrowserFind::GetSearchFrames(PR_TRUE) object test", 2); - FormatAndPrintOutput("returned didSearchFrames = ", didSearchFrames, 2); - - didSearchFrames = PR_FALSE; - rv = qaWBFind->GetSearchFrames(&didSearchFrames); - RvTestResult(rv, "nsIWebBrowserFind::GetSearchFrames(PR_FALSE) object test", 2); - FormatAndPrintOutput("returned didSearchFrames = ", didSearchFrames, 2); } // *********************************************************************** void CTests::OnToolsTestYourMethod2() { // place your test code here - - nsCAutoString theSpec; - nsCOMPtr theURI; - nsCOMPtr theChannel; - nsCOMPtr theLoadGroup(do_CreateInstance(NS_LOADGROUP_CONTRACTID)); - - theSpec = "javascript:document.write('TEST')"; - FormatAndPrintOutput("the uri spec = ", theSpec, 2); - - rv = NS_NewURI(getter_AddRefs(theURI), theSpec); - RvTestResult(rv, "NS_NewURI", 2); - - rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, theLoadGroup); - RvTestResult(rv, "NS_OpenURI", 2); - - nsCOMPtr listener(NS_STATIC_CAST(nsIStreamListener*, qaBrowserImpl)); - nsCOMPtr thisListener(dont_AddRef(NS_GetWeakReference(listener))); - qaWebBrowser->AddWebBrowserListener(thisListener, NS_GET_IID(nsIStreamListener)); - - // this calls nsIStreamListener::OnDataAvailable() - rv = theChannel->AsyncOpen(listener, nsnull); - RvTestResult(rv, "AsyncOpen()", 2); - - nsCOMPtr theRequest = do_QueryInterface(theChannel); - - CNsIRequest::IsPendingReqTest(theRequest); - CNsIRequest::GetStatusReqTest(theRequest); - CNsIRequest::SuspendReqTest(theRequest); - CNsIRequest::ResumeReqTest(theRequest); - CNsIRequest::CancelReqTest(theRequest); - CNsIRequest::SetLoadGroupTest(theRequest, theLoadGroup); - CNsIRequest::GetLoadGroupTest(theRequest); - } // *********************************************************************** @@ -726,6 +550,22 @@ nsCOMPtr */ } +void CTests::OnVerifybugs90195() +{ + nsWeakPtr weakling( + dont_AddRef(NS_GetWeakReference(NS_STATIC_CAST(nsITooltipListener*, qaBrowserImpl)))); + rv = qaWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsITooltipListener)); + + RvTestResult(rv, "AddWebBrowserListener(). Add Tool Tip Lstnr test", 2); + +/* nsCOMPtr oTooltipTextProvider = do_GetService(NS_TOOLTIPTEXTPROVIDER_CONTRACTID) ; + if (!oTooltipTextProvider) + AfxMEssageBox("Asdfadf"); +*/ +} + +// *********************************************************************** + BOOL CTests::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { // To handle Menu handlers add here. Don't have to do if not handling @@ -759,20 +599,6 @@ void CTests::OnInterfacesNsiselection() oSelection.OnStartTests(nCommandID); } -void CTests::OnVerifybugs90195() -{ - nsWeakPtr weakling( - dont_AddRef(NS_GetWeakReference(NS_STATIC_CAST(nsITooltipListener*, qaBrowserImpl)))); - rv = qaWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsITooltipListener)); - - RvTestResult(rv, "AddWebBrowserListener(). Add Tool Tip Lstnr test", 2); - -/* nsCOMPtr oTooltipTextProvider = do_GetService(NS_TOOLTIPTEXTPROVIDER_CONTRACTID) ; - if (!oTooltipTextProvider) - AfxMEssageBox("Asdfadf"); -*/ -} - void CTests::OnInterfacesNsiprofile() { CProfile oProfile(qaWebBrowser); diff --git a/mozilla/embedding/qa/testembed/Tests.h b/mozilla/embedding/qa/testembed/Tests.h index 8c69be77378..b4daf467167 100644 --- a/mozilla/embedding/qa/testembed/Tests.h +++ b/mozilla/embedding/qa/testembed/Tests.h @@ -83,7 +83,7 @@ public: // local test variables //nsresult rv; CString strMsg; - char theUrl[200]; + char theUrl[300]; char *uriSpec; PRBool exists; PRInt32 numEntries; diff --git a/mozilla/embedding/qa/testembed/nsIObserServ.cpp b/mozilla/embedding/qa/testembed/nsIObserServ.cpp index 3d4c751f179..4d107b312d3 100644 --- a/mozilla/embedding/qa/testembed/nsIObserServ.cpp +++ b/mozilla/embedding/qa/testembed/nsIObserServ.cpp @@ -218,7 +218,7 @@ void CnsIObserServ::EnumerateObserversTest() simpleEnum->GetNext(getter_AddRefs(observer)); rv = observer->Observe(observer, ObserverTable[i].theTopic, 0); - RvTestResult(rv, "nsIObserver() test", 2); + RvTestResult(rv, "nsIObserver() test", 1); // compare 'this' with observer object // if (this ==(CnsIObserServ *)observer) diff --git a/mozilla/embedding/qa/testembed/nsIWebBrow.cpp b/mozilla/embedding/qa/testembed/nsIWebBrow.cpp index afb463f4702..bd7b6136cf5 100644 --- a/mozilla/embedding/qa/testembed/nsIWebBrow.cpp +++ b/mozilla/embedding/qa/testembed/nsIWebBrow.cpp @@ -75,7 +75,8 @@ void CNsIWebBrowser::WBAddListener() nsWeakPtr weakling( dont_AddRef(NS_GetWeakReference(NS_STATIC_CAST(nsIContextMenuListener*, qaBrowserImpl)))); rv = qaWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsIContextMenuListener)); - RvTestResult(rv, "AddWebBrowserListener(). nsIContextMenuListener test", 2); + RvTestResult(rv, "AddWebBrowserListener(). nsIContextMenuListener test", 1); + RvTestResultDlg(rv, "AddWebBrowserListener(). nsIContextMenuListener test", true); } void CNsIWebBrowser::WBRemoveListener() @@ -85,7 +86,8 @@ void CNsIWebBrowser::WBRemoveListener() dont_AddRef(NS_GetWeakReference(NS_STATIC_CAST(nsIContextMenuListener*, qaBrowserImpl)))); rv = qaWebBrowser->RemoveWebBrowserListener(weakling, NS_GET_IID(nsIContextMenuListener)); - RvTestResult(rv, "RemoveWebBrowserListener(). nsIContextMenuListener test", 2); + RvTestResult(rv, "RemoveWebBrowserListener(). nsIContextMenuListener test", 1); + RvTestResultDlg(rv, "RemoveWebBrowserListener(). nsIContextMenuListener test"); } void CNsIWebBrowser::WBGetContainerWindow() @@ -93,7 +95,8 @@ void CNsIWebBrowser::WBGetContainerWindow() // GetContainerWindow nsCOMPtr qaWebBrowserChrome; rv = qaWebBrowser->GetContainerWindow(getter_AddRefs(qaWebBrowserChrome)); - RvTestResult(rv, "nsIWebBrowser::GetContainerWindow() test", 2); + RvTestResult(rv, "nsIWebBrowser::GetContainerWindow() test", 1); + RvTestResultDlg(rv, "nsIWebBrowser::GetContainerWindow() test"); if (!qaWebBrowserChrome) QAOutput("Didn't get web browser chrome object.", 2); else { @@ -107,7 +110,8 @@ void CNsIWebBrowser::WBSetContainerWindow() // SetContainerWindow rv = qaWebBrowser->SetContainerWindow(qaWebBrowserChrome); - RvTestResult(rv, "nsIWebBrowser::SetContainerWindow() test", 2); + RvTestResult(rv, "nsIWebBrowser::SetContainerWindow() test", 1); + RvTestResultDlg(rv, "nsIWebBrowser::SetContainerWindow() test"); } void CNsIWebBrowser::WBGetURIContentListener() @@ -115,7 +119,8 @@ void CNsIWebBrowser::WBGetURIContentListener() // GetParentURIContentListener rv = qaWebBrowser->GetParentURIContentListener(getter_AddRefs(qaURIContentListener)); - RvTestResult(rv, "nsIWebBrowser::GetParentURIContentListener() test", 2); + RvTestResult(rv, "nsIWebBrowser::GetParentURIContentListener() test", 1); + RvTestResultDlg(rv, "nsIWebBrowser::GetParentURIContentListener() test"); if (!qaURIContentListener) QAOutput("Didn't get uri content listener object.", 2); else { @@ -129,7 +134,8 @@ void CNsIWebBrowser::WBSetURIContentListener() { // SetParentURIContentListener rv = qaWebBrowser->SetParentURIContentListener(qaURIContentListener); - RvTestResult(rv, "nsIWebBrowser::SetParentURIContentListener() test", 2); + RvTestResult(rv, "nsIWebBrowser::SetParentURIContentListener() test", 1); + RvTestResultDlg(rv, "nsIWebBrowser::SetParentURIContentListener() test"); } void CNsIWebBrowser::WBGetDOMWindow() @@ -137,7 +143,8 @@ void CNsIWebBrowser::WBGetDOMWindow() // GetContentDOMWindow nsCOMPtr qaDOMWindow; rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(qaDOMWindow)); - RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow() test", 2); + RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow() test", 1); + RvTestResultDlg(rv, "nsIWebBrowser::GetContentDOMWindow() test"); if (!qaDOMWindow) QAOutput("Didn't get dom window object.", 2); else { @@ -197,56 +204,75 @@ void CNsIWebBrowser::WBSSetupProperty() // nsIWebBrowserSetup methods nsCOMPtr qaWBSetup(do_QueryInterface(qaWebBrowser, &rv)); - if (!qaWBSetup) + RvTestResult(rv, "nsIWebBrowserSetup object test", 2); + RvTestResultDlg(rv, "nsIWebBrowserSetup object test"); + + if (!qaWBSetup) { QAOutput("Didn't get WebBrowser Setup object.", 2); - else - RvTestResult(rv, "nsIWebBrowserSetup object test", 2); + return; + } rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS, PR_TRUE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_PLUGINS, PR_TRUE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_PLUGINS, PR_TRUE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_PLUGINS, PR_TRUE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS, PR_FALSE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_PLUGINS, PR_FALSE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_PLUGINS, PR_FALSE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_PLUGINS, PR_FALSE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT, PR_TRUE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_JAVASCRIPT, PR_TRUE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_JAVASCRIPT, PR_TRUE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_JAVASCRIPT, PR_TRUE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT, PR_FALSE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_JAVASCRIPT, PR_FALSE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_JAVASCRIPT, PR_FALSE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_JAVASCRIPT, PR_FALSE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS, PR_TRUE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_META_REDIRECTS, PR_TRUE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_META_REDIRECTS, PR_TRUE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_META_REDIRECTS, PR_TRUE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS, PR_FALSE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_META_REDIRECTS, PR_FALSE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_META_REDIRECTS, PR_FALSE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_META_REDIRECTS, PR_FALSE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES, PR_TRUE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_SUBFRAMES, PR_TRUE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_SUBFRAMES, PR_TRUE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_SUBFRAMES, PR_TRUE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES, PR_FALSE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_SUBFRAMES, PR_FALSE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_SUBFRAMES, PR_FALSE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_SUBFRAMES, PR_FALSE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_IMAGES, PR_TRUE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_IMAGES, PR_TRUE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_IMAGES, PR_TRUE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_IMAGES, PR_TRUE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_IMAGES, PR_FALSE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_IMAGES, PR_FALSE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_IMAGES, PR_FALSE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_ALLOW_IMAGES, PR_FALSE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_FOCUS_DOC_BEFORE_CONTENT, PR_TRUE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_FOCUS_DOC_BEFORE_CONTENT, PR_TRUE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_FOCUS_DOC_BEFORE_CONTENT, PR_TRUE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_FOCUS_DOC_BEFORE_CONTENT, PR_TRUE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_FOCUS_DOC_BEFORE_CONTENT, PR_FALSE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_FOCUS_DOC_BEFORE_CONTENT, PR_FALSE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_FOCUS_DOC_BEFORE_CONTENT, PR_FALSE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_FOCUS_DOC_BEFORE_CONTENT, PR_FALSE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_USE_GLOBAL_HISTORY, PR_TRUE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_USE_GLOBAL_HISTORY, PR_TRUE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_USE_GLOBAL_HISTORY, PR_TRUE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_USE_GLOBAL_HISTORY, PR_TRUE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_USE_GLOBAL_HISTORY, PR_FALSE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_USE_GLOBAL_HISTORY, PR_FALSE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_USE_GLOBAL_HISTORY, PR_FALSE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_USE_GLOBAL_HISTORY, PR_FALSE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER, PR_TRUE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_IS_CHROME_WRAPPER, PR_TRUE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_IS_CHROME_WRAPPER, PR_TRUE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_IS_CHROME_WRAPPER, PR_TRUE)"); rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER, PR_FALSE); - RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_IS_CHROME_WRAPPER, PR_FALSE)", 2); + RvTestResult(rv, "nsIWebBrowserSetup:SetProperty(SETUP_IS_CHROME_WRAPPER, PR_FALSE)", 1); + RvTestResultDlg(rv, "nsIWebBrowserSetup:SetProperty(SETUP_IS_CHROME_WRAPPER, PR_FALSE)"); } \ No newline at end of file diff --git a/mozilla/embedding/qa/testembed/nsIWebProg.cpp b/mozilla/embedding/qa/testembed/nsIWebProg.cpp index f704ae904bf..fcc44a01047 100644 --- a/mozilla/embedding/qa/testembed/nsIWebProg.cpp +++ b/mozilla/embedding/qa/testembed/nsIWebProg.cpp @@ -79,6 +79,7 @@ nsIWebProgress * CnsiWebProg::GetWebProgObject() { nsCOMPtr qaIReq(do_QueryInterface(qaWebBrowser)); nsCOMPtr qaWebProgress(do_GetInterface(qaIReq)); + if (!qaWebProgress) { QAOutput("Didn't get web progress object.", 2); return NULL; @@ -101,8 +102,9 @@ void CnsiWebProg::AddWebProgLstnr(PRUint32 theFlag) nsCOMPtr listener(NS_STATIC_CAST(nsIWebProgressListener*, qaBrowserImpl)); rv = qaWebProgress->AddProgressListener(listener, theFlag); // StoreWebProgFlag(theFlag); - RvTestResult(rv, "nsIWebProgress::AddProgressListener() test", 2); - FormatAndPrintOutput("WebProgressListener flag = ", flagName, 2); + RvTestResult(rv, "nsIWebProgress::AddProgressListener() test", 1); + RvTestResultDlg(rv, "nsIWebProgress::AddProgressListener() test", true); + FormatAndPrintOutput("WebProgressListener flag = ", flagName, 1); } void CnsiWebProg::RemoveWebProgLstnr() @@ -112,7 +114,8 @@ void CnsiWebProg::RemoveWebProgLstnr() qaWebProgress = GetWebProgObject(); nsCOMPtr listener(NS_STATIC_CAST(nsIWebProgressListener*, qaBrowserImpl)); rv = qaWebProgress->RemoveProgressListener(listener); - RvTestResult(rv, "nsIWebProgress::RemoveProgressListener() test", 2); + RvTestResult(rv, "nsIWebProgress::RemoveProgressListener() test", 1); + RvTestResultDlg(rv, "nsIWebProgress::RemoveProgressListener() test"); } void CnsiWebProg::GetTheDOMWindow() @@ -122,10 +125,10 @@ void CnsiWebProg::GetTheDOMWindow() qaWebProgress = GetWebProgObject(); nsCOMPtr qaDOMWindow; rv = qaWebProgress->GetDOMWindow(getter_AddRefs(qaDOMWindow)); - if (!qaWebProgress) + RvTestResult(rv, "nsIWebProgress::GetDOMWindow() test", 1); + RvTestResultDlg(rv, "nsIWebProgress::GetDOMWindow() test"); + if (!qaDOMWindow) QAOutput("Didn't get DOM Window object.", 2); - else - RvTestResult(rv, "nsIWebProgress::GetDOMWindow() test", 2); } void CnsiWebProg::ConvertWPFlagToString(PRUint32 theFlag, @@ -201,9 +204,7 @@ void CnsiWebProg::OnStartTests(UINT nMenuID) break ; case ID_INTERFACES_NSIWEBPROGRESS_ADDPROGRESSLISTENER : if (myDialog.DoModal() == IDOK) - { AddWebProgLstnr(myDialog.m_wpFlagValue); - } break ; case ID_INTERFACES_NSIWEBPROGRESS_REMOVEPROGRESSLISTENER : RemoveWebProgLstnr(); diff --git a/mozilla/embedding/qa/testembed/nsiHistory.cpp b/mozilla/embedding/qa/testembed/nsiHistory.cpp index 4b410994491..f2284f0b4fc 100644 --- a/mozilla/embedding/qa/testembed/nsiHistory.cpp +++ b/mozilla/embedding/qa/testembed/nsiHistory.cpp @@ -102,8 +102,11 @@ void CNsIHistory::OnStartTests(UINT nMenuID) // NS_SHISTORYLISTENER_CONTRACTID // get Session History through web nav iface - if (qaWebNav) - qaWebNav->GetSessionHistory( getter_AddRefs(theSessionHistory)); + if (qaWebNav) { + rv = qaWebNav->GetSessionHistory( getter_AddRefs(theSessionHistory)); + RvTestResult(rv, "GetSessionHistory() object", 1); + RvTestResultDlg(rv, "GetSessionHistory() object", true); + } if (!theSessionHistory) { @@ -111,7 +114,7 @@ void CNsIHistory::OnStartTests(UINT nMenuID) return; } else { - QAOutput("theSessionHistory object was created.", 2); + QAOutput("theSessionHistory object was created.", 1); theSessionHistory->GetCount(&numEntries); } @@ -146,7 +149,9 @@ void CNsIHistory::OnStartTests(UINT nMenuID) { FormatAndPrintOutput("the index = ", theIndex, 2); - theSessionHistory->GetEntryAtIndex(theIndex, PR_FALSE, getter_AddRefs(theHistoryEntry)); + rv = theSessionHistory->GetEntryAtIndex(theIndex, PR_FALSE, getter_AddRefs(theHistoryEntry)); + RvTestResult(rv, "GetEntryAtIndex() test", 1); + RvTestResultDlg(rv, "GetEntryAtIndex() test"); if (!theHistoryEntry) { QAOutput("We didn't get the History Entry object. No more tests performed.", 1); @@ -165,10 +170,13 @@ void CNsIHistory::OnStartTests(UINT nMenuID) //GetSHistoryEnumerator(getter_AddRefs(theSimpleEnum)); rv = theSessionHistory->GetSHistoryEnumerator(getter_AddRefs(theSimpleEnum)); - if (!theSimpleEnum) + RvTestResult(rv, "GetSHistoryEnumerator() (SHistoryEnumerator attribute) test", 1); + RvTestResultDlg(rv, "GetSHistoryEnumerator() test"); + + if (!theSimpleEnum) { QAOutput("theSimpleEnum for GetSHistoryEnumerator() invalid. Test failed.", 1); - else - RvTestResult(rv, "GetSHistoryEnumerator() (SHistoryEnumerator attribute) test", 2); + return; + } SimpleEnumTest(theSimpleEnum); break ; @@ -201,11 +209,6 @@ void CNsIHistory::RunAllTests() nsCOMPtr theSessionHistory; nsCOMPtr theHistoryEntry; - //nsCOMPtr theUri; - // do_QueryInterface - // NS_HISTORYENTRY_CONTRACTID - // NS_SHISTORYLISTENER_CONTRACTID - // get Session History through web nav iface if (qaWebNav) qaWebNav->GetSessionHistory( getter_AddRefs(theSessionHistory)); @@ -233,7 +236,10 @@ void CNsIHistory::RunAllTests() QAOutput("Start nsiHistoryEntry tests.", 2); // get theHistoryEntry object - theSessionHistory->GetEntryAtIndex(0, PR_FALSE, getter_AddRefs(theHistoryEntry)); + rv = theSessionHistory->GetEntryAtIndex(0, PR_FALSE, getter_AddRefs(theHistoryEntry)); + RvTestResult(rv, "GetEntryAtIndex() test", 1); + RvTestResultDlg(rv, "GetEntryAtIndex() test"); + if (!theHistoryEntry) QAOutput("We didn't get the History Entry object.", 1); else @@ -280,12 +286,13 @@ void CNsIHistory::RunAllTests() // GetSHEnumTest(theSessionHistory, theSimpleEnum); rv = theSessionHistory->GetSHistoryEnumerator(getter_AddRefs(theSimpleEnum)); + RvTestResult(rv, "GetSHistoryEnumerator() (SHistoryEnumerator attribute) test", 1); + RvTestResultDlg(rv, "GetSHistoryEnumerator() (SHistoryEnumerator attribute) test"); + if (!theSimpleEnum) QAOutput("theSimpleEnum for GetSHistoryEnumerator() invalid. Test failed.", 1); else - RvTestResult(rv, "GetSHistoryEnumerator() (SHistoryEnumerator attribute) test", 2); - - SimpleEnumTest(theSimpleEnum); + SimpleEnumTest(theSimpleEnum); // PurgeHistory() test @@ -298,29 +305,36 @@ void CNsIHistory::RunAllTests() void CNsIHistory::GetCountTest(nsISHistory *theSessionHistory, PRInt32 *numEntries) { rv = theSessionHistory->GetCount(numEntries); - if (*numEntries < 0) + if (*numEntries < 0) QAOutput("numEntries for GetCount() < 0. Test failed.", 1); else { FormatAndPrintOutput("GetCount():number of entries = ", *numEntries, 2); - RvTestResult(rv, "GetCount() (count attribute) test", 2); + RvTestResult(rv, "GetCount() (count attribute) test", 1); + RvTestResultDlg(rv, "GetCount() (count attribute) test"); } } void CNsIHistory::GetIndexTest(nsISHistory *theSessionHistory, PRInt32 *theIndex) { rv = theSessionHistory->GetIndex(theIndex); - if (*theIndex <0) + if (*theIndex <0) QAOutput("theIndex for GetIndex() < 0. Test failed.", 1); else { FormatAndPrintOutput("GetIndex():the index = ", *theIndex, 2); - RvTestResult(rv, "GetIndex() (index attribute) test", 2); + RvTestResult(rv, "GetIndex() (index attribute) test", 1); + RvTestResultDlg(rv, "GetIndex() (index attribute) test"); } } void CNsIHistory::SetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 theMaxLength) { rv = theSessionHistory->SetMaxLength(theMaxLength); - RvTestResult(rv, "SetMaxLength() (MaxLength attribute) test", 2); + if (theMaxLength < 0) + QAOutput("theMaxLength for SetMaxLength() < 0. Test failed.", 1); + else { + RvTestResult(rv, "SetMaxLength() (MaxLength attribute) test", 1); + RvTestResultDlg(rv, "SetMaxLength() (MaxLength attribute) test"); + } } void CNsIHistory::GetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 *theMaxLength) @@ -330,7 +344,8 @@ void CNsIHistory::GetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 *theM QAOutput("theMaxLength for GetMaxLength() < 0. Test failed.", 1); else { FormatAndPrintOutput("GetMaxLength():theMaxLength = ", *theMaxLength, 2); - RvTestResult(rv, "GetMaxLength() (MaxLength attribute) test", 2); + RvTestResult(rv, "GetMaxLength() (MaxLength attribute) test", 1); + RvTestResultDlg(rv, "GetMaxLength() (MaxLength attribute) test"); } } @@ -356,11 +371,12 @@ void CNsIHistory::GetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 *theM void CNsIHistory::GetURIHistTest(nsIHistoryEntry* theHistoryEntry) { rv = theHistoryEntry->GetURI(getter_AddRefs(theUri)); + RvTestResult(rv, "GetURI() (URI attribute) test", 1); + RvTestResultDlg(rv, "GetURI() (URI attribute) test"); if (!theUri) QAOutput("theUri for GetURI() invalid. Test failed.", 1); else { - RvTestResult(rv, "GetURI() (URI attribute) test", 1); nsCAutoString uriString; rv = theUri->GetSpec(uriString); if (NS_FAILED(rv)) @@ -376,12 +392,13 @@ void CNsIHistory::GetTitleHistTest(nsIHistoryEntry* theHistoryEntry) const char * titleCString; rv = theHistoryEntry->GetTitle(getter_Copies(theTitle)); + RvTestResult(rv, "GetTitle() (title attribute) test", 1); + RvTestResultDlg(rv, "GetTitle() (title attribute) test"); if (!theTitle) { QAOutput("theTitle for GetTitle() is blank. Test failed.", 1); return; } - else - RvTestResult(rv, "GetTitle() (title attribute) test", 1); + titleCString = NS_ConvertUCS2toUTF8(theTitle).get(); FormatAndPrintOutput("The title = ", (char *)titleCString, 2); @@ -394,6 +411,7 @@ void CNsIHistory::GetIsSubFrameTest(nsIHistoryEntry* theHistoryEntry) rv = theHistoryEntry->GetIsSubFrame(&isSubFrame); RvTestResult(rv, "GetIsSubFrame() (isSubFrame attribute) test", 1); + RvTestResultDlg(rv, "GetIsSubFrame() (isSubFrame attribute) test"); FormatAndPrintOutput("The subFrame boolean value = ", isSubFrame, 2); } @@ -424,6 +442,8 @@ void CNsIHistory::SimpleEnumTest(nsISimpleEnumerator *theSimpleEnum) if (!nextHistoryEntry) continue; rv = nextHistoryEntry->GetURI(getter_AddRefs(theUri)); + RvTestResult(rv, "theSimpleEnum nsIHistoryEntry->GetURI() test", 1); + RvTestResultDlg(rv, "theSimpleEnum nsIHistoryEntry->GetURI() test"); nsCAutoString uriString; rv = theUri->GetSpec(uriString); if (NS_FAILED(rv)) @@ -436,8 +456,9 @@ void CNsIHistory::SimpleEnumTest(nsISimpleEnumerator *theSimpleEnum) void CNsIHistory::PurgeHistoryTest(nsISHistory* theSessionHistory, PRInt32 numEntries) { rv = theSessionHistory->PurgeHistory(numEntries); - RvTestResult(rv, "PurgeHistory() test", 2); - FormatAndPrintOutput("PurgeHistory(): num requested entries for removal = ", numEntries, 2); + RvTestResult(rv, "PurgeHistory() test", 1); + RvTestResultDlg(rv, "PurgeHistory() test"); + FormatAndPrintOutput("PurgeHistory(): num requested entries for removal = ", numEntries, 1); } void CNsIHistory::RunAllHistoryEntryTests() @@ -451,11 +472,6 @@ void CNsIHistory::RunAllHistoryEntryTests() nsCOMPtr theSessionHistory; nsCOMPtr theHistoryEntry; - //nsCOMPtr theUri; - // do_QueryInterface - // NS_HISTORYENTRY_CONTRACTID - // NS_SHISTORYLISTENER_CONTRACTID - // get Session History through web nav iface if (qaWebNav) qaWebNav->GetSessionHistory( getter_AddRefs(theSessionHistory)); @@ -466,7 +482,7 @@ void CNsIHistory::RunAllHistoryEntryTests() return; } else - QAOutput("theSessionHistory object was created.", 2); + QAOutput("theSessionHistory object was created.", 1); theSessionHistory->GetEntryAtIndex(0, PR_FALSE, getter_AddRefs(theHistoryEntry)); if (!theHistoryEntry)