diff --git a/mozilla/embedding/qa/testembed/BrowserImpl.cpp b/mozilla/embedding/qa/testembed/BrowserImpl.cpp index 613976a32bc..b1ec197083f 100644 --- a/mozilla/embedding/qa/testembed/BrowserImpl.cpp +++ b/mozilla/embedding/qa/testembed/BrowserImpl.cpp @@ -153,6 +153,7 @@ NS_IMETHODIMP CBrowserImpl::GetWebBrowser(nsIWebBrowser** aWebBrowser) *aWebBrowser = mWebBrowser; NS_IF_ADDREF(*aWebBrowser); + CQaUtils::QAOutput("nsIWebBrowserChrome::GetWebBrowser().", 1); return NS_OK; } @@ -165,6 +166,7 @@ NS_IMETHODIMP CBrowserImpl::SetWebBrowser(nsIWebBrowser* aWebBrowser) NS_ENSURE_ARG_POINTER(aWebBrowser); mWebBrowser = aWebBrowser; + CQaUtils::QAOutput("nsIWebBrowserChrome::SetWebBrowser().", 1); return NS_OK; } @@ -186,13 +188,22 @@ NS_IMETHODIMP CBrowserImpl::SetChromeFlags(PRUint32 aChromeMask) NS_IMETHODIMP CBrowserImpl::CreateBrowserWindow(PRUint32 chromeMask, PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY, nsIWebBrowser **aWebBrowser) { if(! m_pBrowserFrameGlue) + { + CQaUtils::QAOutput("nsIWebBrowserChrome::CreateBrowserWindow(). Browser Window not created.", 1); return NS_ERROR_FAILURE; + } if(m_pBrowserFrameGlue->CreateNewBrowserFrame(chromeMask, aX, aY, aCX, aCY, aWebBrowser)) + { + CQaUtils::QAOutput("nsIWebBrowserChrome::CreateBrowserWindow(): Browser Window created.", 1); return NS_OK; + } else + { + CQaUtils::QAOutput("nsIWebBrowserChrome::CreateBrowserWindow(): Browser Window not created.", 1); return NS_ERROR_FAILURE; + } } // Will get called in response to JavaScript window.close() @@ -200,9 +211,13 @@ NS_IMETHODIMP CBrowserImpl::CreateBrowserWindow(PRUint32 chromeMask, PRInt32 aX, NS_IMETHODIMP CBrowserImpl::DestroyBrowserWindow() { if(! m_pBrowserFrameGlue) + { + CQaUtils::QAOutput("nsIWebBrowserChrome::DestroyBrowserWindow(): Browser Window not destroyed.", 1); return NS_ERROR_FAILURE; + } m_pBrowserFrameGlue->DestroyBrowserFrame(); + CQaUtils::QAOutput("nsIWebBrowserChrome::DestroyBrowserWindow(): Browser Window destroyed.", 1); return NS_OK; } @@ -222,6 +237,7 @@ NS_IMETHODIMP CBrowserImpl::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY) return NS_ERROR_FAILURE; m_pBrowserFrameGlue->SetBrowserFrameSize(aCX, aCY); + CQaUtils::QAOutput("nsIWebBrowserChrome::SizeBrowserTo(): Browser resized.", 1); return NS_OK; } diff --git a/mozilla/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp b/mozilla/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp index fe766108af1..15ba026d7d0 100644 --- a/mozilla/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp +++ b/mozilla/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp @@ -33,6 +33,7 @@ #include "BrowserFrm.h" #include "QaUtils.h" +#include "Tests.h" //***************************************************************************** // CBrowserImpl::nsIWebProgressListener Implementation @@ -52,7 +53,6 @@ NS_IMETHODIMP CBrowserImpl::OnProgressChange(nsIWebProgress *progress, nsIReques PRInt32 curSelfProgress, PRInt32 maxSelfProgress, PRInt32 curTotalProgress, PRInt32 maxTotalProgress) { - nsCString stringMsg; if(! m_pBrowserFrameGlue) @@ -69,8 +69,13 @@ NS_IMETHODIMP CBrowserImpl::OnProgressChange(nsIWebProgress *progress, nsIReques nProgressMax = LONG_MAX; if (curSelfProgress > maxSelfProgress) + { CQaUtils::QAOutput("nsIWebProgLstnr::OnProgressChange(): Self progress complete!", 1); + // web progress DOMWindow test + CQaUtils::WebProgDOMWindowTest(progress, "OnProgressChange()", 1); + } + if (nProgress > nProgressMax) { nProgress = nProgressMax; // Progress complete @@ -89,7 +94,7 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * { char theDocType[100]; char theStateType[100]; - char theTotalString[1000]; +// char theTotalString[1000]; int displayMode = 1; nsCString stringMsg; nsCString totalMsg; @@ -99,7 +104,7 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * CQaUtils::QAOutput("Entering nsIWebProgLstnr::OnStateChange()."); - CQaUtils::RequestName(request, stringMsg); + CQaUtils::RequestName(request, stringMsg); // nsIRequest::GetName() test if (progressStateFlags & STATE_IS_DOCUMENT) // DOCUMENT { @@ -112,6 +117,10 @@ 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) @@ -130,16 +139,39 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * strcpy(theStateType, "STATE_STOP"); displayMode = 2; + CTests::SuspendReqTest(request); // nsIRequest::Suspend() test + CQaUtils::QAOutput("Between Suspend and Resume."); + CTests::ResumeReqTest(request); // nsIRequest::Resume() test + m_pBrowserFrameGlue->UpdateBusyState(PR_FALSE); m_pBrowserFrameGlue->UpdateProgress(0, 100); // Clear the prog bar m_pBrowserFrameGlue->UpdateStatusBarText(nsnull); // Clear the status bar + + // web progress DOMWindow test + CQaUtils::WebProgDOMWindowTest(progress, "OnStateChange()", 1); + } } // end STATE_IS_DOCUMENT if (progressStateFlags & STATE_IS_REQUEST) // REQUEST { strcpy(theDocType, "REQUEST"); if (progressStateFlags & STATE_START) + { strcpy(theStateType, "STATE_START"); + + // nsIRequest tests + CTests::IsPendingReqTest(request); + CTests::GetStatusReqTest(request); + + 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"); @@ -194,6 +226,8 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest * totalMsg += theDocType; totalMsg += ", "; totalMsg += stringMsg; + totalMsg += ", status = "; + totalMsg.AppendInt(status); CQaUtils::QAOutput(totalMsg.get(), displayMode); CQaUtils::QAOutput("Exiting nsIWebProgLstnr::OnStateChange().\r\n"); @@ -257,9 +291,14 @@ CBrowserImpl::OnStatusChange(nsIWebProgress* aWebProgress, CQaUtils::QAOutput("Entering nsIWebProgLstnr::OnStatusChange()."); - CQaUtils::RequestName(aRequest, stringMsg); + // status result test +// CQaUtils::RvTestResult(aStatus, "OnStatusChange(): status result test", 2); + + // web progress DOMWindow test + CQaUtils::WebProgDOMWindowTest(aWebProgress, "OnStatusChange()", 1); + m_pBrowserFrameGlue->UpdateStatusBarText(aMessage); CQaUtils::QAOutput("Exiting nsIWebProgLstnr::OnStatusChange().\r\n"); @@ -279,6 +318,9 @@ CBrowserImpl::OnSecurityChange(nsIWebProgress *aWebProgress, CQaUtils::RequestName(aRequest, stringMsg); + // web progress DOMWindow test + CQaUtils::WebProgDOMWindowTest(aWebProgress, "OnSecurityChange()", 1); + CQaUtils::QAOutput("Exiting nsIWebProgLstnr::OnSecurityChange().\r\n"); return NS_OK; diff --git a/mozilla/embedding/qa/testembed/QaUtils.cpp b/mozilla/embedding/qa/testembed/QaUtils.cpp index 5ea62a58288..c88f2f0c63a 100644 --- a/mozilla/embedding/qa/testembed/QaUtils.cpp +++ b/mozilla/embedding/qa/testembed/QaUtils.cpp @@ -59,6 +59,23 @@ CQaUtils::~CQaUtils() // ***************** Local QA Methods ****************** // *********************************************************************** + +void CQaUtils::RvTestResult(nsresult rv, const char *pLine, int displayMethod) +{ + // note: default displayMethod = 1 in .h file + + CString strLine = pLine; + char theOutputLine[100]; + + if (NS_FAILED(rv)) + strLine += " failed."; + else + strLine += " passed."; + + strcpy(theOutputLine, strLine); + QAOutput(theOutputLine, displayMethod); +} + void CQaUtils::WriteToOutputFile(const char *pLine) { CStdioFile myFile; @@ -84,22 +101,6 @@ void CQaUtils::WriteToOutputFile(const char *pLine) } } -void CQaUtils::RvTestResult(nsresult rv, const char *pLine, int displayMethod) -{ - // note: default displayMethod = 1 in .h file - - CString strLine = pLine; - char theOutputLine[100]; - - if (NS_FAILED(rv)) - strLine += " failed."; - else - strLine += " passed."; - - strcpy(theOutputLine, strLine); - QAOutput(theOutputLine, displayMethod); -} - void CQaUtils::QAOutput(const char *pLine, int displayMethod) { // note: default displayMethod = 1 in .h file @@ -118,12 +119,12 @@ void CQaUtils::QAOutput(const char *pLine, int displayMethod) //#endif } -void CQaUtils::FormatAndPrintOutput(const char *theOutput, const char *theVar, int outputMode) +void CQaUtils::FormatAndPrintOutput(const char *theInput, const char *theVar, int outputMode) { nsCString outStr; CString strMsg; - outStr = theOutput; + outStr = theInput; outStr += theVar; strMsg = outStr.get(); @@ -143,7 +144,9 @@ void CQaUtils::FormatAndPrintOutput(const char *theOutput, const char *theVar, i } } -void CQaUtils::RequestName(nsIRequest *request, nsCString &stringMsg) +// stringMsg is returned in case embeddor wishes to use it in the calling method. +void CQaUtils::RequestName(nsIRequest *request, nsCString &stringMsg, + int displayMethod) { nsXPIDLString theReqName; nsresult rv; @@ -152,10 +155,29 @@ void CQaUtils::RequestName(nsIRequest *request, nsCString &stringMsg) if(NS_SUCCEEDED(rv)) { stringMsg.AssignWithConversion(theReqName); - FormatAndPrintOutput("The request name = ", stringMsg.get(), 1); + FormatAndPrintOutput("nsIRequest: The request name = ", stringMsg.get(), displayMethod); } else - QAOutput("We didn't get the request name."); + QAOutput("nsIRequest: We didn't get the request name.", displayMethod); } +void CQaUtils::WebProgDOMWindowTest(nsIWebProgress *progress, const char *inString, + int displayMethod) +{ + nsresult rv; + nsCString totalStr1, totalStr2; + nsCOMPtr theDOMWindow; + + totalStr1 = inString; + totalStr1 += ": Didn't get the DOMWindow. Test failed."; + + totalStr2 = inString; + totalStr2 += ": nsIWebProgress:DOMWindow attribute test"; + + rv = progress->GetDOMWindow(getter_AddRefs(theDOMWindow)); + if (!theDOMWindow) + QAOutput(totalStr1.get(), displayMethod); + else + RvTestResult(rv, totalStr2, displayMethod); +} diff --git a/mozilla/embedding/qa/testembed/QaUtils.h b/mozilla/embedding/qa/testembed/QaUtils.h index aab5d516584..33adcce33b3 100644 --- a/mozilla/embedding/qa/testembed/QaUtils.h +++ b/mozilla/embedding/qa/testembed/QaUtils.h @@ -44,11 +44,13 @@ public: CQaUtils(); virtual ~CQaUtils(); - void static WriteToOutputFile(const char *); void static RvTestResult(nsresult, const char *, int displayMethod=1); + void static WriteToOutputFile(const char *); void static QAOutput(const char *pLine, int displayMethod=1); void static FormatAndPrintOutput(const char *, const char *, int); - void static RequestName(nsIRequest *, nsCString &); + void static RequestName(nsIRequest *, nsCString &, int displayMethod=1); + void static WebProgDOMWindowTest(nsIWebProgress *, const char *, + int displayMethod=1); // Some helper methods diff --git a/mozilla/embedding/qa/testembed/StdAfx.h b/mozilla/embedding/qa/testembed/StdAfx.h index 4240b01fd56..238aa859f3b 100644 --- a/mozilla/embedding/qa/testembed/StdAfx.h +++ b/mozilla/embedding/qa/testembed/StdAfx.h @@ -95,9 +95,11 @@ #include "nsIGlobalHistory.h" #include "nsIBrowserHistory.h" #include "nsILocalFile.h" - #include "nsIProfile.h" #include "nsIDOMDocument.h" +#include "nsIDOMDocumentType.h" +#include "nsIURIContentListener.h" + //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. diff --git a/mozilla/embedding/qa/testembed/Tests.cpp b/mozilla/embedding/qa/testembed/Tests.cpp index cbe43cc5e2c..4fc52729f18 100644 --- a/mozilla/embedding/qa/testembed/Tests.cpp +++ b/mozilla/embedding/qa/testembed/Tests.cpp @@ -19,6 +19,8 @@ * * Contributor(s): * David Epstein + * Dharma Sirnapalli + * Ashish Bhatt */ // File Overview.... @@ -48,7 +50,6 @@ static UINT WM_FINDMSG = ::RegisterWindowMessage(FINDMSGSTRING); BEGIN_MESSAGE_MAP(CTests, CWnd) //{{AFX_MSG_MAP(CTests) - ON_COMMAND(ID_TESTS_CHANGEURL, OnTestsChangeUrl) ON_COMMAND(ID_TESTS_GLOBALHISTORY, OnTestsGlobalHistory) ON_COMMAND(ID_TESTS_CREATEFILE, OnTestsCreateFile) @@ -58,10 +59,11 @@ BEGIN_MESSAGE_MAP(CTests, CWnd) ON_COMMAND(ID_INTERFACES_NSIFILE, OnInterfacesNsifile) ON_COMMAND(ID_INTERFACES_NSISHISTORY, OnInterfacesNsishistory) ON_COMMAND(ID_INTERFACES_NSIWEBNAV, OnInterfacesNsiwebnav) + ON_COMMAND(ID_INTERFACES_NSIREQUEST, OnInterfacesNsirequest) ON_COMMAND(ID_TOOLS_REMOVEGHPAGE, OnToolsRemoveGHPage) ON_COMMAND(ID_TOOLS_REMOVEALLGH, OnToolsRemoveAllGH) - - // DHARMA + ON_COMMAND(ID_TOOLS_TESTYOURMETHOD, OnToolsTestYourMethod) + ON_COMMAND(ID_TOOLS_TESTYOURMETHOD2, OnToolsTestYourMethod2) ON_COMMAND(ID_CLIPBOARDCMD_PASTE, OnPasteTest) ON_COMMAND(ID_CLIPBOARDCMD_COPYSELECTION, OnCopyTest) ON_COMMAND(ID_CLIPBOARDCMD_SELECTALL, OnSelectAllTest) @@ -71,8 +73,6 @@ BEGIN_MESSAGE_MAP(CTests, CWnd) ON_COMMAND(ID_CLIPBOARDCMD_CANCOPYSELECTION, canCopySelectionTest) ON_COMMAND(ID_CLIPBOARDCMD_CANCUTSELECTION, canCutSelectionTest) ON_COMMAND(ID_CLIPBOARDCMD_CANPASTE, canPasteTest) - // DHARMA - //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -93,7 +93,7 @@ CTests::~CTests() } -// de: Start QA test cases here +// depstein: Start QA test cases here // ********************************************************* // ********************************************************* @@ -218,7 +218,6 @@ void CTests::OnTestsGlobalHistory() } - // ********************************************************* void CTests::OnTestsCreateFile() @@ -369,6 +368,18 @@ void CTests::OnToolsRemoveAllGH() } +// *********************************************************************** +void CTests::OnToolsTestYourMethod() +{ + // place your test code here +} + +// *********************************************************************** +void CTests::OnToolsTestYourMethod2() +{ + // place your test code here +} + // *********************************************************************** // ************************** Interface Tests **************************** // *********************************************************************** @@ -506,7 +517,7 @@ void CTests::OnInterfacesNsishistory() nsresult rv; PRInt32 numEntries = 5; PRInt32 theIndex; - PRInt32 theMaxLength = 100; + PRInt32 theMaxLength = 1; CString shString; @@ -537,13 +548,10 @@ void CTests::OnInterfacesNsishistory() GetIndexTest(theSessionHistory, &theIndex); // test maxLength attribute in nsISHistory.idl - GetMaxLength(theSessionHistory, theMaxLength); - SetMaxLength(theSessionHistory, &theMaxLength); + SetMaxLengthTest(theSessionHistory, theMaxLength); + GetMaxLengthTest(theSessionHistory, &theMaxLength); - CQaUtils::QAOutput("Start nsiHistoryEntry tests.", 2); - - strMsg.Format("numEntries = %d", numEntries); - AfxMessageBox(strMsg); + CQaUtils::QAOutput("Start nsiHistoryEntry tests.", 2); // get theHistoryEntry object theSessionHistory->GetEntryAtIndex(0, PR_FALSE, getter_AddRefs(theHistoryEntry)); @@ -602,8 +610,11 @@ void CTests::GetCountTest(nsISHistory *theSessionHistory, PRInt32 *numEntries) rv = theSessionHistory->GetCount(numEntries); if (!(*numEntries)) CQaUtils::QAOutput("numEntries for GetCount() invalid. Test failed.", 1); - else + else { + strMsg.Format("numEntries = %d", *numEntries); + AfxMessageBox(strMsg); CQaUtils::RvTestResult(rv, "GetCount() (count attribute) test", 2); + } } void CTests::GetIndexTest(nsISHistory *theSessionHistory, PRInt32 *theIndex) @@ -615,19 +626,22 @@ void CTests::GetIndexTest(nsISHistory *theSessionHistory, PRInt32 *theIndex) CQaUtils::RvTestResult(rv, "GetIndex() (index attribute) test", 2); } -void CTests::GetMaxLength(nsISHistory *theSessionHistory, PRInt32 theMaxLength) +void CTests::SetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 theMaxLength) { rv = theSessionHistory->SetMaxLength(theMaxLength); CQaUtils::RvTestResult(rv, "SetMaxLength() (MaxLength attribute) test", 2); } -void CTests::SetMaxLength(nsISHistory *theSessionHistory, PRInt32 *theMaxLength) +void CTests::GetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 *theMaxLength) { rv = theSessionHistory->GetMaxLength(theMaxLength); if (!(*theMaxLength)) CQaUtils::QAOutput("theMaxLength for GetMaxLength() invalid. Test failed.", 1); - else + else { + strMsg.Format("theMaxLength = %d", *theMaxLength); + AfxMessageBox(strMsg); CQaUtils::RvTestResult(rv, "GetMaxLength() (MaxLength attribute) test", 2); + } } /* @@ -760,7 +774,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); @@ -779,7 +793,7 @@ void CTests::OnInterfacesNsiwebnav() } // *********************************************************************** -// Individual nsISHistory tests +// Individual nsIWebNavigation tests void CTests::CanGoBackTest() { @@ -915,17 +929,23 @@ void CTests::StopUriTest(char *theUrl) void CTests::GetDocumentTest() { - nsCOMPtr theDocument; + nsCOMPtr theDocument; + nsCOMPtr theDocType; + rv = qaWebNav->GetDocument(getter_AddRefs(theDocument)); if (!theDocument) CQaUtils::QAOutput("We didn't get the document. Test failed.", 2); else CQaUtils::RvTestResult(rv, "GetDocument() test", 2); + + rv = theDocument->GetDoctype(getter_AddRefs(theDocType)); + CQaUtils::RvTestResult(rv, "nsIDOMDocument::GetDoctype() for nsIWebNav test", 2); } void CTests::GetCurrentURITest() { nsCOMPtr theUri; + rv = qaWebNav->GetCurrentURI(getter_AddRefs(theUri)); if (!theUri) CQaUtils::QAOutput("We didn't get the URI. Test failed.", 2); @@ -934,18 +954,130 @@ void CTests::GetCurrentURITest() char *uriSpec; rv = theUri->GetSpec(&uriSpec); + CQaUtils::RvTestResult(rv, "nsIURI::GetSpec() for nsIWebNav test", 1); - CQaUtils::FormatAndPrintOutput("the uri = ", uriSpec, 2); + CQaUtils::FormatAndPrintOutput("the nsIWebNav uri = ", uriSpec, 2); } void CTests::GetSHTest() { + PRInt32 numOfElements; + nsCOMPtr theSessionHistory; rv = qaWebNav->GetSessionHistory(getter_AddRefs(theSessionHistory)); if (!theSessionHistory) CQaUtils::QAOutput("We didn't get the session history. Test failed.", 2); else CQaUtils::RvTestResult(rv, "GetSessionHistory() test", 2); + + rv = theSessionHistory->GetCount(&numOfElements); + CQaUtils::RvTestResult(rv, "nsISHistory::GetCount() for nsIWebNav test", 1); + + strMsg.Format("the sHist entry count = %d", numOfElements); + AfxMessageBox(strMsg); +} + +// *********************************************************************** +// *********************************************************************** +// nsIRequest iface + + +void CTests::OnInterfacesNsirequest() +{ + CUrlDialog myDialog; + nsCString stringMsg; + + CQaUtils::QAOutput("Begin nsIRequest tests.", 2); + + if (myDialog.DoModal() == IDOK) + { + // add web prog listener to track requests & invoke nsIRequest methods + nsWeakPtr weakling( + dont_AddRef(NS_GetWeakReference(NS_STATIC_CAST(nsIWebProgressListener*, qaBrowserImpl)))); + qaWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsIWebProgressListener)); + + // invoke a request. request picked up in OnStateChange(). + strcpy(theUrl, myDialog.m_urlfield); + qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).GetUnicode(), + nsIWebNavigation::LOAD_FLAGS_NONE); + } + + // note: individual nsIRequest tests are found in BrowserImplWebProgLstner.cpp, OnStateChange(). + +} + +void CTests::IsPendingReqTest(nsIRequest *request) +{ + PRBool reqPending; + nsresult rv; + + rv = request->IsPending(&reqPending); + CQaUtils::RvTestResult(rv, "nsIRequest::IsPending() rv test", 1); + + if (!reqPending) + CQaUtils::QAOutput("Pending request = false.", 1); + else + CQaUtils::QAOutput("Pending request = true.", 1); +} + +void CTests::GetStatusReqTest(nsIRequest *request) +{ + nsresult theStatusError; + nsresult rv; + + rv = request->GetStatus(&theStatusError); + CQaUtils::RvTestResult(rv, "nsIRequest::GetStatus() test", 1); + CQaUtils::RvTestResult(rv, "the returned status error test", 1); + +} + +void CTests::SuspendReqTest(nsIRequest *request) +{ + nsresult rv; + + rv = request->Suspend(); + CQaUtils::RvTestResult(rv, "nsIRequest::Suspend() test", 1); +} + +void CTests::ResumeReqTest(nsIRequest *request) +{ + nsresult rv; + + rv = request->Resume(); + CQaUtils::RvTestResult(rv, "nsIRequest::Resume() test", 1); +} + +void CTests::CancelReqTest(nsIRequest *request) +{ + nsresult rv; + nsresult status = NS_BINDING_ABORTED; + + rv = request->Cancel(status); + CQaUtils::RvTestResult(rv, "nsIRequest::Cancel() rv test", 1); + CQaUtils::RvTestResult(status, "nsIRequest::Cancel() status test", 1); +} + +void CTests::SetLoadGroupTest(nsIRequest *request, + nsILoadGroup *theLoadGroup) +{ + nsresult rv; + nsCOMPtr theSimpEnum; + + rv = request->SetLoadGroup(theLoadGroup); + CQaUtils::RvTestResult(rv, "nsIRequest::SetLoadGroup() rv test", 1); +} + +void CTests::GetLoadGroupTest(nsIRequest *request) +{ + nsCOMPtr theLoadGroup; + nsresult rv; + nsCOMPtr theSimpEnum; + + rv = request->GetLoadGroup(getter_AddRefs(theLoadGroup)); + CQaUtils::RvTestResult(rv, "nsIRequest::GetLoadGroup() rv test", 1); + + rv = theLoadGroup->GetRequests(getter_AddRefs(theSimpEnum)); + CQaUtils::RvTestResult(rv, "nsIRequest:: LoadGroups' GetRequests() rv test", 1); } // *********************************************************************** @@ -1014,7 +1146,7 @@ void CTests::canCopySelectionTest() if(canCopySelection) AfxMessageBox("The selection you made Can be copied"); else - AfxMessageBox("Either you didnot make a selection or The selection you made Cannot be copied"); + AfxMessageBox("Either you did not make a selection or The selection you made Cannot be copied"); } // Checking the canCutSelection() method. @@ -1028,7 +1160,7 @@ void CTests::canCutSelectionTest() if(canCutSelection) AfxMessageBox("The selection you made Can be cut"); else - AfxMessageBox("Either you didnot make a selection or The selection you made Cannot be cut"); + AfxMessageBox("Either you did not make a selection or The selection you made Cannot be cut"); } // Checking the canPaste() method. @@ -1078,3 +1210,4 @@ nsCOMPtr */ } + diff --git a/mozilla/embedding/qa/testembed/Tests.h b/mozilla/embedding/qa/testembed/Tests.h index 36e64012411..d5d6f2a822e 100644 --- a/mozilla/embedding/qa/testembed/Tests.h +++ b/mozilla/embedding/qa/testembed/Tests.h @@ -83,15 +83,12 @@ public: // Generated message map functions protected: //{{AFX_MSG(CTests) - afx_msg void OnUpdateNavBack(CCmdUI* pCmdUI); afx_msg void OnUpdateNavForward(CCmdUI* pCmdUI); afx_msg void OnUpdateNavStop(CCmdUI* pCmdUI); afx_msg void OnUpdateCut(CCmdUI* pCmdUI); afx_msg void OnUpdateCopy(CCmdUI* pCmdUI); afx_msg void OnUpdatePaste(CCmdUI* pCmdUI); - - // qa tests afx_msg void OnTestsChangeUrl(); afx_msg void OnTestsGlobalHistory(); afx_msg void OnTestsCreateFile(); @@ -101,11 +98,12 @@ protected: afx_msg void OnInterfacesNsifile(); afx_msg void OnInterfacesNsishistory(); afx_msg void OnInterfacesNsiwebnav(); + afx_msg void OnInterfacesNsirequest(); afx_msg void OnToolsRemoveGHPage(); afx_msg void OnToolsRemoveAllGH(); + afx_msg void OnToolsTestYourMethod(); + afx_msg void OnToolsTestYourMethod2(); afx_msg void OnVerifybugs70228(); - - //DHARMA afx_msg void OnPasteTest(); afx_msg void OnCopyTest(); afx_msg void OnSelectAllTest(); @@ -115,8 +113,6 @@ protected: afx_msg void canCopySelectionTest(); afx_msg void canCutSelectionTest(); afx_msg void canPasteTest(); - //DHARMA - //}}AFX_MSG DECLARE_MESSAGE_MAP() @@ -131,8 +127,8 @@ protected: // individual nsISHistory tests void GetCountTest(nsISHistory *, PRInt32 *); void GetIndexTest(nsISHistory *, PRInt32 *); - void GetMaxLength(nsISHistory *, PRInt32); - void SetMaxLength(nsISHistory *, PRInt32 *); + void GetMaxLengthTest(nsISHistory *, PRInt32 *); + void SetMaxLengthTest(nsISHistory *, PRInt32); void GetEntryAtIndexTest(nsISHistory *, nsIHistoryEntry *, PRInt32 theIndex); void GetURIHistTest(nsIHistoryEntry *); void GetTitleHistTest(nsIHistoryEntry *); @@ -153,6 +149,16 @@ protected: void GetDocumentTest(void); void GetCurrentURITest(void); void GetSHTest(void); + +public: + // individual nsIRequest tests + void static IsPendingReqTest(nsIRequest *); + void static GetStatusReqTest(nsIRequest *); + void static SuspendReqTest(nsIRequest *); + void static ResumeReqTest(nsIRequest *); + void static CancelReqTest(nsIRequest *); + void static SetLoadGroupTest(nsIRequest *, nsILoadGroup *); + void static GetLoadGroupTest(nsIRequest *); }; #endif //_TESTS_H diff --git a/mozilla/embedding/qa/testembed/makefile.win b/mozilla/embedding/qa/testembed/makefile.win index 7ca264fa825..432c5d71862 100644 --- a/mozilla/embedding/qa/testembed/makefile.win +++ b/mozilla/embedding/qa/testembed/makefile.win @@ -57,7 +57,7 @@ OBJS = \ LLIBS= \ $(DIST)\lib\baseembed_s.lib \ - $(DIST)\lib\gkgfxwin.lib \ + $(DIST)\lib\gkgfx.lib \ $(DIST)\lib\xpcom.lib \ $(DIST)\lib\mfcEmbedComponents.lib \ $(LIBNSPR) \ diff --git a/mozilla/embedding/qa/testembed/resource.h b/mozilla/embedding/qa/testembed/resource.h index 81571cbc60f..e2bfcd1058c 100644 --- a/mozilla/embedding/qa/testembed/resource.h +++ b/mozilla/embedding/qa/testembed/resource.h @@ -78,8 +78,9 @@ #define ID_TESTS_ADDWEBPROGLISTENER 32798 #define ID_TESTS_ADDHISTORYLISTENER 32799 #define ID_INTERFACES_NSIWEBNAV 32800 - -//DHARMA +#define ID_TOOLS_TESTYOURMETHOD 32801 +#define ID_TOOLS_TESTYOURMETHOD2 32802 +#define ID_INTERFACES_NSIREQUEST 32803 #define ID_CLIPBOARDCMD_PASTE 42789 #define ID_CLIPBOARDCMD_COPYSELECTION 42790 #define ID_CLIPBOARDCMD_SELECTALL 42791 @@ -87,9 +88,8 @@ #define ID_CLIPBOARDCMD_CUTSELECTION 42793 #define ID_CLIPBOARDCMD_COPYLINKLOCATION 42794 #define ID_CLIPBOARDCMD_CANCOPYSELECTION 42795 -#define ID_CLIPBOARDCMD_CANCUTSELECTION 42796 -#define ID_CLIPBOARDCMD_CANPASTE 42797 -//DHARMA +#define ID_CLIPBOARDCMD_CANCUTSELECTION 42796 +#define ID_CLIPBOARDCMD_CANPASTE 42797 // Next default values for new objects // @@ -97,7 +97,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 146 -#define _APS_NEXT_COMMAND_VALUE 32801 +#define _APS_NEXT_COMMAND_VALUE 32804 #define _APS_NEXT_CONTROL_VALUE 1024 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/mozilla/embedding/qa/testembed/testembed.aps b/mozilla/embedding/qa/testembed/testembed.aps index 0f942afa327..d5cf4e039a3 100644 Binary files a/mozilla/embedding/qa/testembed/testembed.aps and b/mozilla/embedding/qa/testembed/testembed.aps differ diff --git a/mozilla/embedding/qa/testembed/testembed.dsp b/mozilla/embedding/qa/testembed/testembed.dsp index ddebff7f902..69d13487de9 100644 --- a/mozilla/embedding/qa/testembed/testembed.dsp +++ b/mozilla/embedding/qa/testembed/testembed.dsp @@ -8,12 +8,12 @@ CFG=mfcembed - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE -!MESSAGE NMAKE /f "mfcembed.mak". +!MESSAGE NMAKE /f "testembed.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE -!MESSAGE NMAKE /f "mfcembed.mak" CFG="mfcembed - Win32 Debug" +!MESSAGE NMAKE /f "testembed.mak" CFG="mfcembed - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -122,14 +122,6 @@ SOURCE=.\Dialogs.cpp # End Source File # Begin Source File -SOURCE=.\MfcEmbed.cpp -# End Source File -# Begin Source File - -SOURCE=.\MfcEmbed.rc -# End Source File -# Begin Source File - SOURCE=.\MostRecentUrls.cpp # End Source File # Begin Source File @@ -158,6 +150,14 @@ SOURCE=.\StdAfx.cpp # End Source File # Begin Source File +SOURCE=.\TestEmbed.cpp +# End Source File +# Begin Source File + +SOURCE=.\testembed.rc +# End Source File +# Begin Source File + SOURCE=.\Tests.cpp # End Source File # Begin Source File @@ -194,10 +194,6 @@ SOURCE=.\IBrowserFrameGlue.h # End Source File # Begin Source File -SOURCE=.\MfcEmbed.h -# End Source File -# Begin Source File - SOURCE=.\MostRecentUrls.h # End Source File # Begin Source File @@ -230,6 +226,10 @@ SOURCE=.\StdAfx.h # End Source File # Begin Source File +SOURCE=.\TestEmbed.h +# End Source File +# Begin Source File + SOURCE=.\Tests.h # End Source File # Begin Source File diff --git a/mozilla/embedding/qa/testembed/testembed.rc b/mozilla/embedding/qa/testembed/testembed.rc index 965ec8b13e6..304b4b78daa 100644 --- a/mozilla/embedding/qa/testembed/testembed.rc +++ b/mozilla/embedding/qa/testembed/testembed.rc @@ -143,48 +143,51 @@ BEGIN END POPUP "&Help" BEGIN - MENUITEM "&About TestEmbed...", ID_APP_ABOUT + MENUITEM "&About TestEmbed...", ID_APP_ABOUT END POPUP "&Tests" BEGIN - MENUITEM "&Change URL", ID_TESTS_CHANGEURL - MENUITEM "&Global &History", ID_TESTS_GLOBALHISTORY - MENUITEM "Create &File", ID_TESTS_CREATEFILE - MENUITEM "Create/Switch &Profile", ID_TESTS_CREATEPROFILE - MENUITEM "&Add Web Prog Listener", ID_TESTS_ADDWEBPROGLISTENER - MENUITEM "Add History &Listener", ID_TESTS_ADDHISTORYLISTENER + MENUITEM "&Change URL", ID_TESTS_CHANGEURL + MENUITEM "&Global &History", ID_TESTS_GLOBALHISTORY + MENUITEM "Create &File", ID_TESTS_CREATEFILE + MENUITEM "Create/Switch &Profile", ID_TESTS_CREATEPROFILE + MENUITEM "&Add Web Prog Listener", ID_TESTS_ADDWEBPROGLISTENER + MENUITEM "Add History &Listener", ID_TESTS_ADDHISTORYLISTENER END POPUP "&Interfaces" BEGIN - MENUITEM "nsI&File", ID_INTERFACES_NSIFILE - MENUITEM "nsI&SHistory", ID_INTERFACES_NSISHISTORY - MENUITEM "nsI&WebNav", ID_INTERFACES_NSIWEBNAV + MENUITEM "nsI&File", ID_INTERFACES_NSIFILE + MENUITEM "nsI&SHistory", ID_INTERFACES_NSISHISTORY + MENUITEM "nsI&WebNav", ID_INTERFACES_NSIWEBNAV + MENUITEM "nsI&Request", ID_INTERFACES_NSIREQUEST END POPUP "T&ools" BEGIN - MENUITEM "Remove &GH Page", ID_TOOLS_REMOVEGHPAGE - MENUITEM "Remove &All GH", ID_TOOLS_REMOVEALLGH + MENUITEM "Remove &GH Page", ID_TOOLS_REMOVEGHPAGE + MENUITEM "Remove &All GH", ID_TOOLS_REMOVEALLGH + MENUITEM "Test &Your Method", ID_TOOLS_TESTYOURMETHOD + MENUITEM "Test Your &Method2", ID_TOOLS_TESTYOURMETHOD2 END POPUP "Ve&rify Bugs" BEGIN - MENUITEM "&70228", ID_VERIFYBUGS_70228 + MENUITEM "&70228", ID_VERIFYBUGS_70228 END - - //DHARMA POPUP "Clip&BoardTest" - BEGIN - MENUITEM "&Copy Selection", ID_CLIPBOARDCMD_COPYSELECTION - MENUITEM "&Paste", ID_CLIPBOARDCMD_PASTE - MENUITEM "Select &All", ID_CLIPBOARDCMD_SELECTALL - MENUITEM "Select &None", ID_CLIPBOARDCMD_SELECTNONE - MENUITEM "Cu&t Selection", ID_CLIPBOARDCMD_CUTSELECTION - MENUITEM "Copy &Link Location", ID_CLIPBOARDCMD_COPYLINKLOCATION - MENUITEM "Can Copy &Selection", ID_CLIPBOARDCMD_CANCOPYSELECTION - MENUITEM "Can C&ut Selection", ID_CLIPBOARDCMD_CANCUTSELECTION - MENUITEM "Can Pas&Te", ID_CLIPBOARDCMD_CANPASTE + MENUITEM "&Copy Selection", ID_CLIPBOARDCMD_COPYSELECTION + + MENUITEM "&Paste", ID_CLIPBOARDCMD_PASTE + MENUITEM "Select &All", ID_CLIPBOARDCMD_SELECTALL + MENUITEM "Select &None", ID_CLIPBOARDCMD_SELECTNONE + MENUITEM "Cu&t Selection", ID_CLIPBOARDCMD_CUTSELECTION + MENUITEM "Copy &Link Location", ID_CLIPBOARDCMD_COPYLINKLOCATION + + MENUITEM "Can Copy &Selection", ID_CLIPBOARDCMD_CANCOPYSELECTION + + MENUITEM "Can C&ut Selection", ID_CLIPBOARDCMD_CANCUTSELECTION + + MENUITEM "Can Pas&Te", ID_CLIPBOARDCMD_CANPASTE END - //DHARMA END IDR_CTXMENU_DOCUMENT MENU DISCARDABLE