Uploading new object model (work done by Ashish) & .cpp files for separate interface tests.

This commit is contained in:
depstein%netscape.com 2001-09-22 00:49:38 +00:00
Родитель c347dd117a
Коммит 1da3f63fda
35 изменённых файлов: 3959 добавлений и 296 удалений

Просмотреть файл

@ -69,6 +69,8 @@
#include "BrowserImpl.h"
#include "QaUtils.h"
#include "nsirequest.h"
#include "Tests.h"
CBrowserImpl::CBrowserImpl()
@ -116,6 +118,8 @@ NS_INTERFACE_MAP_BEGIN(CBrowserImpl)
NS_INTERFACE_MAP_ENTRY(nsISHistoryListener) // de: added 5/11
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(nsITooltipTextProvider) // de: added 7/26
NS_INTERFACE_MAP_END
//*****************************************************************************
@ -146,7 +150,7 @@ NS_IMETHODIMP CBrowserImpl::SetStatus(PRUint32 aType, const PRUnichar* aStatus)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->UpdateStatusBarText(aStatus);
// CQaUtils::QAOutput("nsIWebBrowserChrome::SetStatus().", 1);
//QAOutput("nsIWebBrowserChrome::SetStatus().", 1);
return NS_OK;
}
@ -158,7 +162,7 @@ NS_IMETHODIMP CBrowserImpl::GetWebBrowser(nsIWebBrowser** aWebBrowser)
*aWebBrowser = mWebBrowser;
NS_IF_ADDREF(*aWebBrowser);
CQaUtils::QAOutput("nsIWebBrowserChrome::GetWebBrowser().", 1);
QAOutput("nsIWebBrowserChrome::GetWebBrowser().", 1);
return NS_OK;
}
@ -171,7 +175,7 @@ NS_IMETHODIMP CBrowserImpl::SetWebBrowser(nsIWebBrowser* aWebBrowser)
NS_ENSURE_ARG_POINTER(aWebBrowser);
mWebBrowser = aWebBrowser;
CQaUtils::QAOutput("nsIWebBrowserChrome::SetWebBrowser().", 1);
QAOutput("nsIWebBrowserChrome::SetWebBrowser().", 1);
return NS_OK;
}
@ -194,19 +198,19 @@ NS_IMETHODIMP CBrowserImpl::CreateBrowserWindow(PRUint32 chromeMask, PRInt32 aX,
{
if(! m_pBrowserFrameGlue)
{
CQaUtils::QAOutput("nsIWebBrowserChrome::CreateBrowserWindow(). Browser Window not created.", 1);
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);
QAOutput("nsIWebBrowserChrome::CreateBrowserWindow(): Browser Window created.", 1);
return NS_OK;
}
else
{
CQaUtils::QAOutput("nsIWebBrowserChrome::CreateBrowserWindow(): Browser Window not created.", 1);
QAOutput("nsIWebBrowserChrome::CreateBrowserWindow(): Browser Window not created.", 1);
return NS_ERROR_FAILURE;
}
}
@ -217,12 +221,12 @@ NS_IMETHODIMP CBrowserImpl::DestroyBrowserWindow()
{
if(! m_pBrowserFrameGlue)
{
CQaUtils::QAOutput("nsIWebBrowserChrome::DestroyBrowserWindow(): Browser Window not destroyed.", 1);
QAOutput("nsIWebBrowserChrome::DestroyBrowserWindow(): Browser Window not destroyed.", 1);
return NS_ERROR_FAILURE;
}
m_pBrowserFrameGlue->DestroyBrowserFrame();
CQaUtils::QAOutput("nsIWebBrowserChrome::DestroyBrowserWindow(): Browser Window destroyed.", 1);
QAOutput("nsIWebBrowserChrome::DestroyBrowserWindow(): Browser Window destroyed.", 1);
return NS_OK;
}
@ -242,7 +246,7 @@ NS_IMETHODIMP CBrowserImpl::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
return NS_ERROR_FAILURE;
m_pBrowserFrameGlue->SetBrowserFrameSize(aCX, aCY);
CQaUtils::QAOutput("nsIWebBrowserChrome::SizeBrowserTo(): Browser sized.", 1);
QAOutput("nsIWebBrowserChrome::SizeBrowserTo(): Browser sized.", 1);
return NS_OK;
}
@ -398,18 +402,19 @@ NS_IMETHODIMP CBrowserImpl::OnDataAvailable(nsIRequest *request,
nsISupports *ctxt, nsIInputStream *input,
PRUint32 offset, PRUint32 count)
{
CQaUtils::QAOutput("***** nsIRequest async tests inside nsIStreamListener::OnDataAvailable(). *****");
CTests::IsPendingReqTest(request);
CTests::GetStatusReqTest(request);
QAOutput("***** nsIRequest async tests inside nsIStreamListener::OnDataAvailable(). *****");
CTests::SuspendReqTest(request);
CTests::ResumeReqTest(request);
CNsIRequest::IsPendingReqTest(request);
CNsIRequest::GetStatusReqTest(request);
CNsIRequest::SuspendReqTest(request);
CNsIRequest::ResumeReqTest(request);
// CTests::CancelReqTest(request);
nsCOMPtr<nsILoadGroup> theLoadGroup(do_CreateInstance(NS_LOADGROUP_CONTRACTID));
CTests::SetLoadGroupTest(request, theLoadGroup);
CTests::GetLoadGroupTest(request);
CNsIRequest::SetLoadGroupTest(request, theLoadGroup);
CNsIRequest::GetLoadGroupTest(request);
return NS_OK;
}
@ -427,3 +432,26 @@ NS_IMETHODIMP CBrowserImpl::OnStopRequest(nsIRequest *request,
}
//*****************************************************************************
// Tool Tip Listener
NS_IMETHODIMP CBrowserImpl::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords,
const PRUnichar *aTipText)
{
QAOutput("Tool Tip Listened",1);
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::OnHideTooltip()
{
QAOutput("Tool Tip Listened",1);
return NS_OK;
}
/*NS_IMETHODIMP CBrowserImpl::GetNodeText(nsIDOMNode *aNode, const PRUnichar *aTipText)
{
QAOutput("Tool Tip Listened",1);
return NS_OK;
}
*/

Просмотреть файл

@ -26,6 +26,9 @@
#include "IBrowserFrameGlue.h"
#include "nsIWebBrowserChromeFocus.h"
#include "nsIContextMenuListener.h"
#include "nsIDOMNode.h"
class CBrowserImpl :
public nsIInterfaceRequestor,
@ -35,8 +38,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 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:
CBrowserImpl();
@ -52,9 +57,11 @@ public:
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSICONTEXTMENULISTENER
NS_DECL_NSISHISTORYLISTENER // de: added this in 5/11
NS_DECL_NSISTREAMLISTENER // de: added this in 6/29
NS_DECL_NSIREQUESTOBSERVER // de: added this in 6/29
NS_DECL_NSISHISTORYLISTENER // de: added this in 5/11
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
protected:
PBROWSERFRAMEGLUE m_pBrowserFrameGlue;

Просмотреть файл

@ -55,42 +55,86 @@ class CBrowserView;
NS_IMETHODIMP CBrowserImpl::OnHistoryNewEntry(nsIURI *theUri)
{
<<<<<<< BrowserImplHistoryLstnr.cpp
QAOutput("nsIHistoryListener::OnHistoryNewEntry()", 2);
GetTheUri(theUri, 1);
=======
CQaUtils::QAOutput("nsIHistoryListener::OnHistoryNewEntry()", 2);
CQaUtils::GetTheUri(theUri, 1);
>>>>>>> 1.6
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::OnHistoryGoBack(nsIURI *theUri, PRBool *notify)
{
CQaUtils::QAOutput("nsIHistoryListener::OnHistoryGoBack()", 2);
QAOutput("nsIHistoryListener::OnHistoryGoBack()", 2);
<<<<<<< BrowserImplHistoryLstnr.cpp
GetTheUri(theUri, 1);
*notify = PR_TRUE;
FormatAndPrintOutput("OnHistoryGoBack() notification = ", *notify, 1);
=======
CQaUtils::GetTheUri(theUri, 1);
*notify = PR_TRUE;
CQaUtils::FormatAndPrintOutput("OnHistoryGoBack() notification = ", *notify, 1);
>>>>>>> 1.6
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::OnHistoryGoForward(nsIURI *theUri, PRBool *notify)
{
CQaUtils::QAOutput("nsIHistoryListener::OnHistoryGoForward()", 2);
QAOutput("nsIHistoryListener::OnHistoryGoForward()", 2);
<<<<<<< BrowserImplHistoryLstnr.cpp
GetTheUri(theUri, 1);
*notify = PR_TRUE;
FormatAndPrintOutput("OnHistoryGoForward() notification = ", *notify, 1);
=======
CQaUtils::GetTheUri(theUri, 1);
*notify = PR_TRUE;
CQaUtils::FormatAndPrintOutput("OnHistoryGoForward() notification = ", *notify, 1);
>>>>>>> 1.6
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::OnHistoryReload(nsIURI *theUri, PRUint32 reloadFlags, PRBool *notify)
{
<<<<<<< BrowserImplHistoryLstnr.cpp
char flagString[100];
QAOutput("nsIHistoryListener::OnHistoryReload()", 2);
=======
char flagString[100];
CQaUtils::QAOutput("nsIHistoryListener::OnHistoryReload()", 2);
>>>>>>> 1.6
<<<<<<< BrowserImplHistoryLstnr.cpp
GetTheUri(theUri, 1);
*notify = PR_TRUE;
FormatAndPrintOutput("OnHistoryReload() notification = ", *notify, 1);
if (reloadFlags == 0x0000)
strcpy(flagString, "LOAD_FLAGS_NONE");
else if (reloadFlags == 0x0100)
strcpy(flagString, "LOAD_FLAGS_BYPASS_CACHE");
else if (reloadFlags == 0x0200)
strcpy(flagString, "LOAD_FLAGS_BYPASS_PROXY");
else if (reloadFlags == 0x0400)
strcpy(flagString, "LOAD_FLAGS_CHARSET_CHANGE");
else if (reloadFlags == (0x0200 | 0x0400))
strcpy(flagString, "LOAD_RELOAD_BYPASS_PROXY_AND_CACHE");
FormatAndPrintOutput("OnHistoryReload() flag = ", flagString, 2);
=======
CQaUtils::GetTheUri(theUri, 1);
*notify = PR_TRUE;
CQaUtils::FormatAndPrintOutput("OnHistoryReload() notification = ", *notify, 1);
@ -108,31 +152,49 @@ NS_IMETHODIMP CBrowserImpl::OnHistoryReload(nsIURI *theUri, PRUint32 reloadFlags
CQaUtils::FormatAndPrintOutput("OnHistoryReload() flag = ", flagString, 2);
>>>>>>> 1.6
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::OnHistoryGotoIndex(PRInt32 theIndex, nsIURI *theUri, PRBool *notify)
{
CQaUtils::QAOutput("nsIHistoryListener::OnHistoryGotoIndex()", 2);
QAOutput("nsIHistoryListener::OnHistoryGotoIndex()", 2);
<<<<<<< BrowserImplHistoryLstnr.cpp
GetTheUri(theUri, 1);
*notify = PR_TRUE;
FormatAndPrintOutput("OnHistoryGotoIndex() notification = ", *notify, 1);
FormatAndPrintOutput("OnHistoryGotoIndex() index = ", theIndex, 2);
=======
CQaUtils::GetTheUri(theUri, 1);
*notify = PR_TRUE;
CQaUtils::FormatAndPrintOutput("OnHistoryGotoIndex() notification = ", *notify, 1);
CQaUtils::FormatAndPrintOutput("OnHistoryGotoIndex() index = ", theIndex, 2);
>>>>>>> 1.6
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::OnHistoryPurge(PRInt32 theNumEntries, PRBool *notify)
{
CQaUtils::QAOutput("nsIHistoryListener::OnHistoryPurge()", 2);
QAOutput("nsIHistoryListener::OnHistoryPurge()", 2);
<<<<<<< BrowserImplHistoryLstnr.cpp
*notify = PR_TRUE;
FormatAndPrintOutput("OnHistoryPurge() notification = ", *notify, 1);
FormatAndPrintOutput("OnHistoryGotoIndex() theNumEntries = ", theNumEntries, 2);
=======
*notify = PR_TRUE;
CQaUtils::FormatAndPrintOutput("OnHistoryPurge() notification = ", *notify, 1);
CQaUtils::FormatAndPrintOutput("OnHistoryGotoIndex() theNumEntries = ", theNumEntries, 2);
>>>>>>> 1.6
return NS_OK;
}

Просмотреть файл

@ -58,33 +58,33 @@ NS_IMETHODIMP CBrowserImpl::OnProgressChange(nsIWebProgress *progress, nsIReques
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
CQaUtils::QAOutput("Entering nsIWebProgLstnr::OnProgressChange().");
QAOutput("Entering nsIWebProgLstnr::OnProgressChange().");
PRInt32 nProgress = curTotalProgress;
PRInt32 nProgressMax = maxTotalProgress;
CQaUtils::RequestName(request, stringMsg);
RequestName(request, stringMsg);
if (nProgressMax == 0)
nProgressMax = LONG_MAX;
if (curSelfProgress > maxSelfProgress)
{
CQaUtils::QAOutput("nsIWebProgLstnr::OnProgressChange(): Self progress complete!", 1);
QAOutput("nsIWebProgLstnr::OnProgressChange(): Self progress complete!", 1);
// web progress DOMWindow test
CQaUtils::WebProgDOMWindowTest(progress, "OnProgressChange()", 1);
WebProgDOMWindowTest(progress, "OnProgressChange()", 1);
}
if (nProgress > nProgressMax)
{
nProgress = nProgressMax; // Progress complete
CQaUtils::QAOutput("nsIWebProgLstnr::OnProgressChange(): Progress Update complete!", 1);
QAOutput("nsIWebProgLstnr::OnProgressChange(): Progress Update complete!", 1);
}
m_pBrowserFrameGlue->UpdateProgress(nProgress, nProgressMax);
CQaUtils::QAOutput("Exiting nsIWebProgLstnr::OnProgressChange().\r\n");
QAOutput("Exiting nsIWebProgLstnr::OnProgressChange().\r\n");
return NS_OK;
}
@ -102,9 +102,9 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest *
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
CQaUtils::QAOutput("Entering nsIWebProgLstnr::OnStateChange().");
QAOutput("Entering nsIWebProgLstnr::OnStateChange().");
CQaUtils::RequestName(request, stringMsg); // nsIRequest::GetName() test
RequestName(request, stringMsg); // nsIRequest::GetName() test
if (progressStateFlags & STATE_IS_DOCUMENT) // DOCUMENT
{
@ -141,7 +141,7 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest *
m_pBrowserFrameGlue->UpdateStatusBarText(nsnull); // Clear the status bar
// web progress DOMWindow test
CQaUtils::WebProgDOMWindowTest(progress, "OnStateChange()", 1);
WebProgDOMWindowTest(progress, "OnStateChange()", 1);
}
} // end STATE_IS_DOCUMENT
@ -210,8 +210,8 @@ NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest *
totalMsg += ", status = ";
totalMsg.AppendInt(status);
CQaUtils::QAOutput(totalMsg.get(), displayMode);
CQaUtils::QAOutput("Exiting nsIWebProgLstnr::OnStateChange().\r\n");
QAOutput(totalMsg.get(), displayMode);
QAOutput("Exiting nsIWebProgLstnr::OnStateChange().\r\n");
return NS_OK;
}
@ -226,19 +226,19 @@ NS_IMETHODIMP CBrowserImpl::OnLocationChange(nsIWebProgress* aWebProgress,
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
CQaUtils::QAOutput("Entering nsIWebProgLstnr::OnLocationChange().");
QAOutput("Entering nsIWebProgLstnr::OnLocationChange().");
nsresult rv;
char *uriSpec;
rv = location->GetSpec(&uriSpec);
if (NS_FAILED(rv))
CQaUtils::QAOutput("Bad result for GetSpec().");
QAOutput("Bad result for GetSpec().");
else
CQaUtils::QAOutput("Good result for GetSpec().");
QAOutput("Good result for GetSpec().");
CQaUtils::FormatAndPrintOutput("The location url = ", uriSpec, 1);
FormatAndPrintOutput("The location url = ", uriSpec, 1);
// CQaUtils::RequestName(aRequest, stringMsg);
// RequestName(aRequest, stringMsg);
PRBool isSubFrameLoad = PR_FALSE; // Is this a subframe load
if (aWebProgress) {
@ -255,7 +255,7 @@ NS_IMETHODIMP CBrowserImpl::OnLocationChange(nsIWebProgress* aWebProgress,
if (!isSubFrameLoad) // Update urlbar only if it is not a subframe load
m_pBrowserFrameGlue->UpdateCurrentURI(location);
CQaUtils::QAOutput("Exiting nsIWebProgLstnr::OnLocationChange().\r\n");
QAOutput("Exiting nsIWebProgLstnr::OnLocationChange().\r\n");
return NS_OK;
}
@ -270,19 +270,19 @@ CBrowserImpl::OnStatusChange(nsIWebProgress* aWebProgress,
if(! m_pBrowserFrameGlue)
return NS_ERROR_FAILURE;
CQaUtils::QAOutput("Entering nsIWebProgLstnr::OnStatusChange().");
QAOutput("Entering nsIWebProgLstnr::OnStatusChange().");
CQaUtils::RequestName(aRequest, stringMsg);
RequestName(aRequest, stringMsg);
// status result test
CQaUtils::FormatAndPrintOutput("OnStatusChange(): Status = ", aStatus, 1);
FormatAndPrintOutput("OnStatusChange(): Status = ", aStatus, 1);
// web progress DOMWindow test
CQaUtils::WebProgDOMWindowTest(aWebProgress, "OnStatusChange(): web prog DOM window test", 1);
WebProgDOMWindowTest(aWebProgress, "OnStatusChange(): web prog DOM window test", 1);
m_pBrowserFrameGlue->UpdateStatusBarText(aMessage);
CQaUtils::QAOutput("Exiting nsIWebProgLstnr::OnStatusChange().\r\n");
QAOutput("Exiting nsIWebProgLstnr::OnStatusChange().\r\n");
return NS_OK;
}
@ -295,14 +295,14 @@ CBrowserImpl::OnSecurityChange(nsIWebProgress *aWebProgress,
{
nsCString stringMsg;
CQaUtils::QAOutput("Entering nsIWebProgLstnr::OnSecurityChange().");
QAOutput("Entering nsIWebProgLstnr::OnSecurityChange().");
CQaUtils::RequestName(aRequest, stringMsg);
RequestName(aRequest, stringMsg);
// web progress DOMWindow test
CQaUtils::WebProgDOMWindowTest(aWebProgress, "OnSecurityChange()", 1);
WebProgDOMWindowTest(aWebProgress, "OnSecurityChange()", 1);
CQaUtils::QAOutput("Exiting nsIWebProgLstnr::OnSecurityChange().\r\n");
QAOutput("Exiting nsIWebProgLstnr::OnSecurityChange().\r\n");
return NS_OK;
}

Просмотреть файл

@ -55,6 +55,7 @@
#include "ProfilesDlg.h"
#include "UrlDialog.h"
#include "Tests.h"
//#include "nsiRequest.h"
#include "QaUtils.h"
// Print Includes
@ -253,7 +254,7 @@ HRESULT CBrowserView::CreateBrowser()
mBaseWindow->SetVisibility(PR_TRUE);
qaTests = new CTests(mWebBrowser, mBaseWindow, mWebNav, mpBrowserImpl);
//nsiRequest = new CNsIRequest(mWebBrowser,mpBrowserImpl);
return S_OK;
}
@ -277,11 +278,11 @@ HRESULT CBrowserView::DestroyBrowser()
rv = mWebBrowser->RemoveWebBrowserListener(weakling, NS_GET_IID(nsIWebProgressListener));
if (NS_FAILED(rv))
{
CQaUtils::QAOutput("Web Progress Listener not removed.");
QAOutput("Web Progress Listener not removed.");
}
else
{
CQaUtils::QAOutput("Web Progress Listener removed.");
QAOutput("Web Progress Listener removed.");
}
*/
return NS_OK;
@ -1031,6 +1032,8 @@ BOOL CBrowserView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINF
if ((qaTests != NULL) && qaTests->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
//if ((nsiRequest != NULL) && nsiRequest->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
// return TRUE;
return CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}

Просмотреть файл

@ -43,7 +43,7 @@ class CFindDialog;
class CPrintProgressDialog;
class CTests;
//class CNsIRequest;
class CBrowserView : public CWnd
{
public:
@ -80,7 +80,8 @@ public:
//
CBrowserImpl* mpBrowserImpl;
CTests *qaTests;
CTests *qaTests ;
//CNsIRequest *nsiRequest;
// Mozilla interfaces
//
@ -88,6 +89,8 @@ public:
nsCOMPtr<nsIBaseWindow> mBaseWindow;
nsCOMPtr<nsIWebNavigation> mWebNav;
typedef void* nsNativeWidget;
//nsCOMPtr<nsISHistory> mSessionHistory; // de: added in 5/11/01
void UpdateBusyState(PRBool aBusy);

Просмотреть файл

@ -0,0 +1,443 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Test cases for the nsIDOMWindow Interface
#include "stdafx.h"
#include "QaUtils.h"
#include <stdio.h>
#include "domWindow.h"
#include "resource.h"
CDomWindow::CDomWindow(nsIWebBrowser* mWebBrowser)
{
qaWebBrowser = mWebBrowser ;
}
CDomWindow::~CDomWindow()
{
}
void CDomWindow::OnStartTests(UINT nMenuID)
{
// Calls all or indivdual test cases on the basis of the
// option selected from menu.
switch(nMenuID)
{
case ID_INTERFACES_NSIDOMWINDOW_RUNALLTESTS :
RunAllTests();
break;
case ID_INTERFACES_NSIDOMWINDOW_GETDOMDOCUMENT :
GetDocument();
break;
case ID_INTERFACES_NSIDOMWINDOW_GETPARENT :
GetParent();
break;
case ID_INTERFACES_NSIDOMWINDOW_GETSCROLLBARS :
GetScrollbars();
break;
case ID_INTERFACES_NSIDOMWINDOW_GETFRAMES :
GetFrames();
break;
case ID_INTERFACES_NSIDOMWINDOW_GETNAME :
//GetName();
break;
case ID_INTERFACES_NSIDOMWINDOW_GETSCSOLLX :
GetScrollX();
break;
case ID_INTERFACES_NSIDOMWINDOW_GETSCROLLY :
GetScrollY();
break;
case ID_INTERFACES_NSIDOMWINDOW_SCROLLTO :
ScrollTo();
break;
case ID_INTERFACES_NSIDOMWINDOW_SCROLLBY :
ScrollBy();
break;
case ID_INTERFACES_NSIDOMWINDOW_GETSELECTION :
GetSelection();
break;
case ID_INTERFACES_NSIDOMWINDOW_SCROLLBYLINES :
ScrollByLines();
break;
case ID_INTERFACES_NSIDOMWINDOW_SCROLLBYPAGES :
ScrollByPages();
break;
case ID_INTERFACES_NSIDOMWINDOW_SIZETOCONTENT :
SizeToContent();
break;
default :
AfxMessageBox("Not added menu handler for this menu item");
break;
}
}
void CDomWindow::RunAllTests()
{
PRInt32 scrollX = 0 ;
PRInt32 scrollY = 0;
PRInt32 bVisible =0;
nsCOMPtr<nsIDOMWindow> oDomWindow;
//nsCOMPtr<nsIDOMWindow> oDomWindowTop;
//nsCOMPtr<nsIDOMWindow> oDomWindowParent;
nsCOMPtr<nsIDOMBarProp> oDomBarProp;
nsCOMPtr<nsIDOMWindowCollection> oDomWindowCol;
nsCOMPtr<nsIDOMDocument> oDomDocument;
nsCOMPtr<nsISelection> oSelection;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 1);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
/* rv = oDomWindow->GetTop(getter_AddRefs(oDomWindowTop));
RvTestResult(rv, "nsIDOMWindow::GetTop()' rv test", 1);
if (!oDomWindowTop)
{
AfxMessageBox("Cannot create Dom Window Top Object");
return;
}
rv = oDomWindow->GetParent(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIDOMWindow::GetParent()' rv test", 1);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Parent Object");
return;
}
*/
rv = oDomWindow->GetScrollbars(getter_AddRefs(oDomBarProp));
RvTestResult(rv, "nsIDOMWindow::GetScrollbars()' rv test", 1);
if (!oDomBarProp)
{
AfxMessageBox("Cannot create Dom Window Scroll Bar Object");
return;
}
rv = oDomWindow->GetFrames(getter_AddRefs(oDomWindowCol));
RvTestResult(rv, "nsIDOMWindow::GetFrames()' rv test", 1);
if (!oDomWindowCol)
{
AfxMessageBox("Cannot create Dom Window Collection Object");
return;
}
rv = oDomWindow->GetDocument(getter_AddRefs(oDomDocument));
RvTestResult(rv, "nsIDOMWindow::GetDocument()' rv test", 1);
if (!oDomDocument)
{
AfxMessageBox("Cannot create Dom Document Object");
return;
}
rv = oDomWindow->GetSelection(getter_AddRefs(oSelection));
RvTestResult(rv, "nsIDOMWindow::GetSelection()' rv test", 1);
if (!oSelection)
{
AfxMessageBox("Cannot get the Selection Object");
return;
}
// nsIDOMBarProp's only attribute
//rv = oDomBarProp->GetVisible(&bVisible);
rv = oDomWindow->GetScrollX(&scrollX);
RvTestResult(rv, "nsIDOMWindow::GetScrollX()' rv test", 1);
rv = oDomWindow->GetScrollY(&scrollY);
RvTestResult(rv, "nsIDOMWindow::GetScrollY()' rv test", 1);
rv = oDomWindow->ScrollTo(100,100);
RvTestResult(rv, "nsIDOMWindow::ScrollTo()' rv test", 1);
rv = oDomWindow->ScrollBy(5, 5);
RvTestResult(rv, "nsIDOMWindow::ScrollBy()' rv test", 1);
rv = oDomWindow->ScrollByLines(5);
RvTestResult(rv, "nsIDOMWindow::ScrollByLines()' rv test", 1);
rv = oDomWindow->ScrollByPages(1);
RvTestResult(rv, "nsIDOMWindow::ScrollByPages()' rv test", 1);
//rv = oDomWindow->SizeToContent();
// RvTestResult(rv, "nsIDOMWindow::SizeToContent()' rv test", 1);
}
void CDomWindow::GetTop()
{
nsCOMPtr<nsIDOMWindow> oDomWindow;
nsCOMPtr<nsIDOMWindow> oDomWindowTop;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->GetTop(getter_AddRefs(oDomWindowTop));
RvTestResult(rv, "nsIDOMWindow::GetTop()' rv test", 1);
if (!oDomWindowTop)
{
AfxMessageBox("Cannot create Dom Window Top Object");
return;
}
}
void CDomWindow::GetParent()
{
nsCOMPtr<nsIDOMWindow> oDomWindow;
nsCOMPtr<nsIDOMWindow> oDomWindowParent;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->GetParent(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIDOMWindow::GetParent()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Parent Object");
return;
}
}
void CDomWindow::GetScrollbars()
{
nsCOMPtr<nsIDOMWindow> oDomWindow;
nsCOMPtr<nsIDOMBarProp> oDomBarProp;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->GetScrollbars(getter_AddRefs(oDomBarProp));
RvTestResult(rv, "nsIDOMWindow::GetScrollbars()' rv test", 0);
if (!oDomBarProp)
{
AfxMessageBox("Cannot create Dom Window Scroll Bar Object");
return;
}
}
void CDomWindow::GetFrames()
{
nsCOMPtr<nsIDOMWindow> oDomWindow;
nsCOMPtr<nsIDOMWindowCollection> oDomWindowCol;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->GetFrames(getter_AddRefs(oDomWindowCol));
RvTestResult(rv, "nsIDOMWindow::GetFrames()' rv test", 0);
if (!oDomWindowCol)
{
AfxMessageBox("Cannot create Dom Window Collection Object");
return;
}
}
void CDomWindow::GetDocument()
{
nsCOMPtr<nsIDOMWindow> oDomWindow;
nsCOMPtr<nsIDOMDocument> oDomDocument;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->GetDocument(getter_AddRefs(oDomDocument));
RvTestResult(rv, "nsIDOMWindow::GetDocument()' rv test",0);
if (!oDomDocument)
{
AfxMessageBox("Cannot create Dom Document Object");
return;
}
}
void CDomWindow::GetSelection()
{
nsCOMPtr<nsIDOMWindow> oDomWindow;
nsCOMPtr<nsISelection> oSelection;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test",0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->GetSelection(getter_AddRefs(oSelection));
RvTestResult(rv, "nsIDOMWindow::GetSelection()' rv test", 0);
if (!oSelection)
{
AfxMessageBox("Cannot get the Selection Object");
return;
}
}
void CDomWindow::GetScrollX()
{
PRInt32 scrollX = 0 ;
nsCOMPtr<nsIDOMWindow> oDomWindow;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->GetScrollX(&scrollX);
RvTestResult(rv, "nsIDOMWindow::GetScrollX()' rv test", 0);
}
void CDomWindow::GetScrollY()
{
PRInt32 scrollY = 0 ;
nsCOMPtr<nsIDOMWindow> oDomWindow;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->GetScrollY(&scrollY);
RvTestResult(rv, "nsIDOMWindow::GetScrollY()' rv test", 0);
}
void CDomWindow::ScrollTo()
{
nsCOMPtr<nsIDOMWindow> oDomWindow;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->ScrollTo(100,100);
RvTestResult(rv, "nsIDOMWindow::ScrollTo()' rv test", 0);
}
void CDomWindow::ScrollBy()
{
nsCOMPtr<nsIDOMWindow> oDomWindow;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->ScrollBy(5, 5);
RvTestResult(rv, "nsIDOMWindow::ScrollBy()' rv test", 0);
}
void CDomWindow::ScrollByLines()
{
nsCOMPtr<nsIDOMWindow> oDomWindow;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->ScrollByLines(5);
RvTestResult(rv, "nsIDOMWindow::ScrollByLines()' rv test",0);
}
void CDomWindow::ScrollByPages()
{
nsCOMPtr<nsIDOMWindow> oDomWindow;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->ScrollByPages(1);
RvTestResult(rv, "nsIDOMWindow::ScrollByPages()' rv test", 0);
}
void CDomWindow::SizeToContent()
{
nsCOMPtr<nsIDOMWindow> oDomWindow;
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
AfxMessageBox("Cannot create Dom Window Object");
return;
}
rv = oDomWindow->SizeToContent();
RvTestResult(rv, "nsIDOMWindow::SizeToContent()' rv test", 0);
}

Просмотреть файл

@ -0,0 +1,57 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Header file for nsIDOMWindow interface test cases
class CDomWindow
{
public:
CDomWindow(nsIWebBrowser* mWebBrowser);
private:
public:
nsCOMPtr<nsIWebBrowser> qaWebBrowser ;
void OnStartTests(UINT nMenuID);
void RunAllTests();
void GetContentDOMWindow();
void GetTop();
void GetParent();
void GetScrollbars();
void GetFrames();
void GetDocument();
void GetSelection();
void GetScrollX();
void GetScrollY();
void ScrollTo();
void ScrollBy();
void ScrollByLines();
void ScrollByPages();
void SizeToContent();
public:
virtual ~CDomWindow();
protected:
};

Просмотреть файл

@ -57,8 +57,13 @@ nsresult CProfileMgr::StartUp()
{
nsresult rv;
<<<<<<< ProfileMgr.cpp
//NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID,&rv));
=======
nsCOMPtr<nsIProfile> profileService =
do_GetService(NS_PROFILE_CONTRACTID, &rv);
>>>>>>> 1.3
if (NS_FAILED(rv)) return rv;
PRInt32 profileCount;
@ -76,7 +81,7 @@ nsresult CProfileMgr::StartUp()
}
else
{
// Use our flag here to check for whether to show profile mgr UI. If the flag
// Use our flag here to chek for whether to show profile mgr UI. Ifc the flag
// says don't show it, just start with the last used profile.
PRBool showIt;
@ -116,9 +121,15 @@ nsresult CProfileMgr::DoManageProfilesDialog(PRBool bAtStartUp)
{
SetShowDialogOnStart(dialog.m_bAskAtStartUp);
<<<<<<< ProfileMgr.cpp
//NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID,&rv));
if (NS_FAILED(rv))
=======
nsCOMPtr<nsIProfile> profileService =
do_GetService(NS_PROFILE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
>>>>>>> 1.3
rv = profileService->SetCurrentProfile(dialog.m_SelectedProfile.get());
}
return NS_OK;

Просмотреть файл

@ -25,8 +25,13 @@ static void ValidateProfileName(const CString& profileName, CDataExchange* pDX)
PRBool exists = FALSE;
{
<<<<<<< ProfilesDlg.cpp
//NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID));
=======
nsCOMPtr<nsIProfile> profileService =
do_GetService(NS_PROFILE_CONTRACTID, &rv);
>>>>>>> 1.2
rv = profileService->ProfileExists(T2W(profileName), &exists);
}
@ -184,8 +189,13 @@ BOOL CProfilesDlg::OnInitDialog()
// Fill the list of profiles
nsresult rv;
<<<<<<< ProfilesDlg.cpp
//NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID));
=======
nsCOMPtr<nsIProfile> profileService =
do_GetService(NS_PROFILE_CONTRACTID, &rv);
>>>>>>> 1.2
profileService->GetCurrentProfile(getter_Copies(curProfileName));
PRInt32 selectedRow = 0;
@ -220,8 +230,13 @@ void CProfilesDlg::OnNewProfile()
{
nsresult rv;
<<<<<<< ProfilesDlg.cpp
//NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID,&rv));
=======
nsCOMPtr<nsIProfile> profileService =
do_GetService(NS_PROFILE_CONTRACTID, &rv);
>>>>>>> 1.2
ASSERT(NS_SUCCEEDED(rv));
if (NS_SUCCEEDED(rv))
{
@ -256,8 +271,13 @@ void CProfilesDlg::OnRenameProfile()
nsresult rv;
<<<<<<< ProfilesDlg.cpp
//NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID,&rv));
=======
nsCOMPtr<nsIProfile> profileService =
do_GetService(NS_PROFILE_CONTRACTID, &rv);
>>>>>>> 1.2
ASSERT(NS_SUCCEEDED(rv));
if (NS_SUCCEEDED(rv))
{
@ -278,8 +298,14 @@ void CProfilesDlg::OnDeleteProfile()
m_ProfileList.GetText(itemIndex, selectedProfile);
nsresult rv;
<<<<<<< ProfilesDlg.cpp
//NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID,&rv));
=======
nsCOMPtr<nsIProfile> profileService =
do_GetService(NS_PROFILE_CONTRACTID, &rv);
>>>>>>> 1.2
ASSERT(NS_SUCCEEDED(rv));
if (NS_SUCCEEDED(rv))
{

Просмотреть файл

@ -34,33 +34,34 @@
#include "BrowserFrm.h"
#include "QAUtils.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BEGIN_MESSAGE_MAP(CQaUtils, CWnd)
//{{AFX_MSG_MAP(CQaUtils)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CQaUtils::CQaUtils()
void RvTestResultDlg(nsresult rv, CString pLine,BOOL bClearList)
{
static CShowTestResults dlgResult ;
if (!dlgResult)
dlgResult.Create(IDD_RUNTESTSDLG);
if (bClearList)
{
dlgResult.m_ListResults.DeleteAllItems();
dlgResult.ShowWindow(true);
}
if (NS_FAILED(rv))
dlgResult.AddItemToList(pLine,false);
else
dlgResult.AddItemToList(pLine,true);
}
CQaUtils::~CQaUtils()
{
}
// ***********************************************************************
// ********************* Local QA Methods *********************
// ***********************************************************************
void CQaUtils::RvTestResult(nsresult rv, const char *pLine, int displayMethod)
void RvTestResult(nsresult rv, const char *pLine, int displayMethod)
{
// note: default displayMethod = 1 in .h file
@ -76,7 +77,7 @@ void CQaUtils::RvTestResult(nsresult rv, const char *pLine, int displayMethod)
QAOutput(theOutputLine, displayMethod);
}
void CQaUtils::WriteToOutputFile(const char *pLine)
void WriteToOutputFile(const char *pLine)
{
CStdioFile myFile;
CFileException e;
@ -101,7 +102,7 @@ void CQaUtils::WriteToOutputFile(const char *pLine)
}
}
void CQaUtils::QAOutput(const char *pLine, int displayMethod)
void QAOutput(const char *pLine, int displayMethod)
{
// note: default displayMethod = 1 in .h file
//#if 0
@ -119,7 +120,7 @@ void CQaUtils::QAOutput(const char *pLine, int displayMethod)
//#endif
}
void CQaUtils::FormatAndPrintOutput(const char *theInput, const char *theVar, int outputMode)
void FormatAndPrintOutput(const char *theInput, const char *theVar, int outputMode)
{
nsCString outStr;
CString strMsg;
@ -144,7 +145,7 @@ void CQaUtils::FormatAndPrintOutput(const char *theInput, const char *theVar, in
}
}
void CQaUtils::FormatAndPrintOutput(const char *theInput, int theVar, int outputMode)
void FormatAndPrintOutput(const char *theInput, int theVar, int outputMode)
{
nsCString outStr;
CString strMsg;
@ -170,7 +171,7 @@ void CQaUtils::FormatAndPrintOutput(const char *theInput, int theVar, int output
}
// stringMsg is returned in case embeddor wishes to use it in the calling method.
void CQaUtils::RequestName(nsIRequest *request, nsCString &stringMsg,
void RequestName(nsIRequest *request, nsCString &stringMsg,
int displayMethod)
{
nsXPIDLString theReqName;
@ -187,7 +188,7 @@ void CQaUtils::RequestName(nsIRequest *request, nsCString &stringMsg,
}
void CQaUtils::WebProgDOMWindowTest(nsIWebProgress *progress, const char *inString,
void WebProgDOMWindowTest(nsIWebProgress *progress, const char *inString,
int displayMethod)
{
nsresult rv;
@ -206,6 +207,84 @@ void CQaUtils::WebProgDOMWindowTest(nsIWebProgress *progress, const char *inStri
else
RvTestResult(rv, totalStr2, displayMethod);
}
<<<<<<< QaUtils.cpp
void GetTheUri(nsIURI *theUri, int displayMethod)
{
nsresult rv;
char *uriSpec;
rv = theUri->GetSpec(&uriSpec);
RvTestResult(rv, "nsIURI::GetSpec() test", displayMethod);
FormatAndPrintOutput("the uri = ", uriSpec, displayMethod);
}
/////////////////////////////////////////////////////////////////////////////
// CShowTestResults dialog
CShowTestResults::CShowTestResults(CWnd* pParent /*=NULL*/)
: CDialog(CShowTestResults::IDD, pParent)
{
//{{AFX_DATA_INIT(CShowTestResults)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CShowTestResults::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CShowTestResults)
DDX_Control(pDX, IDC_LIST1, m_ListResults);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CShowTestResults, CDialog)
//{{AFX_MSG_MAP(CShowTestResults)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShowTestResults message handlers
BOOL CShowTestResults::OnInitDialog()
{
CDialog::OnInitDialog();
m_ListResults.InsertColumn(0,"Test Case",LVCFMT_LEFT,360);
m_ListResults.InsertColumn(1,"Result",LVCFMT_LEFT,100);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CShowTestResults::AddItemToList(LPCTSTR szTestCaseName, BOOL bResult)
{
LV_ITEM lvitem ;
lvitem.mask = LVIF_TEXT;
lvitem.iItem = m_ListResults.GetItemCount();
lvitem.iSubItem = 0;
lvitem.pszText = (LPTSTR)szTestCaseName ;
//Insert the main item
m_ListResults.InsertItem(&lvitem);
if (bResult)
m_ListResults.SetItemText(m_ListResults.GetItemCount()-1,1,"Passed");
else
m_ListResults.SetItemText(m_ListResults.GetItemCount()-1,1,"Failed");
//Insert the sub item
//m_ListResults.InsertItem(&lvitem);
}
=======
void CQaUtils::GetTheUri(nsIURI *theUri, int displayMethod)
{
@ -216,3 +295,4 @@ void CQaUtils::GetTheUri(nsIURI *theUri, int displayMethod)
RvTestResult(rv, "nsIURI::GetSpec() test", displayMethod);
FormatAndPrintOutput("the uri = ", uriSpec, displayMethod);
}
>>>>>>> 1.7

Просмотреть файл

@ -21,7 +21,7 @@
* David Epstein <depstein@netscape.com>
*/
// QAUtils.h : utilities for CQAUtils class. Includes writing to output log.
// QAUtils.h : Global function declarations
//
/////////////////////////////////////////////////////////////////////////////
@ -33,17 +33,52 @@
#endif
#include "BrowserView.h"
#include "resource.h"
#include "stdafx.h"
/////////////////////////////////////////////////////////////////////////////
// CQaUtils window
extern void RvTestResultDlg(nsresult rv, CString pLine,BOOL bClearList = false);
extern void RvTestResult(nsresult, const char *, int displayMethod=1);
extern void WriteToOutputFile(const char *);
extern void QAOutput(const char *pLine, int displayMethod=1);
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 nsresult rv;
class CQaUtils : public CWnd
#endif //_QAUTILS_H/////////////////////////////////////////////////////////////////////////////
// CShowTestResults dialog
class CShowTestResults : public CDialog
{
// Construction
public:
CQaUtils();
virtual ~CQaUtils();
CShowTestResults(CWnd* pParent = NULL); // standard constructor
void AddItemToList(LPCTSTR szTestCaseName, BOOL bResult);
<<<<<<< QaUtils.h
// Dialog Data
//{{AFX_DATA(CShowTestResults)
enum { IDD = IDD_RUNTESTSDLG };
CListCtrl m_ListResults;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CShowTestResults)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
private:
LPCTSTR m_TitleString ;
protected:
=======
void static RvTestResult(nsresult, const char *, int displayMethod=1);
void static WriteToOutputFile(const char *);
void static QAOutput(const char *pLine, int displayMethod=1);
@ -53,15 +88,13 @@ public:
void static WebProgDOMWindowTest(nsIWebProgress *, const char *,
int displayMethod=1);
void static GetTheUri(nsIURI *, int displayMethod=1);
nsresult rv;
// Some helper methods
>>>>>>> 1.8
// Generated message map functions
protected:
//{{AFX_MSG(CQaUtils)
//{{AFX_MSG(CShowTestResults)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif //_QAUTILS_H

Просмотреть файл

@ -0,0 +1,604 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Test cases for the nsISelection Interface
#include "stdafx.h"
#include "QaUtils.h"
#include <stdio.h>
#include "Selection.h"
CSelection::CSelection(nsIWebBrowser* mWebBrowser)
{
qaWebBrowser = mWebBrowser;
}
CSelection::~CSelection()
{
}
void CSelection::OnStartTests(UINT nMenuID)
{
// Calls all or indivdual test cases on the basis of the
// option selected from menu.
switch(nMenuID)
{
case ID_INTERFACES_NSISELECTION_RUNALLTESTS :
RunAllTests();
break ;
case ID_INTERFACES_NSISELECTION_GETANCHORNODE :
GetAnchorNode();
break ;
case ID_INTERFACES_NSISELECTION_GETANCHOROFFSET :
GetAnchorOffset();
break ;
case ID_INTERFACES_NSISELECTION_GETFOCUSNODE :
GetFocusNode() ;
break ;
case ID_INTERFACES_NSISELECTION_GETFOCUSOFFSET :
GetFocusOffset() ;
break ;
case ID_INTERFACES_NSISELECTION_GETISCOLLAPSED :
GetIsCollapsed() ;
break ;
case ID_INTERFACES_NSISELECTION_GETRANGECOUNT :
GetRangecount() ;
break ;
case ID_INTERFACES_NSISELECTION_GETRANGEAT :
GetRangeAt() ;
break ;
case ID_INTERFACES_NSISELECTION_COLLAPSE :
Collapse() ;
break ;
case ID_INTERFACES_NSISELECTION_EXTEND :
Extend() ;
break ;
case ID_INTERFACES_NSISELECTION_COLLAPSETOSTART :
CollapseToStart() ;
break ;
case ID_INTERFACES_NSISELECTION_COLLAPSETOEND :
CollapseToEnd() ;
break ;
case ID_INTERFACES_NSISELECTION_CONTAINSNODE :
ContainsNode() ;
break ;
case ID_INTERFACES_NSISELECTION_SELECTALLCHILDREN :
SelectAllChildren();
break ;
case ID_INTERFACES_NSISELECTION_ADDRANGE :
Addrange();
break ;
case ID_INTERFACES_NSISELECTION_REMOVERANGE :
RemoveRange();
break ;
case ID_INTERFACES_NSISELECTION_REMOVEALLRANGES :
RemoveAllRanges();
break ;
case ID_INTERFACES_NSISELECTION_DELETEFROMDOCUMENT :
DeleteFromDocument();
break ;
case ID_INTERFACES_NSISELECTION_SELECTIONLANGUAGECHANGE :
SelectionLanguageChange();
break ;
case ID_INTERFACES_NSISELECTION_TOSTRING :
ToString();
break ;
}
}
void CSelection::RunAllTests()
{
PRInt32 ancoroffset = 0;
PRInt32 focusoffset = 0;
PRInt32 rangecount = 0;
PRInt32 index = 0;
PRBool bisCollapsed = false;
PRBool bContains = false;
nsXPIDLString szText;
nsCOMPtr<nsISelection> oNsSelection ;
nsCOMPtr<nsIDOMNode> oNsDOMAnchorNode ;
nsCOMPtr<nsIDOMNode> oNsDOMFocusNode ;
nsCOMPtr<nsIDOMRange> oNsDOMRange ;
oNsSelection = GetSelectionObject(true);
if (!oNsSelection)
return ;
//---------------- Test case for AnchorNode Attribute
rv = oNsSelection->GetAnchorNode(getter_AddRefs(oNsDOMAnchorNode));
RvTestResultDlg(rv, "nsISelection::GetAnchorNode() ");
if (!oNsDOMAnchorNode)
RvTestResultDlg(rv, "------>No Selection made to get the AnchorNode object");
//---------------- Test case for AnchorOffset Attribute
rv = oNsSelection->GetAnchorOffset(&ancoroffset);
RvTestResultDlg(rv, "nsISelection::GetAnchorOffset()");
//---------------- Test case for FocusNode Attribute
rv = oNsSelection->GetFocusNode(getter_AddRefs(oNsDOMFocusNode));
RvTestResultDlg(rv, "nsISelection::GetFocusNode() ");
if (!oNsDOMFocusNode)
RvTestResultDlg(rv, "------>No Selection made to get the FocusNode object");
//---------------- Test case for FocusOffset Attribute
rv = oNsSelection->GetFocusOffset(&focusoffset);
RvTestResultDlg(rv, "nsISelection::GetFocusOffset()");
//---------------- Test case for isCollapsed Attribute
rv = oNsSelection->GetIsCollapsed(&bisCollapsed);
RvTestResultDlg(rv, "nsISelection::GetIsCollapsed()");
if(bisCollapsed)
RvTestResultDlg(rv, "------> Returned value for IsCollapsed is true");
else
RvTestResultDlg(rv, "------> Returned value for IsCollapsed is false");
//---------------- Test case for isCollapsed Attribute
rv = oNsSelection->GetRangeCount(&rangecount);
RvTestResultDlg(rv, "nsISelection::GetRangeCount()");
//---------------- Test case for GetRangeAt function
rv = oNsSelection->GetRangeAt(index,getter_AddRefs(oNsDOMRange));
RvTestResultDlg(rv, "nsISelection::GetRangeAt() ");
if (!oNsDOMRange)
RvTestResultDlg(rv, "------>Not able to get nsIDOMRange object");
//---------------- Test case for Collapse function
rv = oNsSelection->Collapse(oNsDOMFocusNode,1) ;
RvTestResultDlg(rv, "nsISelection::Collapse() ");
//---------------- Test case for Extend function
rv = oNsSelection->Extend(oNsDOMFocusNode,10) ;
RvTestResultDlg(rv, "nsISelection::Extend() ");
//---------------- Test case for CollapseToStart function
rv = oNsSelection->CollapseToStart();
RvTestResultDlg(rv, "nsISelection::CollapseToStart() ");
//---------------- Test case for CollapseToEnd function
rv = oNsSelection->CollapseToEnd();
RvTestResultDlg(rv, "nsISelection::CollapseToEnd() ");
//---------------- Test case for ContainsNode function
rv = oNsSelection->ContainsNode(oNsDOMFocusNode,PR_TRUE, &bContains);
RvTestResultDlg(rv, "nsISelection::ContainsNode() ");
if(bContains)
RvTestResultDlg(rv, "------> Returned value for ContainsNode is true");
else
RvTestResultDlg(rv, "------> Returned value for ContainsNode is false");
//---------------- Test case for SelectAllChildren function
rv = oNsSelection->SelectAllChildren(oNsDOMFocusNode);
RvTestResultDlg(rv, "nsISelection::SelectAllChildren() ");
//---------------- Test case for Addrange function
rv = oNsSelection->AddRange(oNsDOMRange);
RvTestResultDlg(rv, "nsISelection::Addrange() ");
//---------------- Test case for RemoveRange function
rv = oNsSelection->RemoveRange(oNsDOMRange);
RvTestResultDlg(rv, "nsISelection::RemoveRange() ");
//---------------- Test case for RemoveAllRanges function
rv = oNsSelection->RemoveAllRanges();
RvTestResultDlg(rv, "nsISelection::RemoveAllRanges() ");
//---------------- Test case for DeleteFromDocument function
rv = oNsSelection->DeleteFromDocument();
RvTestResultDlg(rv, "nsISelection::DeleteFromDocument() ");
//---------------- Test case for SelectionLanguageChange function
rv = oNsSelection->SelectionLanguageChange(PR_FALSE);
RvTestResultDlg(rv, "nsISelection::SelectionLanguageChange() ");
//---------------- Test case for ToString function
rv = oNsSelection->ToString(getter_Copies(szText));
RvTestResultDlg(rv, "nsISelection::ToString() ");
}
void CSelection::GetAnchorNode()
{
nsCOMPtr<nsIDOMNode> oNsDOMAnchorNode ;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetAnchorNode(getter_AddRefs(oNsDOMAnchorNode));
RvTestResult(rv, "nsISelection::GetAnchorNode() ",0);
if (!oNsDOMAnchorNode)
RvTestResult(rv, "------>No Selection made to get the AnchorNode object",0);
}
void CSelection::GetAnchorOffset()
{
PRInt32 ancoroffset = 0;
//char szstr[10] ;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetAnchorOffset(&ancoroffset);
RvTestResult(rv, "nsISelection::GetAnchorOffset()",0);
//ltoa(ancoroffset, szstr,10);
//AfxMessageBox(szstr);
}
void CSelection::GetFocusNode()
{
nsCOMPtr<nsIDOMNode> oNsDOMFocusNode ;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetFocusNode(getter_AddRefs(oNsDOMFocusNode));
RvTestResult(rv, "nsISelection::GetFocusNode() ",0);
if (!oNsDOMFocusNode)
RvTestResult(rv, "------>No Selection made to get the FocusNode object",0);
}
void CSelection::GetFocusOffset()
{
PRInt32 focusoffset = 0;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetFocusOffset(&focusoffset);
RvTestResult(rv, "nsISelection::GetFocusOffset()",0);
}
void CSelection::GetIsCollapsed()
{
PRBool bisCollapsed = false;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetIsCollapsed(&bisCollapsed);
RvTestResult(rv, "nsISelection::GetIsCollapsed()",0);
if(bisCollapsed)
RvTestResult(rv, "------> Returned value for IsCollapsed is true",0);
else
RvTestResult(rv, "------> Returned value for IsCollapsed is false",0);
}
void CSelection::GetRangecount()
{
PRInt32 rangecount = 0;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetRangeCount(&rangecount);
RvTestResult(rv, "nsISelection::GetRangeCount()",0);
char szstr[10] ;
ltoa(rangecount, szstr,10);
AfxMessageBox(szstr);
}
void CSelection::GetRangeAt()
{
PRInt32 index = 0;
nsCOMPtr<nsIDOMRange> oNsDOMRange ;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetRangeAt(index,getter_AddRefs(oNsDOMRange));
RvTestResult(rv, "nsISelection::GetRangeAt() ",0);
if (!oNsDOMRange)
RvTestResult(rv, "------>Not able to get nsIDOMRange object",0);
}
void CSelection::Collapse()
{
nsCOMPtr<nsIDOMNode> oNsDOMFocusNode ;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetFocusNode(getter_AddRefs(oNsDOMFocusNode));
RvTestResult(rv, "nsISelection::GetFocusNode() ",0);
if (!oNsDOMFocusNode)
RvTestResult(rv, "------>No Selection made to get the FocusNode object",0);
rv = oSelection->Collapse(oNsDOMFocusNode,1) ;
RvTestResult(rv, "nsISelection::Collapse() ",0);
}
void CSelection::Extend()
{
nsCOMPtr<nsIDOMNode> oNsDOMFocusNode ;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetFocusNode(getter_AddRefs(oNsDOMFocusNode));
RvTestResult(rv, "nsISelection::GetFocusNode() ",0);
if (!oNsDOMFocusNode)
RvTestResult(rv, "------>No Selection made to get the FocusNode object",0);
rv = oSelection->Extend(oNsDOMFocusNode,10) ;
RvTestResult(rv, "nsISelection::Extend() ",0);
}
void CSelection::CollapseToStart()
{
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->CollapseToStart();
RvTestResult(rv, "nsISelection::CollapseToStart() ",0);
}
void CSelection::CollapseToEnd()
{
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
rv = oSelection->CollapseToEnd();
RvTestResult(rv, "nsISelection::CollapseToEnd() ",0);
}
void CSelection::ContainsNode()
{
PRBool bContains = false;
nsCOMPtr<nsIDOMNode> oNsDOMFocusNode ;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetFocusNode(getter_AddRefs(oNsDOMFocusNode));
RvTestResult(rv, "nsISelection::GetFocusNode() ",0);
if (!oNsDOMFocusNode)
RvTestResult(rv, "------>No Selection made to get the FocusNode object",0);
rv = oSelection->ContainsNode(oNsDOMFocusNode,PR_TRUE, &bContains);
RvTestResult(rv, "nsISelection::ContainsNode() ",0);
if(bContains)
RvTestResult(rv, "------> Returned value for ContainsNode is true",0);
else
RvTestResult(rv, "------> Returned value for ContainsNode is false",0);
}
void CSelection::SelectAllChildren()
{
nsCOMPtr<nsIDOMNode> oNsDOMFocusNode ;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetFocusNode(getter_AddRefs(oNsDOMFocusNode));
RvTestResult(rv, "nsISelection::GetFocusNode() ",0);
if (!oNsDOMFocusNode)
RvTestResult(rv, "------>No Selection made to get the FocusNode object",0);
rv = oSelection->SelectAllChildren(oNsDOMFocusNode);
RvTestResult(rv, "nsISelection::SelectAllChildren() ",0);
}
void CSelection::Addrange()
{
PRInt32 index= 0;
nsCOMPtr<nsIDOMRange> oNsDOMRange ;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetRangeAt(index,getter_AddRefs(oNsDOMRange));
RvTestResult(rv, "nsISelection::GetRangeAt() ",0);
if (!oNsDOMRange)
RvTestResult(rv, "------>Not able to get nsIDOMRange object",0);
rv = oSelection->AddRange(oNsDOMRange);
RvTestResult(rv, "nsISelection::Addrange() ",0);
}
void CSelection::RemoveRange()
{
PRInt32 index= 0;
nsCOMPtr<nsIDOMRange> oNsDOMRange ;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->GetRangeAt(index,getter_AddRefs(oNsDOMRange));
RvTestResult(rv, "nsISelection::GetRangeAt() ",0);
if (!oNsDOMRange)
RvTestResult(rv, "------>Not able to get nsIDOMRange object",0);
rv = oSelection->RemoveRange(oNsDOMRange);
RvTestResult(rv, "nsISelection::RemoveRange() ",0);
}
void CSelection::RemoveAllRanges()
{
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->RemoveAllRanges();
RvTestResult(rv, "nsISelection::RemoveAllRanges() ",0);
}
void CSelection::DeleteFromDocument()
{
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->DeleteFromDocument();
RvTestResult(rv, "nsISelection::DeleteFromDocument() ",0);
}
void CSelection::SelectionLanguageChange()
{
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->SelectionLanguageChange(PR_TRUE);
RvTestResult(rv, "nsISelection::SelectionLanguageChange() ",0);
}
void CSelection::ToString()
{
nsXPIDLString szText;
nsCOMPtr<nsISelection> oSelection ;
oSelection = GetSelectionObject();
if (!oSelection)
return ;
rv = oSelection->ToString(getter_Copies(szText));
RvTestResult(rv, "nsISelection::ToString() ",0);
}
nsISelection * CSelection::GetSelectionObject(BOOL bShowDialog)
{
nsCOMPtr<nsISelection> oNsSelection ;
nsCOMPtr<nsIDOMWindow> oDomWindow;
// Get the nsIDOMWindow interface in order to get nsISelection
rv = qaWebBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));
if(bShowDialog)
RvTestResultDlg(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test",true);
else
RvTestResult(rv, "nsIWebBrowser::GetContentDOMWindow()' rv test", 0);
if (!oDomWindow)
{
if(bShowDialog)
RvTestResultDlg(rv, "------>Cannot get the nsIDOMNode Object");
else
RvTestResult(rv, "------>Cannot get the nsIDOMNode Object", 0);
return NULL ;
}
if(bShowDialog)
RvTestResultDlg(rv, "------>nsIDOMWindow is required in order to get the nsISelection interface");
else
RvTestResult(rv, "nsIDOMWindow is required in order to get the nsISelection interface", 0);
// Now get the nsISelection interface
rv = oDomWindow->GetSelection(getter_AddRefs(oNsSelection));
if(bShowDialog)
RvTestResultDlg(rv, "nsIDOMWindow::GetSelection()");
else
RvTestResult(rv, "nsIDOMWindow::GetSelection()", 0);
if (!oNsSelection)
{
if(bShowDialog)
RvTestResultDlg(rv, "------>Cannot get the Selection Object");
else
RvTestResult(rv, "Cannot get the Selection Object", 0);
return NULL ;
}
return oNsSelection ;
}

Просмотреть файл

@ -0,0 +1,68 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Header file for nsISelection interface test cases
class CSelection
{
public:
CSelection(nsIWebBrowser* mWebBrowser);
public:
~CSelection();
public:
nsCOMPtr<nsIWebBrowser> qaWebBrowser ;
// Place Test Cases Here
void OnStartTests(UINT nMenuID);
void RunAllTests();
void GetAnchorNode() ;
void GetAnchorOffset() ;
void GetFocusNode() ;
void GetFocusOffset() ;
void GetIsCollapsed() ;
void GetRangecount() ;
void GetRangeAt() ;
void Collapse() ;
void Extend() ;
void CollapseToStart() ;
void CollapseToEnd() ;
void ContainsNode() ;
void SelectAllChildren();
void Addrange();
void RemoveRange();
void RemoveAllRanges();
void DeleteFromDocument();
void SelectionLanguageChange();
void ToString();
nsISelection * CSelection::GetSelectionObject(BOOL bShowDialog = false) ;
private:
protected:
};

Просмотреть файл

@ -86,11 +86,11 @@
#include "nsIEmbeddingSiteWindow.h"
#include "nsIWebBrowserFind.h"
#include "nsIWebBrowserFocus.h"
#include "nsIServiceManager.h"
// Printer Includes
#include "nsIPrintOptions.h"
#include "nsIWebBrowserPrint.h"
#include "nsIDOMWindow.h"
// qa additions
#include "nsIGlobalHistory.h"
@ -101,7 +101,17 @@
#include "nsIDOMDocumentType.h"
#include "nsIURIContentListener.h"
#include "nsIHelperAppLauncherDialog.h"
<<<<<<< StdAfx.h
#include "nsIDOMWindow.h"
#include "nsIDOMRange.h"
#include "nsIDOMBarProp.h"
#include "nsIDOMWindowCollection.h"
#include "nsISelection.h"
#include "nsITooltipListener.h"
=======
//#include "nsIStreamObserver.h"
>>>>>>> 1.8
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

Просмотреть файл

@ -226,9 +226,11 @@ void CTestEmbedApp::ShowDebugConsole()
//
BOOL CTestEmbedApp::InitInstance()
{
CQaUtils *myUtils = new CQaUtils();
myUtils->QAOutput("****************************************************\r\n");
// CQaUtils *myUtils = new CQaUtils();
// myUtils->QAOutput("****************************************************\r\n");
QAOutput("****************************************************\r\n");
ParseCmdLine();
@ -249,12 +251,14 @@ BOOL CTestEmbedApp::InitInstance()
rv = NS_InitEmbedding(nsnull, provider);
if(NS_FAILED(rv))
{
myUtils->QAOutput("TestEmbed didn't start up.");
//myUtils->QAOutput("TestEmbed didn't start up.");
QAOutput("TestEmbed didn't start up.");
ASSERT(FALSE);
return FALSE;
}
else
myUtils->QAOutput("TestEmbed started up.");
//myUtils->QAOutput("TestEmbed started up.");
QAOutput("TestEmbed started up.");
rv = OverrideComponents();
if(NS_FAILED(rv))
@ -275,19 +279,30 @@ BOOL CTestEmbedApp::InitInstance()
{
ASSERT(FALSE);
rv = NS_TermEmbedding();
myUtils->RvTestResult(rv, "TestEmbed shutdown");
//myUtils->RvTestResult(rv, "TestEmbed shutdown");
RvTestResult(rv, "TestEmbed shutdown");
return FALSE;
}
rv = InitializePrefs();
if (NS_FAILED(rv))
{
ASSERT(FALSE);
NS_TermEmbedding();
return FALSE;
}
if(!CreateHiddenWindow())
{
ASSERT(FALSE);
rv = NS_TermEmbedding();
myUtils->RvTestResult(rv, "TestEmbed shutdown");
//myUtils->RvTestResult(rv, "TestEmbed shutdown");
RvTestResult(rv, "TestEmbed shutdown");
return FALSE;
}
// Create the first browser frame window
OnNewBrowser();
@ -396,9 +411,9 @@ int CTestEmbedApp::ExitInstance()
rv = NS_TermEmbedding();
if (NS_FAILED(rv))
CQaUtils::QAOutput("TestEmbed didn't shut down.");
QAOutput("TestEmbed didn't shut down.");
else
CQaUtils::QAOutput("TestEmbed shut down.");
QAOutput("TestEmbed shut down.");
return 1;
}
@ -432,9 +447,17 @@ void CTestEmbedApp::OnEditPreferences()
// Save these changes to disk now
nsresult rv;
<<<<<<< TestEmbed.cpp
//NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_CONTRACTID, &rv);
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID,&rv));
=======
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
>>>>>>> 1.5
if (NS_SUCCEEDED(rv))
{
{
prefs->SetIntPref("browser.startup.page", m_iStartupPage);
rv = prefs->SetCharPref("browser.startup.homepage", m_strHomePage);
if (NS_SUCCEEDED(rv))
@ -451,12 +474,26 @@ BOOL CTestEmbedApp::InitializeProfiles()
if (!m_ProfileMgr)
return FALSE;
<<<<<<< TestEmbed.cpp
nsresult rv;
=======
nsresult rv;
nsCOMPtr<nsIObserverService> observerService =
do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv);
observerService->AddObserver(this, NS_LITERAL_STRING("profile-approve-change").get());
observerService->AddObserver(this, NS_LITERAL_STRING("profile-change-teardown").get());
observerService->AddObserver(this, NS_LITERAL_STRING("profile-after-change").get());
>>>>>>> 1.5
//NS_WITH_SERVICE(nsIObserverService, observerService, NS_OBSERVERSERVICE_CONTRACTID, &rv);
nsCOMPtr<nsIObserverService>observerService(do_GetService(NS_OBSERVERSERVICE_CONTRACTID,&rv));
if (NS_SUCCEEDED(rv))
{
observerService->AddObserver(this, NS_LITERAL_STRING("profile-approve-change").get());
observerService->AddObserver(this, NS_LITERAL_STRING("profile-change-teardown").get());
observerService->AddObserver(this, NS_LITERAL_STRING("profile-after-change").get());
}
m_ProfileMgr->StartUp();
@ -484,13 +521,19 @@ BOOL CTestEmbedApp::CreateHiddenWindow()
nsresult CTestEmbedApp::InitializePrefs()
{
nsresult rv;
<<<<<<< TestEmbed.cpp
//NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_CONTRACTID, &rv);
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID,&rv));
=======
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
>>>>>>> 1.5
if (NS_SUCCEEDED(rv)) {
// We are using the default prefs from mozilla. If you were
// disributing your own, this would be done simply by editing
// the default pref files.
PRBool inited;
rv = prefs->GetBoolPref("mfcbrowser.prefs_inited", &inited);
if (NS_FAILED(rv) || !inited)
@ -509,7 +552,6 @@ nsresult CTestEmbedApp::InitializePrefs()
else
{
// The prefs are present, read them in
prefs->GetIntPref("browser.startup.page", &m_iStartupPage);
CString strBuf;

Просмотреть файл

@ -36,6 +36,11 @@
#include "ProfileMgr.h"
#include "ProfilesDlg.h"
#include "Tests.h"
#include "nsirequest.h"
#include "nsidirserv.h"
#include "domwindow.h"
#include "selection.h"
#include "nsProfile.h"
#include "QaUtils.h"
#include <stdio.h>
@ -45,6 +50,8 @@
static char THIS_FILE[] = __FILE__;
#endif
nsresult rv;
// Register message for FindDialog communication
static UINT WM_FINDMSG = ::RegisterWindowMessage(FINDMSGSTRING);
@ -57,9 +64,6 @@ BEGIN_MESSAGE_MAP(CTests, CWnd)
ON_COMMAND(ID_TESTS_ADDWEBPROGLISTENER, OnTestsAddWebProgListener)
ON_COMMAND(ID_TESTS_ADDHISTORYLISTENER, OnTestsAddHistoryListener)
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)
ON_COMMAND(ID_TOOLS_TESTYOURMETHOD, OnToolsTestYourMethod)
@ -74,9 +78,61 @@ BEGIN_MESSAGE_MAP(CTests, CWnd)
ON_COMMAND(ID_CLIPBOARDCMD_CANCOPYSELECTION, canCopySelectionTest)
ON_COMMAND(ID_CLIPBOARDCMD_CANCUTSELECTION, canCutSelectionTest)
ON_COMMAND(ID_CLIPBOARDCMD_CANPASTE, canPasteTest)
ON_COMMAND(ID_INTERFACES_NSIREQUEST, OnInterfacesNsirequest)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_RUNALLTESTS, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDIRECTORYSERVICE_INIT, OnInterfacesNsidirectoryservice)
ON_COMMAND(ID_INTERFACES_NSISELECTION_RUNALLTESTS, OnInterfacesNsiselection)
ON_COMMAND(ID_VERIFYBUGS_90195, OnVerifybugs90195)
ON_COMMAND(ID_INTERFACES_NSIPROFILE_RUNALLTESTS, OnInterfacesNsiprofile)
ON_COMMAND(ID_INTERFACES_NSIDIRECTORYSERVICE_REGISTERPROVIDER, OnInterfacesNsidirectoryservice)
ON_COMMAND(ID_INTERFACES_NSIDIRECTORYSERVICE_RUNALLTESTS, OnInterfacesNsidirectoryservice)
ON_COMMAND(ID_INTERFACES_NSIDIRECTORYSERVICE_UNREGISTERPROVIDER, OnInterfacesNsidirectoryservice)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_GETDOMDOCUMENT, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_GETFRAMES, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_GETNAME, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_GETPARENT, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_GETSCROLLBARS, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_GETSCROLLY, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_GETSCSOLLX, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_GETSELECTION, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_SCROLLBY, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_SCROLLBYLINES, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_SCROLLBYPAGES, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_SCROLLTO, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSIDOMWINDOW_SIZETOCONTENT, OnInterfacesNsidomwindow)
ON_COMMAND(ID_INTERFACES_NSISELECTION_GETANCHORNODE, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_ADDRANGE, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_COLLAPSE, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_COLLAPSETOEND, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_COLLAPSETOSTART, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_CONTAINSNODE, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_DELETEFROMDOCUMENT, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_EXTEND, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_GETANCHOROFFSET, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_GETFOCUSNODE, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_GETFOCUSOFFSET, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_GETISCOLLAPSED, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_GETRANGEAT, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_GETRANGECOUNT, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_REMOVEALLRANGES, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_REMOVERANGE, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_SELECTALLCHILDREN, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_SELECTIONLANGUAGECHANGE, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSISELECTION_TOSTRING, OnInterfacesNsiselection)
ON_COMMAND(ID_INTERFACES_NSIPROFILE_CLONEPROFILE, OnInterfacesNsiprofile)
ON_COMMAND(ID_INTERFACES_NSIPROFILE_CREATENEWPROFILE, OnInterfacesNsiprofile)
ON_COMMAND(ID_INTERFACES_NSIPROFILE_DELETEPROFILE, OnInterfacesNsiprofile)
ON_COMMAND(ID_INTERFACES_NSIPROFILE_GETCURRENTPROFILE, OnInterfacesNsiprofile)
ON_COMMAND(ID_INTERFACES_NSIPROFILE_GETPROFILECOUNT, OnInterfacesNsiprofile)
ON_COMMAND(ID_INTERFACES_NSIPROFILE_GETPROFILELIST, OnInterfacesNsiprofile)
ON_COMMAND(ID_INTERFACES_NSIPROFILE_PROFILEEXISTS, OnInterfacesNsiprofile)
ON_COMMAND(ID_INTERFACES_NSIPROFILE_RENAMEPROFILE, OnInterfacesNsiprofile)
ON_COMMAND(ID_INTERFACES_NSIPROFILE_SETCURRENTPROFILE, OnInterfacesNsiprofile)
ON_COMMAND(ID_INTERFACES_NSIPROFILE_SHUTDOWNCURRENTPROFILE, OnInterfacesNsiprofile)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CTests::CTests(nsIWebBrowser* mWebBrowser,
nsIBaseWindow* mBaseWindow,
nsIWebNavigation* mWebNav,
@ -87,7 +143,13 @@ CTests::CTests(nsIWebBrowser* mWebBrowser,
qaWebNav = mWebNav;
qaBrowserImpl = mpBrowserImpl;
}
// Create Individual Interface Objects
// nsirequest = new CNsIRequest(mWebBrowser, mpBrowserImpl);
nsihistory = new CNsIHistory(this);
nsiwebnav = new CNsIWebNav(this);
}
CTests::~CTests()
{
@ -102,24 +164,30 @@ void CTests::OnTestsChangeUrl()
{
char *theUrl = "http://www.aol.com/";
CUrlDialog myDialog;
nsresult rv;
//nsresult rv;
if (!qaWebNav)
{
CQaUtils::QAOutput("Web navigation object not found. Change URL test not performed.", 2);
QAOutput("Web navigation object not found. Change URL test not performed.", 2);
return;
}
if (myDialog.DoModal() == IDOK)
{
CQaUtils::QAOutput("Begin Change URL test.", 1);
QAOutput("Begin Change URL test.", 1);
strcpy(theUrl, myDialog.m_urlfield);
rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).get(),
nsIWebNavigation::LOAD_FLAGS_BYPASS_HISTORY);
<<<<<<< Tests.cpp
RvTestResult(rv, "rv LoadURI() test", 1);
FormatAndPrintOutput("The url = ", theUrl, 2);
=======
// LOAD_FLAGS_NONE
// LOAD_FLAGS_BYPASS_HISTORY
CQaUtils::RvTestResult(rv, "rv LoadURI() test", 1);
CQaUtils::FormatAndPrintOutput("The url = ", theUrl, 2);
>>>>>>> 1.16
/*
char *uriSpec;
@ -138,17 +206,17 @@ void CTests::OnTestsChangeUrl()
AfxMessageBox("Start URL validation test().");
if (strcmp(uriSpec, theUrl) == 0)
{
CQaUtils::QAOutput("Url loaded successfully. Test Passed.", 2);
QAOutput("Url loaded successfully. Test Passed.", 2);
}
else
{
CQaUtils::QAOutput("Url didn't load successfully. Test Failed.", 2);
QAOutput("Url didn't load successfully. Test Failed.", 2);
}
*/
CQaUtils::QAOutput("End Change URL test.", 1);
QAOutput("End Change URL test.", 1);
}
else
CQaUtils::QAOutput("Change URL test not executed.", 1);
QAOutput("Change URL test not executed.", 1);
}
@ -163,34 +231,36 @@ void CTests::OnTestsGlobalHistory()
CUrlDialog myDialog;
PRBool theRetVal = PR_FALSE;
nsresult rv;
//nsresult rv;
nsCOMPtr<nsIGlobalHistory> myHistory(do_GetService(NS_GLOBALHISTORY_CONTRACTID));
if (!myHistory)
{
CQaUtils::QAOutput("Couldn't find history object. No GH tests performed.", 2);
QAOutput("Couldn't find history object. No GH tests performed.", 2);
return;
}
if (myDialog.DoModal() == IDOK)
{
CQaUtils::QAOutput("Begin IsVisited() and AddPage() tests.", 2);
QAOutput("Begin IsVisited() and AddPage() tests.", 2);
strcpy(theUrl, myDialog.m_urlfield);
CQaUtils::FormatAndPrintOutput("The history url = ", theUrl, 1);
FormatAndPrintOutput("The history url = ", theUrl, 1);
// see if url is already in the GH file (pre-AddPage() test)
rv = myHistory->IsVisited(theUrl, &theRetVal);
CQaUtils::RvTestResult(rv, "rv IsVisited() test", 1);
CQaUtils::FormatAndPrintOutput("The IsVisited() boolean return value = ", theRetVal, 1);
RvTestResult(rv, "rv IsVisited() test", 1);
FormatAndPrintOutput("The IsVisited() boolean return value = ", theRetVal, 1);
if (theRetVal)
CQaUtils::QAOutput("URL has been visited. Won't execute AddPage().", 2);
QAOutput("URL has been visited. Won't execute AddPage().", 2);
else
{
CQaUtils::QAOutput("URL hasn't been visited. Will execute AddPage().", 2);
QAOutput("URL hasn't been visited. Will execute AddPage().", 2);
// adds a url to the global history file
rv = myHistory->AddPage(theUrl);
@ -198,24 +268,24 @@ void CTests::OnTestsGlobalHistory()
// prints addPage() results to output file
if (NS_FAILED(rv))
{
CQaUtils::QAOutput("Invalid results for AddPage(). Url not added. Test failed.", 1);
QAOutput("Invalid results for AddPage(). Url not added. Test failed.", 1);
return;
}
else
CQaUtils::QAOutput("Valid results for AddPage(). Url added. Test passed.", 1);
QAOutput("Valid results for AddPage(). Url added. Test passed.", 1);
// checks if url was visited (post-AddPage() test)
myHistory->IsVisited(theUrl, &theRetVal);
if (theRetVal)
CQaUtils::QAOutput("URL is visited; post-AddPage() test. IsVisited() test passed.", 1);
QAOutput("URL is visited; post-AddPage() test. IsVisited() test passed.", 1);
else
CQaUtils::QAOutput("URL isn't visited; post-AddPage() test. IsVisited() test failed.", 1);
QAOutput("URL isn't visited; post-AddPage() test. IsVisited() test failed.", 1);
}
CQaUtils::QAOutput("End IsVisited() and AddPage() tests.", 2);
QAOutput("End IsVisited() and AddPage() tests.", 2);
}
else
CQaUtils::QAOutput("IsVisited() and AddPage() tests not executed.", 1);
QAOutput("IsVisited() and AddPage() tests not executed.", 1);
}
@ -223,25 +293,25 @@ void CTests::OnTestsGlobalHistory()
void CTests::OnTestsCreateFile()
{
nsresult rv;
PRBool exists;
nsCOMPtr<nsILocalFile> theTestFile(do_GetService(NS_LOCAL_FILE_CONTRACTID));
//nsresult rv;
PRBool exists;
nsCOMPtr<nsILocalFile> theTestFile(do_GetService(NS_LOCAL_FILE_CONTRACTID));
if (!theTestFile)
{
CQaUtils::QAOutput("File object doesn't exist. No File tests performed.", 2);
QAOutput("File object doesn't exist. No File tests performed.", 2);
return;
}
CQaUtils::QAOutput("Start Create File test.", 2);
QAOutput("Start Create File test.", 2);
rv = theTestFile->InitWithPath("c:\\temp\\theFile.txt");
rv = theTestFile->Exists(&exists);
CQaUtils::QAOutput("File (theFile.txt) doesn't exist. We'll create it.\r\n", 1);
QAOutput("File (theFile.txt) doesn't exist. We'll create it.\r\n", 1);
rv = theTestFile->Create(nsIFile::NORMAL_FILE_TYPE, 0777);
CQaUtils::RvTestResult(rv, "File Create() test", 2);
RvTestResult(rv, "File Create() test", 2);
}
// *********************************************************
@ -253,25 +323,31 @@ void CTests::OnTestsCreateprofile()
if (myDialog.DoModal() == IDOK)
{
<<<<<<< Tests.cpp
// NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
nsCOMPtr<nsIProfile> theProfServ(do_GetService(NS_PROFILE_CONTRACTID,&rv));
if (NS_FAILED(rv))
=======
// nsCOMPtr<nsIProfile> profileService =
// do_GetService(NS_PROFILE_CONTRACTID, &rv);
nsCOMPtr<nsIProfile> theProfServ(do_GetService(NS_PROFILE_CONTRACTID));
if (!theProfServ)
>>>>>>> 1.16
{
CQaUtils::QAOutput("Didn't get profile service. No profile tests performed.", 2);
QAOutput("Didn't get profile service. No profile tests performed.", 2);
return;
}
CQaUtils::QAOutput("Start Profile switch test.", 2);
QAOutput("Start Profile switch test.", 2);
CQaUtils::QAOutput("Retrieved profile service.", 2);
QAOutput("Retrieved profile service.", 2);
rv = theProfServ->SetCurrentProfile(myDialog.m_SelectedProfile.get());
CQaUtils::RvTestResult(rv, "SetCurrentProfile() (profile switching) test", 2);
RvTestResult(rv, "SetCurrentProfile() (profile switching) test", 2);
CQaUtils::QAOutput("End Profile switch test.", 2);
QAOutput("End Profile switch test.", 2);
}
else
CQaUtils::QAOutput("Profile switch test not executed.", 2);
QAOutput("Profile switch test not executed.", 2);
}
@ -283,7 +359,7 @@ void CTests::OnTestsAddWebProgListener()
dont_AddRef(NS_GetWeakReference(NS_STATIC_CAST(nsIWebProgressListener*, qaBrowserImpl))));
rv = qaWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsIWebProgressListener));
CQaUtils::RvTestResult(rv, "AddWebBrowserListener(). Add Web Prog Lstnr test", 2);
RvTestResult(rv, "AddWebBrowserListener(). Add Web Prog Lstnr test", 2);
}
// *********************************************************
@ -294,7 +370,7 @@ void CTests::OnTestsAddHistoryListener()
nsWeakPtr weakling(
dont_AddRef(NS_GetWeakReference(NS_STATIC_CAST(nsISHistoryListener*, qaBrowserImpl))));
rv = qaWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsISHistoryListener));
CQaUtils::RvTestResult(rv, "AddWebBrowserListener(). Add History Lstnr test", 2);
RvTestResult(rv, "AddWebBrowserListener(). Add History Lstnr test", 2);
}
// *********************************************************
@ -307,16 +383,16 @@ void CTests::OnToolsRemoveGHPage()
char *theUrl = "http://www.bogussite.com/";
CUrlDialog myDialog;
PRBool theRetVal = PR_FALSE;
nsresult rv;
//nsresult rv;
nsCOMPtr<nsIGlobalHistory> myGHistory(do_GetService(NS_GLOBALHISTORY_CONTRACTID));
if (!myGHistory)
{
CQaUtils::QAOutput("Could not get the global history object.", 2);
QAOutput("Could not get the global history object.", 2);
return;
}
nsCOMPtr<nsIBrowserHistory> myHistory = do_QueryInterface(myGHistory, &rv);
if(!NS_SUCCEEDED(rv)) {
CQaUtils::QAOutput("Could not get the history object.", 2);
QAOutput("Could not get the history object.", 2);
return;
}
// nsCOMPtr<nsIBrowserHistory> myHistory(do_GetInterface(myGHistory));
@ -324,47 +400,48 @@ void CTests::OnToolsRemoveGHPage()
if (myDialog.DoModal() == IDOK)
{
CQaUtils::QAOutput("Begin URL removal from the GH file.", 2);
QAOutput("Begin URL removal from the GH file.", 2);
strcpy(theUrl, myDialog.m_urlfield);
myGHistory->IsVisited(theUrl, &theRetVal);
if (theRetVal)
{
rv = myHistory->RemovePage(theUrl);
CQaUtils::RvTestResult(rv, "RemovePage() test (url removal from GH file)", 2);
RvTestResult(rv, "RemovePage() test (url removal from GH file)", 2);
}
else
{
CQaUtils::QAOutput("The URL wasn't in the GH file.\r\n", 1);
QAOutput("The URL wasn't in the GH file.\r\n", 1);
}
CQaUtils::QAOutput("End URL removal from the GH file.", 2);
QAOutput("End URL removal from the GH file.", 2);
}
else
CQaUtils::QAOutput("URL removal from the GH file not executed.", 2);
QAOutput("URL removal from the GH file not executed.", 2);
}
void CTests::OnToolsRemoveAllGH()
{
nsresult rv;
//nsresult rv;
nsCOMPtr<nsIGlobalHistory> myGHistory(do_GetService(NS_GLOBALHISTORY_CONTRACTID));
if (!myGHistory)
{
CQaUtils::QAOutput("Could not get the global history object.", 2);
QAOutput("Could not get the global history object.", 2);
return;
}
nsCOMPtr<nsIBrowserHistory> myHistory = do_QueryInterface(myGHistory, &rv);
if(!NS_SUCCEEDED(rv)) {
CQaUtils::QAOutput("Could not get the history object.", 2);
QAOutput("Could not get the history object.", 2);
return;
}
CQaUtils::QAOutput("Begin removal of all pages from the GH file.", 2);
QAOutput("Begin removal of all pages from the GH file.", 2);
rv = myHistory->RemoveAllPages();
CQaUtils::RvTestResult(rv, "removeAllPages(). Test .", 2);
RvTestResult(rv, "removeAllPages(). Test .", 2);
CQaUtils::QAOutput("End removal of all pages from the GH file.", 2);
QAOutput("End removal of all pages from the GH file.", 2);
// removeAllPages()
@ -397,16 +474,16 @@ void CTests::OnInterfacesNsifile()
if (!theTestFile)
{
CQaUtils::QAOutput("File object doesn't exist. No File tests performed.", 2);
QAOutput("File object doesn't exist. No File tests performed.", 2);
return;
}
if (!theFileOpDir)
{
CQaUtils::QAOutput("File object doesn't exist. No File tests performed.", 2);
QAOutput("File object doesn't exist. No File tests performed.", 2);
return;
}
CQaUtils::QAOutput("Begin nsIFile tests.", 2);
QAOutput("Begin nsIFile tests.", 2);
InitWithPathTest(theTestFile);
AppendRelativePathTest(theTestFile);
@ -421,7 +498,7 @@ void CTests::OnInterfacesNsifile()
FileMoveTest(theTestFile, theFileOpDir);
CQaUtils::QAOutput("End nsIFile tests.", 2);
QAOutput("End nsIFile tests.", 2);
}
// ***********************************************************************
@ -430,13 +507,13 @@ void CTests::OnInterfacesNsifile()
void CTests::InitWithPathTest(nsILocalFile *theTestFile)
{
rv = theTestFile->InitWithPath("c:\\temp\\");
CQaUtils::RvTestResult(rv, "InitWithPath() test (initializing file path)", 2);
RvTestResult(rv, "InitWithPath() test (initializing file path)", 2);
}
void CTests::AppendRelativePathTest(nsILocalFile *theTestFile)
{
rv = theTestFile->AppendRelativePath("myFile.txt");
CQaUtils::RvTestResult(rv, "AppendRelativePath() test (append file to the path)", 2);
RvTestResult(rv, "AppendRelativePath() test (append file to the path)", 2);
}
void CTests::FileCreateTest(nsILocalFile *theTestFile)
@ -444,69 +521,72 @@ void CTests::FileCreateTest(nsILocalFile *theTestFile)
rv = theTestFile->Exists(&exists);
if (!exists)
{
CQaUtils::QAOutput("File doesn't exist. We'll try creating it.", 2);
QAOutput("File doesn't exist. We'll try creating it.", 2);
rv = theTestFile->Create(nsIFile::NORMAL_FILE_TYPE, 0777);
CQaUtils::RvTestResult(rv, " File Create() test ('myFile.txt')", 2);
RvTestResult(rv, " File Create() test ('myFile.txt')", 2);
}
else
CQaUtils::QAOutput("File already exists (myFile.txt). We won't create it.", 2);
QAOutput("File already exists (myFile.txt). We won't create it.", 2);
}
void CTests::FileExistsTest(nsILocalFile *theTestFile)
{
rv = theTestFile->Exists(&exists);
if (!exists)
CQaUtils::QAOutput("Exists() test Failed. File (myFile.txt) doesn't exist.", 2);
QAOutput("Exists() test Failed. File (myFile.txt) doesn't exist.", 2);
else
CQaUtils::QAOutput("Exists() test Passed. File (myFile.txt) exists.", 2);
QAOutput("Exists() test Passed. File (myFile.txt) exists.", 2);
}
void CTests::FileCopyTest(nsILocalFile *theTestFile, nsILocalFile *theFileOpDir)
{
CQaUtils::QAOutput("Start File Copy test.", 2);
QAOutput("Start File Copy test.", 2);
rv = theFileOpDir->InitWithPath("c:\\temp\\");
if (NS_FAILED(rv))
CQaUtils::QAOutput("The target dir wasn't found.", 2);
QAOutput("The target dir wasn't found.", 2);
else
CQaUtils::QAOutput("The target dir was found.", 2);
QAOutput("The target dir was found.", 2);
rv = theTestFile->InitWithPath("c:\\temp\\myFile.txt");
if (NS_FAILED(rv))
CQaUtils::QAOutput("The path wasn't found.", 2);
QAOutput("The path wasn't found.", 2);
else
CQaUtils::QAOutput("The path was found.", 2);
QAOutput("The path was found.", 2);
rv = theTestFile->CopyTo(theFileOpDir, "myFile2.txt");
CQaUtils::RvTestResult(rv, "rv CopyTo() test", 2);
RvTestResult(rv, "rv CopyTo() test", 2);
rv = theTestFile->InitWithPath("c:\\temp\\myFile2.txt");
rv = theTestFile->Exists(&exists);
if (!exists)
CQaUtils::QAOutput("File didn't copy. CopyTo() test Failed.", 2);
QAOutput("File didn't copy. CopyTo() test Failed.", 2);
else
CQaUtils::QAOutput("File copied. CopyTo() test Passed.", 2);
QAOutput("File copied. CopyTo() test Passed.", 2);
}
void CTests::FileMoveTest(nsILocalFile *theTestFile, nsILocalFile *theFileOpDir)
{
CQaUtils::QAOutput("Start File Move test.", 2);
QAOutput("Start File Move test.", 2);
rv = theFileOpDir->InitWithPath("c:\\Program Files\\");
if (NS_FAILED(rv))
CQaUtils::QAOutput("The target dir wasn't found.", 2);
QAOutput("The target dir wasn't found.", 2);
rv = theTestFile->InitWithPath("c:\\temp\\myFile2.txt");
if (NS_FAILED(rv))
CQaUtils::QAOutput("The path wasn't found.", 2);
QAOutput("The path wasn't found.", 2);
rv = theTestFile->MoveTo(theFileOpDir, "myFile2.txt");
CQaUtils::RvTestResult(rv, "MoveTo() test", 2);
RvTestResult(rv, "MoveTo() test", 2);
rv = theTestFile->InitWithPath("c:\\Program Files\\myFile2.txt");
rv = theTestFile->Exists(&exists);
if (!exists)
<<<<<<< Tests.cpp
QAOutput("File wasn't moved. MoveTo() test Failed.", 2);
=======
CQaUtils::QAOutput("File wasn't moved. MoveTo() test Failed.", 2);
else
CQaUtils::QAOutput("File was moved. MoveTo() test Passed.", 2);
@ -659,17 +739,13 @@ void CTests::GetURIHistTest(nsIHistoryEntry* theHistoryEntry)
rv = theHistoryEntry->GetURI(getter_AddRefs(theUri));
if (!theUri)
CQaUtils::QAOutput("theUri for GetURI() invalid. Test failed.", 1);
>>>>>>> 1.16
else
{
CQaUtils::RvTestResult(rv, "GetURI() (URI attribute) test", 1);
rv = theUri->GetSpec(&uriSpec);
if (NS_FAILED(rv))
CQaUtils::QAOutput("We didn't get the uriSpec.", 1);
else
CQaUtils::FormatAndPrintOutput("The SH Url = ", uriSpec, 2);
}
QAOutput("File was moved. MoveTo() test Passed.", 2);
}
<<<<<<< Tests.cpp
=======
void CTests::GetTitleHistTest(nsIHistoryEntry* theHistoryEntry)
{
nsXPIDLString theTitle;
@ -738,7 +814,10 @@ void CTests::PurgeHistoryTest(nsISHistory* theSessionHistory, PRInt32 numEntries
CQaUtils::FormatAndPrintOutput("Number of entries removed = ", numEntries, 2);
}
>>>>>>> 1.16
// ***********************************************************************
<<<<<<< Tests.cpp
=======
// ***********************************************************************
// nsIWebNavigation iface
@ -1193,90 +1272,91 @@ void CTests::GetLoadGroupTest(nsIRequest *request)
// ***********************************************************************
>>>>>>> 1.16
//DHARMA - nsIClipboardCommands
// Checking the paste() method.
void CTests::OnPasteTest()
{
CQaUtils::QAOutput("testing paste command", 1);
QAOutput("testing paste command", 1);
nsCOMPtr<nsIClipboardCommands> clipCmds = do_GetInterface(qaWebBrowser);
if (clipCmds)
{
rv = clipCmds->Paste();
CQaUtils::RvTestResult(rv, "nsIClipboardCommands::Paste()' rv test", 1);
RvTestResult(rv, "nsIClipboardCommands::Paste()' rv test", 1);
}
else
CQaUtils::QAOutput("We didn't get the clipboard object.", 1);
QAOutput("We didn't get the clipboard object.", 1);
}
// Checking the copySelection() method.
void CTests::OnCopyTest()
{
CQaUtils::QAOutput("testing copyselection command");
QAOutput("testing copyselection command");
nsCOMPtr<nsIClipboardCommands> clipCmds = do_GetInterface(qaWebBrowser);
if (clipCmds)
{
rv = clipCmds->CopySelection();
CQaUtils::RvTestResult(rv, "nsIClipboardCommands::CopySelection()' rv test", 1);
RvTestResult(rv, "nsIClipboardCommands::CopySelection()' rv test", 1);
}
else
CQaUtils::QAOutput("We didn't get the clipboard object.", 1);
QAOutput("We didn't get the clipboard object.", 1);
}
// Checking the selectAll() method.
void CTests::OnSelectAllTest()
{
CQaUtils::QAOutput("testing selectall method");
QAOutput("testing selectall method");
nsCOMPtr<nsIClipboardCommands> clipCmds = do_GetInterface(qaWebBrowser);
if (clipCmds)
{
rv = clipCmds->SelectAll();
CQaUtils::RvTestResult(rv, "nsIClipboardCommands::SelectAll()' rv test", 1);
RvTestResult(rv, "nsIClipboardCommands::SelectAll()' rv test", 1);
}
else
CQaUtils::QAOutput("We didn't get the clipboard object.", 1);
QAOutput("We didn't get the clipboard object.", 1);
}
// Checking the selectNone() method.
void CTests::OnSelectNoneTest()
{
CQaUtils::QAOutput("testing selectnone method");
QAOutput("testing selectnone method");
nsCOMPtr<nsIClipboardCommands> clipCmds = do_GetInterface(qaWebBrowser);
if (clipCmds)
{
rv = clipCmds->SelectNone();
CQaUtils::RvTestResult(rv, "nsIClipboardCommands::SelectNone()' rv test", 1);
RvTestResult(rv, "nsIClipboardCommands::SelectNone()' rv test", 1);
}
else
CQaUtils::QAOutput("We didn't get the clipboard object.", 1);
QAOutput("We didn't get the clipboard object.", 1);
}
// Checking the cutSelection() method.
void CTests::OnCutSelectionTest()
{
CQaUtils::QAOutput("testing cutselection method");
QAOutput("testing cutselection method");
nsCOMPtr<nsIClipboardCommands> clipCmds = do_GetInterface(qaWebBrowser);
if (clipCmds)
{
rv = clipCmds->CutSelection();
CQaUtils::RvTestResult(rv, "nsIClipboardCommands::CutSelection()' rv test", 1);
RvTestResult(rv, "nsIClipboardCommands::CutSelection()' rv test", 1);
}
else
CQaUtils::QAOutput("We didn't get the clipboard object.", 1);
QAOutput("We didn't get the clipboard object.", 1);
}
// Checking the copyLinkLocation() method.
void CTests::copyLinkLocationTest()
{
CQaUtils::QAOutput("testing CopyLinkLocation method", 2);
QAOutput("testing CopyLinkLocation method", 2);
nsCOMPtr<nsIClipboardCommands> clipCmds = do_GetInterface(qaWebBrowser);
if (clipCmds)
{
rv = clipCmds->CopyLinkLocation();
CQaUtils::RvTestResult(rv, "nsIClipboardCommands::CopyLinkLocation()' rv test", 1);
RvTestResult(rv, "nsIClipboardCommands::CopyLinkLocation()' rv test", 1);
}
else
CQaUtils::QAOutput("We didn't get the clipboard object.", 1);
QAOutput("We didn't get the clipboard object.", 1);
}
// Checking the canCopySelection() method.
@ -1287,15 +1367,15 @@ void CTests::canCopySelectionTest()
if (clipCmds)
{
rv = clipCmds->CanCopySelection(&canCopySelection);
CQaUtils::RvTestResult(rv, "nsIClipboardCommands::CanCopySelection()' rv test", 1);
RvTestResult(rv, "nsIClipboardCommands::CanCopySelection()' rv test", 1);
if(canCopySelection)
CQaUtils::QAOutput("The selection you made Can be copied", 2);
QAOutput("The selection you made Can be copied", 2);
else
CQaUtils::QAOutput("Either you did not make a selection or The selection you made Cannot be copied", 2);
QAOutput("Either you did not make a selection or The selection you made Cannot be copied", 2);
}
else
CQaUtils::QAOutput("We didn't get the clipboard object.", 1);
QAOutput("We didn't get the clipboard object.", 1);
}
// Checking the canCutSelection() method.
@ -1306,15 +1386,15 @@ void CTests::canCutSelectionTest()
if (clipCmds)
{
rv = clipCmds->CanCutSelection(&canCutSelection);
CQaUtils::RvTestResult(rv, "nsIClipboardCommands::CanCutSelection()' rv test", 1);
RvTestResult(rv, "nsIClipboardCommands::CanCutSelection()' rv test", 1);
if(canCutSelection)
CQaUtils::QAOutput("The selection you made Can be cut", 2);
QAOutput("The selection you made Can be cut", 2);
else
CQaUtils::QAOutput("Either you did not make a selection or The selection you made Cannot be cut", 2);
QAOutput("Either you did not make a selection or The selection you made Cannot be cut", 2);
}
else
CQaUtils::QAOutput("We didn't get the clipboard object.", 1);
QAOutput("We didn't get the clipboard object.", 1);
}
// Checking the canPaste() method.
@ -1325,15 +1405,15 @@ void CTests::canPasteTest()
if (clipCmds)
{
rv = clipCmds->CanPaste(&canPaste);
CQaUtils::RvTestResult(rv, "nsIClipboardCommands::CanPaste()' rv test", 1);
RvTestResult(rv, "nsIClipboardCommands::CanPaste()' rv test", 1);
if(canPaste)
CQaUtils::QAOutput("The clipboard contents can be pasted here", 2);
QAOutput("The clipboard contents can be pasted here", 2);
else
CQaUtils::QAOutput("The clipboard contents cannot be pasted here", 2);
QAOutput("The clipboard contents cannot be pasted here", 2);
}
else
CQaUtils::QAOutput("We didn't get the clipboard object.", 1);
QAOutput("We didn't get the clipboard object.", 1);
}
//DHARMA
@ -1348,9 +1428,9 @@ void CTests::OnVerifybugs70228()
nsCOMPtr<nsIHelperAppLauncherDialog>
myHALD(do_CreateInstance(NS_IHELPERAPPLAUNCHERDLG_CONTRACTID));
if (!myHALD)
CQaUtils::QAOutput("Object not created. It should be. It's a component!", 2);
QAOutput("Object not created. It should be. It's a component!", 2);
else
CQaUtils::QAOutput("Object is created. It's a component!", 2);
QAOutput("Object is created. It's a component!", 2);
/*
nsCOMPtr<nsIHelperAppLauncher>
@ -1360,4 +1440,60 @@ nsCOMPtr<nsIHelperAppLauncher>
*/
}
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
// menu handlers
nCommandID = nID ;
if ((nsihistory != NULL) && nsihistory->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
if ((nsiwebnav != NULL) && nsiwebnav->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
return CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
void CTests::OnInterfacesNsirequest()
{
CNsIRequest oNsIRequest(qaWebBrowser,/*qaBaseWindow,qaWebNav,*/ qaBrowserImpl);
oNsIRequest.OnInterfacesNsirequest();
}
void CTests::OnInterfacesNsidirectoryservice()
{
CNsIDirectoryService oNsIDirectoryService;
oNsIDirectoryService.StartTests(nCommandID);
}
void CTests::OnInterfacesNsidomwindow()
{
CDomWindow oDomWindow(qaWebBrowser) ;
oDomWindow.OnStartTests(nCommandID);
}
void CTests::OnInterfacesNsiselection()
{
CSelection oSelection(qaWebBrowser);
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<nsITooltipTextProvider> oTooltipTextProvider = do_GetService(NS_TOOLTIPTEXTPROVIDER_CONTRACTID) ;
if (!oTooltipTextProvider)
AfxMEssageBox("Asdfadf");
*/
}
void CTests::OnInterfacesNsiprofile()
{
CProfile oProfile(qaWebBrowser);
oProfile.OnStartTests(nCommandID);
}

Просмотреть файл

@ -35,6 +35,9 @@
#include "BrowserView.h"
#include "BrowserImpl.h"
#include "StdAfx.h"
//#include "nsirequest.h"
#include "nsihistory.h"
#include "nsiwebnav.h"
/////////////////////////////////////////////////////////////////////////////
@ -43,7 +46,7 @@
class CBrowserImpl;
class CBrowserView;
class CTests : public CWnd
class CTests:public CWnd
{
public:
CTests(nsIWebBrowser* mWebBrowser,
@ -52,6 +55,7 @@ public:
CBrowserImpl *mpBrowserImpl);
virtual ~CTests();
// Some helper methods
// Mozilla interfaces
@ -59,28 +63,34 @@ public:
nsCOMPtr<nsIWebBrowser> qaWebBrowser;
nsCOMPtr<nsIBaseWindow> qaBaseWindow;
nsCOMPtr<nsIWebNavigation> qaWebNav;
CBrowserImpl *qaBrowserImpl;
// local test methods
// local test variables
nsresult rv;
//nsresult rv;
CString strMsg;
char theUrl[200];
char *uriSpec;
PRBool exists;
PRInt32 numEntries;
PRInt32 theIndex;
nsCOMPtr<nsIURI> theUri;
UINT nCommandID ;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTests)
protected:
public:
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
//}}AFX_VIRTUAL
private:
// Individual interface Objects
// CNsIRequest *nsirequest ;
CNsIHistory *nsihistory ;
CNsIWebNav *nsiwebnav ;
// Generated message map functions
protected:
@ -98,9 +108,6 @@ protected:
afx_msg void OnTestsAddWebProgListener();
afx_msg void OnTestsAddHistoryListener();
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();
@ -115,6 +122,12 @@ protected:
afx_msg void canCopySelectionTest();
afx_msg void canCutSelectionTest();
afx_msg void canPasteTest();
afx_msg void OnInterfacesNsirequest();
afx_msg void OnInterfacesNsidomwindow();
afx_msg void OnInterfacesNsidirectoryservice();
afx_msg void OnInterfacesNsiselection();
afx_msg void OnVerifybugs90195();
afx_msg void OnInterfacesNsiprofile();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
@ -125,43 +138,9 @@ protected:
void FileExistsTest(nsILocalFile *);
void FileCopyTest(nsILocalFile *, nsILocalFile *);
void FileMoveTest(nsILocalFile *, nsILocalFile *);
// individual nsISHistory tests
void GetCountTest(nsISHistory *, PRInt32 *);
void GetIndexTest(nsISHistory *, PRInt32 *);
void GetMaxLengthTest(nsISHistory *, PRInt32 *);
void SetMaxLengthTest(nsISHistory *, PRInt32);
void GetEntryAtIndexTest(nsISHistory *, nsIHistoryEntry *, PRInt32 theIndex);
void GetURIHistTest(nsIHistoryEntry *);
void GetTitleHistTest(nsIHistoryEntry *);
void GetIsSubFrameTest(nsIHistoryEntry *);
void GetSHEnumTest(nsISHistory*, nsISimpleEnumerator *);
void SimpleEnumTest(nsISimpleEnumerator *);
void PurgeHistoryTest(nsISHistory *, PRInt32);
// individual nsIWebNavigation tests
void CanGoBackTest();
void GoBackTest();
void CanGoForwardTest();
void GoForwardTest();
void GoToIndexTest();
void LoadUriTest(char *, const unsigned long);
void ReloadTest(const unsigned long);
void StopUriTest(char *);
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 *);
};
<<<<<<< Tests.h
=======
// structure for uri table
typedef struct
@ -181,5 +160,6 @@ typedef struct
char theUri[1024];
unsigned long theFlag;
} NavElement;
>>>>>>> 1.8
#endif //_TESTS_H
#endif //_TESTS_H

Просмотреть файл

@ -53,6 +53,13 @@ OBJS = \
.\$(OBJDIR)\UrlDialog.obj \
.\$(OBJDIR)\QaUtils.obj \
.\$(OBJDIR)\Tests.obj \
.\$(OBJDIR)\nsirequest.obj \
.\$(OBJDIR)\nsihistory.obj \
.\$(OBJDIR)\nsiwebnav.obj \
.\$(OBJDIR)\nsiDirServ.obj \
.\$(OBJDIR)\domwindow.obj \
.\$(OBJDIR)\selection.obj \
.\$(OBJDIR)\nsProfile.obj \
$(NULL)
LLIBS= \

Просмотреть файл

@ -0,0 +1,340 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* David Epstein <depstein@netscape.com>
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Test cases for the nsiWebNavigation Interface
#include "stdafx.h"
#include "testembed.h"
#include "Tests.h"
#include "qautils.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CNsIWebNav
CNsIWebNav::CNsIWebNav(CTests *mTests)
{
// Assign Local pointer to the CTest Object
qaTests = mTests ;
}
CNsIWebNav::~CNsIWebNav()
{
}
BEGIN_MESSAGE_MAP(CNsIWebNav, CWnd)
//{{AFX_MSG_MAP(CNsIWebNav)
ON_COMMAND(ID_INTERFACES_NSIWEBNAV, OnInterfacesNsiwebnav)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNsIWebNav message handlers
// ***********************************************************************
// nsIWebNavigation iface
// ***********************************************************************
// Url table for web navigation
NavElement UrlTable[] = {
{"http://www.yahoo.com/", nsIWebNavigation::LOAD_FLAGS_NONE},
{"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}
};
void CNsIWebNav::OnInterfacesNsiwebnav()
{
int i=0;
if (qaTests->qaWebNav)
QAOutput("We have the web nav object.", 2);
else {
QAOutput("We don't have the web nav object. No tests performed.", 2);
return;
}
// canGoBack attribute test
CanGoBackTest();
// GoBack test
GoBackTest();
// canGoForward attribute test
CanGoForwardTest();
// GoForward test
GoForwardTest();
// GotoIndex test
GoToIndexTest();
// LoadURI() & reload tests
QAOutput("Run a few LoadURI() tests.", 2);
for (i=0; i < 5; i++)
{
LoadUriTest(UrlTable[i].theUri, UrlTable[i].theFlag);
switch (i)
{
case 0:
ReloadTest(nsIWebNavigation::LOAD_FLAGS_NONE);
break;
case 1:
ReloadTest(nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE);
break;
case 2:
ReloadTest(nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY);
break;
// simulate shift-reload
case 3:
ReloadTest(nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE |
nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY);
break;
case 4:
ReloadTest(nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE);
break;
}
}
// Stop() test
StopUriTest("http://www.microsoft.com/");
// document test
GetDocumentTest();
// uri test
GetCurrentURITest();
// session history test
GetSHTest();
}
// ***********************************************************************
// Individual nsIWebNavigation tests
void CNsIWebNav::CanGoBackTest()
{
PRBool canGoBack = PR_FALSE;
rv = qaTests->qaWebNav->GetCanGoBack(&canGoBack);
RvTestResult(rv, "GetCanGoBack() attribute test", 2);
FormatAndPrintOutput("canGoBack value = ", canGoBack, 2);
}
void CNsIWebNav::GoBackTest()
{
rv = qaTests->qaWebNav->GoBack();
RvTestResult(rv, "GoBack() test", 2);
}
void CNsIWebNav::CanGoForwardTest()
{
PRBool canGoForward = PR_FALSE;
rv = qaTests->qaWebNav->GetCanGoForward(&canGoForward);
RvTestResult(rv, "GetCanGoForward() attribute test", 2);
FormatAndPrintOutput("canGoForward value = ", canGoForward, 2);
}
void CNsIWebNav::GoForwardTest()
{
rv = qaTests->qaWebNav->GoForward();
RvTestResult(rv, "GoForward() test", 2);
}
void CNsIWebNav::GoToIndexTest()
{
PRInt32 theIndex = 0;
rv = qaTests->qaWebNav->GotoIndex(theIndex);
RvTestResult(rv, "GotoIndex() test", 2);
}
void CNsIWebNav::LoadUriTest(char *theUrl, const unsigned long theFlag)
{
char theTotalString[500];
char theFlagName[100];
switch(theFlag)
{
case nsIWebNavigation::LOAD_FLAGS_NONE:
strcpy(theFlagName, "LOAD_FLAGS_NONE");
break;
case nsIWebNavigation::LOAD_FLAGS_MASK:
strcpy(theFlagName, "LOAD_FLAGS_MASK");
break;
case nsIWebNavigation::LOAD_FLAGS_IS_REFRESH:
strcpy(theFlagName, "LOAD_FLAGS_IS_REFRESH");
break;
case nsIWebNavigation::LOAD_FLAGS_IS_LINK:
strcpy(theFlagName, "LOAD_FLAGS_IS_LINK");
break;
case nsIWebNavigation::LOAD_FLAGS_BYPASS_HISTORY:
strcpy(theFlagName, "LOAD_FLAGS_BYPASS_HISTORY");
break;
case nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY:
strcpy(theFlagName, "LOAD_FLAGS_REPLACE_HISTORY");
break;
case nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE:
strcpy(theFlagName, "LOAD_FLAGS_BYPASS_CACHE");
break;
case nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY:
strcpy(theFlagName, "LOAD_FLAGS_BYPASS_PROXY");
break;
case nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE:
strcpy(theFlagName, "LOAD_FLAGS_CHARSET_CHANGE");
break;
}
rv = qaTests->qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).get(),
theFlag);
sprintf(theTotalString, "%s%s%s%s%s", "LoadURI(): ", theUrl, " w/ ", theFlagName, " test");
RvTestResult(rv, theTotalString, 2);
}
void CNsIWebNav::ReloadTest(const unsigned long theFlag)
{
char theTotalString[500];
char theFlagName[100];
switch(theFlag)
{
case nsIWebNavigation::LOAD_FLAGS_NONE:
strcpy(theFlagName, "LOAD_FLAGS_NONE");
break;
case nsIWebNavigation::LOAD_FLAGS_MASK:
strcpy(theFlagName, "LOAD_FLAGS_MASK");
break;
case nsIWebNavigation::LOAD_FLAGS_IS_REFRESH:
strcpy(theFlagName, "LOAD_FLAGS_IS_REFRESH");
break;
case nsIWebNavigation::LOAD_FLAGS_IS_LINK:
strcpy(theFlagName, "LOAD_FLAGS_IS_LINK");
break;
case nsIWebNavigation::LOAD_FLAGS_BYPASS_HISTORY:
strcpy(theFlagName, "LOAD_FLAGS_BYPASS_HISTORY");
break;
case nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY:
strcpy(theFlagName, "LOAD_FLAGS_REPLACE_HISTORY");
break;
case nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE:
strcpy(theFlagName, "LOAD_FLAGS_BYPASS_CACHE");
break;
case nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY:
strcpy(theFlagName, "LOAD_FLAGS_BYPASS_PROXY");
break;
case nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE:
strcpy(theFlagName, "LOAD_FLAGS_CHARSET_CHANGE");
break;
case nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE | \
nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY: \
strcpy(theFlagName, "nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE | \
nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY");
break;
}
rv = qaTests->qaWebNav->Reload(theFlag);
sprintf(theTotalString, "%s%s%s%s", "Reload(): ", " w/ ", theFlagName, " test");
RvTestResult(rv, theTotalString, 2);
}
void CNsIWebNav::StopUriTest(char *theUrl)
{
char theTotalString[200];
qaTests->qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).get(),
nsIWebNavigation::LOAD_FLAGS_NONE);
rv = qaTests->qaWebNav->Stop();
sprintf(theTotalString, "%s%s%s", "Stop(): ", theUrl, " test");
RvTestResult(rv, theTotalString, 2);
}
void CNsIWebNav::GetDocumentTest()
{
nsCOMPtr<nsIDOMDocument> theDocument;
nsCOMPtr<nsIDOMDocumentType> theDocType;
rv = qaTests->qaWebNav->GetDocument(getter_AddRefs(theDocument));
if (!theDocument) {
QAOutput("We didn't get the document. Test failed.", 2);
return;
}
else
RvTestResult(rv, "GetDocument() test", 2);
rv = theDocument->GetDoctype(getter_AddRefs(theDocType));
RvTestResult(rv, "nsIDOMDocument::GetDoctype() for nsIWebNav test", 2);
}
void CNsIWebNav::GetCurrentURITest()
{
nsCOMPtr<nsIURI> theUri;
rv = qaTests->qaWebNav->GetCurrentURI(getter_AddRefs(theUri));
if (!theUri) {
QAOutput("We didn't get the URI. Test failed.", 2);
return;
}
else
RvTestResult(rv, "GetCurrentURI() test", 2);
char *uriSpec;
rv = theUri->GetSpec(&uriSpec);
RvTestResult(rv, "nsIURI::GetSpec() for nsIWebNav test", 1);
FormatAndPrintOutput("the nsIWebNav uri = ", uriSpec, 2);
}
void CNsIWebNav::GetSHTest()
{
PRInt32 numOfElements;
nsCOMPtr<nsISHistory> theSessionHistory;
rv = qaTests->qaWebNav->GetSessionHistory(getter_AddRefs(theSessionHistory));
if (!theSessionHistory) {
QAOutput("We didn't get the session history. Test failed.", 2);
return;
}
else
RvTestResult(rv, "GetSessionHistory() test", 2);
rv = theSessionHistory->GetCount(&numOfElements);
RvTestResult(rv, "nsISHistory::GetCount() for nsIWebNav test", 1);
FormatAndPrintOutput("the sHist entry count = ", numOfElements, 2);
}

Просмотреть файл

@ -0,0 +1,94 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* David Epstein <depstein@netscape.com>
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Header file for nsiWebNavigation interface test cases
#if !defined(AFX_NSIWEBNAV_H__4E002235_7569_11D5_89E7_00010316305A__INCLUDED_)
#define AFX_NSIWEBNAV_H__4E002235_7569_11D5_89E7_00010316305A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CNsIWebNav window
class CNsIWebNav : public CWnd
{
// Construction
public:
CNsIWebNav(CTests *mTests);
// Attributes
public:
CTests *qaTests ;
// Operations
public:
// individual nsIWebNavigation tests
void CanGoBackTest();
void GoBackTest();
void CanGoForwardTest();
void GoForwardTest();
void GoToIndexTest();
void LoadUriTest(char *, const unsigned long);
void ReloadTest(const unsigned long);
void StopUriTest(char *);
void GetDocumentTest(void);
void GetCurrentURITest(void);
void GetSHTest(void);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNsIWebNav)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CNsIWebNav();
// Generated message map functions
protected:
//{{AFX_MSG(CNsIWebNav)
afx_msg void OnInterfacesNsiwebnav();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
typedef struct
{
char theUri[1024];
unsigned long theFlag;
} NavElement;
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_NSIWEBNAV_H__4E002235_7569_11D5_89E7_00010316305A__INCLUDED_)

Просмотреть файл

@ -0,0 +1,342 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Test cases for the nsISelection Interface
#include "stdafx.h"
#include "QaUtils.h"
#include <stdio.h>
#include "nsProfile.h"
CProfile::CProfile(nsIWebBrowser* mWebBrowser)
{
qaWebBrowser = mWebBrowser;
}
CProfile::~CProfile()
{
}
void CProfile::OnStartTests(UINT nMenuID)
{
// Calls all or indivdual test cases on the basis of the
// option selected from menu.
switch(nMenuID)
{
case ID_INTERFACES_NSIPROFILE_RUNALLTESTS :
RunAllTests();
break ;
case ID_INTERFACES_NSIPROFILE_GETPROFILECOUNT :
GetProfileCount();
break ;
case ID_INTERFACES_NSIPROFILE_GETCURRENTPROFILE :
GetCurrentProfile();
break ;
case ID_INTERFACES_NSIPROFILE_SETCURRENTPROFILE :
SetCurrentProfile();
break ;
case ID_INTERFACES_NSIPROFILE_GETPROFILELIST :
GetProfileList();
break ;
case ID_INTERFACES_NSIPROFILE_PROFILEEXISTS :
ProfileExists();
break ;
case ID_INTERFACES_NSIPROFILE_CREATENEWPROFILE :
CreateNewProfile();
break ;
case ID_INTERFACES_NSIPROFILE_RENAMEPROFILE :
RenameProfile();
break ;
case ID_INTERFACES_NSIPROFILE_DELETEPROFILE :
DeleteProfile();
break ;
case ID_INTERFACES_NSIPROFILE_CLONEPROFILE :
CloneProfile();
break ;
case ID_INTERFACES_NSIPROFILE_SHUTDOWNCURRENTPROFILE :
ShutDownCurrentProfile();
break ;
}
}
void CProfile::RunAllTests()
{
nsCOMPtr<nsIProfile> oNsProfile (do_GetService(NS_PROFILE_CONTRACTID,&rv));
RvTestResultDlg(rv, "do_GetService",true);
if (!oNsProfile)
{
RvTestResultDlg(rv, "Cannot get the nsIprofile object");
return ;
}
PRInt32 profileCount;
rv = oNsProfile->GetProfileCount(&profileCount);
RvTestResultDlg(rv, "nsIProfile::GetProfileCount() ");
nsXPIDLString currProfileName;
rv = oNsProfile->GetCurrentProfile(getter_Copies(currProfileName));
RvTestResultDlg(rv, "nsIProfile::GetCurrentProfile() ");
rv = oNsProfile->SetCurrentProfile(currProfileName);
RvTestResultDlg(rv, "nsIProfile::SetCurrentProfile() ");
PRUint32 listLen;
PRUnichar **profileList;
rv = oNsProfile->GetProfileList(&listLen, &profileList);
RvTestResultDlg(rv, "oNsProfile->GetProfileList");
for (PRUint32 index = 0; index < listLen; index++)
{
CString tmpStr(profileList[index]);
RvTestResultDlg(rv, tmpStr);
}
PRBool exists = FALSE;
rv = oNsProfile->ProfileExists(currProfileName, &exists);
RvTestResultDlg(rv, "oNsProfile->ProfileExists");
USES_CONVERSION ;
NS_NAMED_LITERAL_STRING(newProfileName, "New Test");
rv = oNsProfile->CreateNewProfile(newProfileName.get(), nsnull, nsnull, PR_TRUE);
RvTestResultDlg(rv, "oNsProfile->CreateNewProfile");
rv = oNsProfile->RenameProfile(currProfileName, T2W("New default"));
RvTestResultDlg(rv, "oNsProfile->RenameProfile");
rv = oNsProfile->DeleteProfile(currProfileName, PR_TRUE);
RvTestResultDlg(rv, "oNsProfile->DeleteProfile");
rv = oNsProfile->CloneProfile(currProfileName);
RvTestResultDlg(rv, "oNsProfile->CloneProfile");
}
void CProfile::GetProfileCount()
{
nsCOMPtr<nsIProfile> oNsProfile (do_GetService(NS_PROFILE_CONTRACTID,&rv));
RvTestResultDlg(rv, "do_GetService",true);
if (!oNsProfile)
{
RvTestResultDlg(rv, "Cannot get the nsIprofile object");
return ;
}
PRInt32 profileCount;
rv = oNsProfile->GetProfileCount(&profileCount);
RvTestResultDlg(rv, "nsIProfile::GetProfileCount() ");
}
void CProfile::GetCurrentProfile()
{
nsCOMPtr<nsIProfile> oNsProfile (do_GetService(NS_PROFILE_CONTRACTID,&rv));
RvTestResultDlg(rv, "do_GetService",true);
if (!oNsProfile)
{
RvTestResultDlg(rv, "Cannot get the nsIprofile object");
return ;
}
nsXPIDLString currProfileName;
rv = oNsProfile->GetCurrentProfile(getter_Copies(currProfileName));
RvTestResultDlg(rv, "nsIProfile::GetCurrentProfile() ");
}
void CProfile::SetCurrentProfile()
{
nsCOMPtr<nsIProfile> oNsProfile (do_GetService(NS_PROFILE_CONTRACTID,&rv));
RvTestResultDlg(rv, "do_GetService",true);
if (!oNsProfile)
{
RvTestResultDlg(rv, "Cannot get the nsIprofile object");
return ;
}
nsXPIDLString currProfileName;
rv = oNsProfile->GetCurrentProfile(getter_Copies(currProfileName));
RvTestResultDlg(rv, "nsIProfile::GetCurrentProfile() ");
rv = oNsProfile->SetCurrentProfile(currProfileName);
RvTestResultDlg(rv, "nsIProfile::SetCurrentProfile() ");
}
void CProfile::GetProfileList()
{
nsCOMPtr<nsIProfile> oNsProfile (do_GetService(NS_PROFILE_CONTRACTID,&rv));
RvTestResultDlg(rv, "do_GetService",true);
if (!oNsProfile)
{
RvTestResultDlg(rv, "Cannot get the nsIprofile object");
return ;
}
PRUint32 listLen;
PRUnichar **profileList;
rv = oNsProfile->GetProfileList(&listLen, &profileList);
RvTestResultDlg(rv, "oNsProfile->GetProfileList");
for (PRUint32 index = 0; index < listLen; index++)
{
CString tmpStr(profileList[index]);
RvTestResultDlg(rv, tmpStr);
}
}
void CProfile::ProfileExists()
{
nsCOMPtr<nsIProfile> oNsProfile (do_GetService(NS_PROFILE_CONTRACTID,&rv));
RvTestResultDlg(rv, "do_GetService",true);
if (!oNsProfile)
{
RvTestResultDlg(rv, "Cannot get the nsIprofile object");
return ;
}
nsXPIDLString currProfileName;
rv = oNsProfile->GetCurrentProfile(getter_Copies(currProfileName));
RvTestResultDlg(rv, "nsIProfile::GetCurrentProfile() ");
PRBool exists = FALSE;
rv = oNsProfile->ProfileExists(currProfileName, &exists);
RvTestResultDlg(rv, "oNsProfile->ProfileExists");
}
void CProfile::CreateNewProfile()
{
nsCOMPtr<nsIProfile> oNsProfile (do_GetService(NS_PROFILE_CONTRACTID,&rv));
RvTestResultDlg(rv, "do_GetService",true);
if (!oNsProfile)
{
RvTestResultDlg(rv, "Cannot get the nsIprofile object");
return ;
}
USES_CONVERSION ;
rv = oNsProfile->CreateNewProfile(T2W("New Test"), nsnull, nsnull, PR_TRUE);
RvTestResultDlg(rv, "oNsProfile->CreateNewProfile");
}
void CProfile::RenameProfile()
{
nsCOMPtr<nsIProfile> oNsProfile (do_GetService(NS_PROFILE_CONTRACTID,&rv));
RvTestResultDlg(rv, "do_GetService",true);
if (!oNsProfile)
{
RvTestResultDlg(rv, "Cannot get the nsIprofile object");
return ;
}
USES_CONVERSION ;
nsXPIDLString currProfileName;
rv = oNsProfile->GetCurrentProfile(getter_Copies(currProfileName));
RvTestResultDlg(rv, "nsIProfile::GetCurrentProfile() ");
rv = oNsProfile->RenameProfile(currProfileName, T2W("New default"));
RvTestResultDlg(rv, "oNsProfile->RenameProfile");
}
void CProfile::DeleteProfile()
{
nsCOMPtr<nsIProfile> oNsProfile (do_GetService(NS_PROFILE_CONTRACTID,&rv));
RvTestResultDlg(rv, "do_GetService",true);
if (!oNsProfile)
{
RvTestResultDlg(rv, "Cannot get the nsIprofile object");
return ;
}
USES_CONVERSION ;
nsXPIDLString currProfileName;
rv = oNsProfile->GetCurrentProfile(getter_Copies(currProfileName));
RvTestResultDlg(rv, "nsIProfile::GetCurrentProfile() ");
rv = oNsProfile->DeleteProfile(currProfileName, PR_TRUE);
RvTestResultDlg(rv, "oNsProfile->DeleteProfile");
}
void CProfile::CloneProfile()
{
nsCOMPtr<nsIProfile> oNsProfile (do_GetService(NS_PROFILE_CONTRACTID,&rv));
RvTestResultDlg(rv, "do_GetService",true);
if (!oNsProfile)
{
RvTestResultDlg(rv, "Cannot get the nsIprofile object");
return ;
}
USES_CONVERSION ;
nsXPIDLString currProfileName;
rv = oNsProfile->GetCurrentProfile(getter_Copies(currProfileName));
RvTestResultDlg(rv, "nsIProfile::GetCurrentProfile() ");
rv = oNsProfile->CloneProfile(currProfileName);
RvTestResultDlg(rv, "oNsProfile->CloneProfile");
}
void CProfile::ShutDownCurrentProfile()
{
nsCOMPtr<nsIProfile> oNsProfile (do_GetService(NS_PROFILE_CONTRACTID,&rv));
RvTestResultDlg(rv, "do_GetService",true);
if (!oNsProfile)
{
RvTestResultDlg(rv, "Cannot get the nsIprofile object");
return ;
}
}

Просмотреть файл

@ -0,0 +1,58 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Header file for nsIProfile interface test cases
class CProfile
{
public:
CProfile(nsIWebBrowser* mWebBrowser);
public:
~CProfile();
public:
nsCOMPtr<nsIWebBrowser> qaWebBrowser ;
// Place Test Cases Here
void OnStartTests(UINT nMenuID);
void RunAllTests();
void GetProfileCount();
void GetCurrentProfile();
void SetCurrentProfile();
void GetProfileList();
void ProfileExists();
void CreateNewProfile();
void RenameProfile();
void DeleteProfile();
void CloneProfile();
void ShutDownCurrentProfile();
private:
protected:
};

Просмотреть файл

@ -0,0 +1,159 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Test cases for the nsiDirectoryService Interface
#include "stdafx.h"
#include "TestEmbed.h"
#include "BrowserImpl.h"
#include "BrowserFrm.h"
#include "UrlDialog.h"
#include "ProfileMgr.h"
#include "ProfilesDlg.h"
#include "QaUtils.h"
#include "nsiDirServ.h"
#include "nsIDirectoryService.h"
#include "winEmbedFileLocProvider.h"
#include <stdio.h>
/////////////////////////////////////////////////////////////////////////////
// CNsIDirectoryService
CNsIDirectoryService::CNsIDirectoryService()
{
}
/*CNsIDirectoryService::CNsIDirectoryService(nsIWebBrowser* mWebBrowser,
nsIBaseWindow* mBaseWindow,
nsIWebNavigation* mWebNav,
CBrowserImpl *mpBrowserImpl):CTests(mWebBrowser,mBaseWindow,mWebNav,mpBrowserImpl)
{
}
*/
CNsIDirectoryService::~CNsIDirectoryService()
{
}
/*
BEGIN_MESSAGE_MAP(CNsIDirectoryService, CTests)
//{{AFX_MSG_MAP(CNsIDirectoryService)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
*/
/////////////////////////////////////////////////////////////////////////////
// CNsIDirectoryService message handlers
// ***********************************************************************
// ***********************************************************************
// NsIDirectoryService iface
void CNsIDirectoryService::StartTests(UINT nMenuID)
{
QAOutput("------------------------------------------------",1);
QAOutput("Start DirectoryService Test",1);
// Calls all or indivdual test cases on the basis of the
// option selected from menu.
switch(nMenuID)
{
case ID_INTERFACES_NSIDIRECTORYSERVICE_RUNALLTESTS :
Init();
RegisterProvider();
UnRegisterProvider();
break ;
case ID_INTERFACES_NSIDIRECTORYSERVICE_INIT :
Init();
break ;
case ID_INTERFACES_NSIDIRECTORYSERVICE_REGISTERPROVIDER :
RegisterProvider();
break ;
case ID_INTERFACES_NSIDIRECTORYSERVICE_UNREGISTERPROVIDER :
UnRegisterProvider();
break ;
default :
AfxMessageBox("Menu handler not added for this menu item");
break ;
}
}
void CNsIDirectoryService::Init()
{
nsCOMPtr<nsIDirectoryService> theDirService(do_CreateInstance(NS_DIRECTORY_SERVICE_CONTRACTID));
if (!theDirService)
{
QAOutput("Directory Service object doesn't exist.", 0);
return;
}
rv = theDirService->Init();
RvTestResult(rv, "rv Init() test", 1);
}
void CNsIDirectoryService::RegisterProvider()
{
nsCOMPtr<nsIDirectoryService> theDirService(do_CreateInstance(NS_DIRECTORY_SERVICE_CONTRACTID));
winEmbedFileLocProvider *provider = new winEmbedFileLocProvider("TestEmbed");
if (!theDirService)
{
QAOutput("Directory Service object doesn't exist.", 0);
return;
}
if (!provider)
{
QAOutput("Directory Service Provider object doesn't exist.", 0);
return;
}
rv= theDirService->RegisterProvider(provider);
RvTestResult(rv, "rv RegisterProvider() test", 1);
}
void CNsIDirectoryService::UnRegisterProvider()
{
nsCOMPtr<nsIDirectoryService> theDirService(do_CreateInstance(NS_DIRECTORY_SERVICE_CONTRACTID));
winEmbedFileLocProvider *provider = new winEmbedFileLocProvider("TestEmbed");
if (!theDirService)
{
QAOutput("Directory Service object doesn't exist.", 0);
return;
}
if (!provider)
{
QAOutput("Directory Service Provider object doesn't exist.", 0);
return;
}
rv= theDirService->RegisterProvider(provider);
rv= theDirService->UnregisterProvider(provider);
RvTestResult(rv, "rv UnRegisterProvider() test", 1);
}

Просмотреть файл

@ -0,0 +1,67 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Header file for NsIDirectoryService interface test cases
//#include "Tests.h"
/////////////////////////////////////////////////////////////////////////////
// CNsIDirectoryService window
class CNsIDirectoryService
{
// Construction
public:
CNsIDirectoryService();
/* CNsIDirectoryService(nsIWebBrowser* mWebBrowser,
nsIBaseWindow* mBaseWindow,
nsIWebNavigation* mWebNav,
CBrowserImpl *mpBrowserImpl);
*/
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNsIDirectoryService)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CNsIDirectoryService();
public:
// Place the test cases here
void StartTests(UINT nMenuID);
void Init() ;
void RegisterProvider();
void UnRegisterProvider();
// Generated message map functions
protected:
};
/////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -0,0 +1,307 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* David Epstein <depstein@netscape.com>
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Test cases for the nsiHistory Interface
#include "stdafx.h"
#include "TestEmbed.h"
#include "BrowserImpl.h"
#include "BrowserFrm.h"
#include "UrlDialog.h"
#include "ProfileMgr.h"
#include "ProfilesDlg.h"
#include "QaUtils.h"
#include "tests.h"
#include <stdio.h>
/////////////////////////////////////////////////////////////////////////////
// CNsIHistory
CNsIHistory::CNsIHistory(CTests *mTests)
{
qaTests = mTests;
//qaWebNav = mWebNav ;
}
CNsIHistory::~CNsIHistory()
{
}
BEGIN_MESSAGE_MAP(CNsIHistory, CWnd)
//{{AFX_MSG_MAP(CNsIHistory)
ON_COMMAND(ID_INTERFACES_NSISHISTORY, OnInterfacesNsishistory)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNsIHistory message handlers
// ***********************************************************************
// ***********************************************************************
// nsIHistory iface
// ***********************************************************************
// ***********************************************************************
// nsISHistory & nsIHistoryEntry ifaces:
void CNsIHistory::OnInterfacesNsishistory()
{
//nsresult rv;
PRInt32 numEntries = 5;
PRInt32 theIndex;
PRInt32 theMaxLength = 100;
CString shString;
nsCOMPtr<nsISHistory> theSessionHistory;
nsCOMPtr<nsIHistoryEntry> theHistoryEntry;
//nsCOMPtr<nsIURI> theUri;
// do_QueryInterface
// NS_HISTORYENTRY_CONTRACTID
// NS_SHISTORYLISTENER_CONTRACTID
// get Session History through web nav iface
if (qaTests->qaWebNav)
qaTests->qaWebNav->GetSessionHistory( getter_AddRefs(theSessionHistory));
if (!theSessionHistory)
{
QAOutput("theSessionHistory object wasn't created. No session history tests performed.", 2);
return;
}
else
QAOutput("theSessionHistory object was created.", 2);
// test count attribute in nsISHistory.idl
GetCountTest(theSessionHistory, &numEntries);
// test index attribute in nsISHistory.idl
GetIndexTest(theSessionHistory, &theIndex);
// test maxLength attribute in nsISHistory.idl
SetMaxLengthTest(theSessionHistory, theMaxLength);
GetMaxLengthTest(theSessionHistory, &theMaxLength);
QAOutput("Start nsiHistoryEntry tests.", 2);
// get theHistoryEntry object
theSessionHistory->GetEntryAtIndex(0, PR_FALSE, getter_AddRefs(theHistoryEntry));
if (!theHistoryEntry)
QAOutput("We didn't get the History Entry object.", 1);
else
{
QAOutput("We have the History Entry object!", 1);
// getEntryAtIndex() tests
for (theIndex = 0; theIndex < numEntries; theIndex++)
{
FormatAndPrintOutput("the index = ", theIndex, 2);
//GetEntryAtIndexTest(theSessionHistory,theHistoryEntry, theIndex);
theSessionHistory->GetEntryAtIndex(theIndex, PR_FALSE, getter_AddRefs(theHistoryEntry));
// nsiHistoryEntry.idl tests
// test URI attribute in nsIHistoryEntry.idl
GetURIHistTest(theHistoryEntry);
// test title attribute in nsIHistoryEntry.idl
GetTitleHistTest(theHistoryEntry);
// test isSubFrame attribute in nsIHistoryEntry.idl
GetIsSubFrameTest(theHistoryEntry);
} // end for loop
} // end outer else
// test SHistoryEnumerator attribute in nsISHistory.idl
nsCOMPtr<nsISimpleEnumerator> theSimpleEnum;
// GetSHEnumTest(theSessionHistory, theSimpleEnum);
rv = theSessionHistory->GetSHistoryEnumerator(getter_AddRefs(theSimpleEnum));
if (!theSimpleEnum)
QAOutput("theSimpleEnum for GetSHistoryEnumerator() invalid. Test failed.", 1);
else
RvTestResult(rv, "GetSHistoryEnumerator() (SHistoryEnumerator attribute) test", 2);
SimpleEnumTest(theSimpleEnum);
// PurgeHistory() test
PurgeHistoryTest(theSessionHistory, numEntries);
}
// ***********************************************************************
// Individual nsISHistory tests
void CNsIHistory::GetCountTest(nsISHistory *theSessionHistory, PRInt32 *numEntries)
{
rv = theSessionHistory->GetCount(numEntries);
if (*numEntries < 0)
QAOutput("numEntries for GetCount() < 0. Test failed.", 1);
else {
FormatAndPrintOutput("number of entries = ", *numEntries, 2);
RvTestResult(rv, "GetCount() (count attribute) test", 2);
}
}
void CNsIHistory::GetIndexTest(nsISHistory *theSessionHistory, PRInt32 *theIndex)
{
rv = theSessionHistory->GetIndex(theIndex);
if (*theIndex <0)
QAOutput("theIndex for GetIndex() < 0. Test failed.", 1);
else
RvTestResult(rv, "GetIndex() (index attribute) test", 2);
}
void CNsIHistory::SetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 theMaxLength)
{
rv = theSessionHistory->SetMaxLength(theMaxLength);
RvTestResult(rv, "SetMaxLength() (MaxLength attribute) test", 2);
}
void CNsIHistory::GetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 *theMaxLength)
{
rv = theSessionHistory->GetMaxLength(theMaxLength);
if (*theMaxLength<0)
QAOutput("theMaxLength for GetMaxLength() < 0. Test failed.", 1);
else {
FormatAndPrintOutput("theMaxLength = ", *theMaxLength, 2);
RvTestResult(rv, "GetMaxLength() (MaxLength attribute) test", 2);
}
}
/*void CNsIHistory::GetEntryAtIndexTest(nsISHistory *theSessionHistory,
nsIHistoryEntry *theHistoryEntry,
PRInt32 theIndex)
{
theSessionHistory->GetEntryAtIndex(theIndex, PR_FALSE,&theHistoryEntry);
// test URI attribute in nsIHistoryEntry.idl
//GetURIHistTest(theHistoryEntry);
// test title attribute in nsIHistoryEntry.idl
//GetTitleHistTest(theHistoryEntry);
// test isSubFrame attribute in nsIHistoryEntry.idl
//GetIsSubFrameTest(theHistoryEntry);
}*/
void CNsIHistory::GetURIHistTest(nsIHistoryEntry* theHistoryEntry)
{
rv = theHistoryEntry->GetURI(getter_AddRefs(qaTests->theUri));
if (!qaTests->theUri)
QAOutput("theUri for GetURI() invalid. Test failed.", 1);
else
{
RvTestResult(rv, "GetURI() (URI attribute) test", 1);
rv = qaTests->theUri->GetSpec(&uriSpec);
if (NS_FAILED(rv))
QAOutput("We didn't get the uriSpec.", 1);
else
FormatAndPrintOutput("The SH Url = ", uriSpec, 2);
}
}
void CNsIHistory::GetTitleHistTest(nsIHistoryEntry* theHistoryEntry)
{
nsXPIDLString theTitle;
const char * titleCString;
rv = theHistoryEntry->GetTitle(getter_Copies(theTitle));
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);
}
void CNsIHistory::GetIsSubFrameTest(nsIHistoryEntry* theHistoryEntry)
{
PRBool isSubFrame;
rv = theHistoryEntry->GetIsSubFrame(&isSubFrame);
RvTestResult(rv, "GetIsSubFrame() (isSubFrame attribute) test", 1);
FormatAndPrintOutput("The subFrame boolean value = ", isSubFrame, 2);
}
/*
void CNsIHistory::GetSHEnumTest(nsISHistory *theSessionHistory,
nsISimpleEnumerator *theSimpleEnum)
{
rv = theSessionHistory->GetSHistoryEnumerator(getter_AddRefs(theSimpleEnum));
if (!theSimpleEnum)
QAOutput("theSimpleEnum for GetSHistoryEnumerator() invalid. Test failed.", 1);
else
RvTestResult(rv, "GetSHistoryEnumerator() (SHistoryEnumerator attribute) test", 2);
}
*/
void CNsIHistory::SimpleEnumTest(nsISimpleEnumerator *theSimpleEnum)
{
PRBool bMore = PR_FALSE;
nsCOMPtr<nsISupports> nextObj;
nsCOMPtr<nsIHistoryEntry> nextHistoryEntry;
while (NS_SUCCEEDED(theSimpleEnum->HasMoreElements(&bMore)) && bMore)
{
theSimpleEnum->GetNext(getter_AddRefs(nextObj));
if (!nextObj)
continue;
nextHistoryEntry = do_QueryInterface(nextObj);
if (!nextHistoryEntry)
continue;
rv = nextHistoryEntry->GetURI(getter_AddRefs(qaTests->theUri));
rv = qaTests->theUri->GetSpec(&uriSpec);
if (!uriSpec)
QAOutput("uriSpec for GetSpec() invalid. Test failed.", 1);
else
FormatAndPrintOutput("The SimpleEnum URL = ", uriSpec, 2);
}
}
void CNsIHistory::PurgeHistoryTest(nsISHistory* theSessionHistory, PRInt32 numEntries)
{
rv = theSessionHistory->PurgeHistory(numEntries);
RvTestResult(rv, "PurgeHistory() test", 2);
FormatAndPrintOutput("Number of removed entries = ", numEntries, 2);
}

Просмотреть файл

@ -0,0 +1,86 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* David Epstein <depstein@netscape.com>
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Header file for nsiHistory interface test cases
/////////////////////////////////////////////////////////////////////////////
// CNsIHistory window
class CNsIHistory : public CWnd
{
// Construction
public:
CNsIHistory(CTests *mTests);
// Attributes
public:
// Mozilla interfaces
//
//nsCOMPtr<nsIWebNavigation> qaWebNav;
//nsCOMPtr<nsIURI> theUri;
char *uriSpec;
CTests *qaTests ;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNsIHistory)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CNsIHistory();
public:
// individual nsISHistory tests
void GetCountTest(nsISHistory *, PRInt32 *);
void GetIndexTest(nsISHistory *, PRInt32 *);
void GetMaxLengthTest(nsISHistory *, PRInt32 *);
void SetMaxLengthTest(nsISHistory *, PRInt32);
void GetEntryAtIndexTest(nsISHistory *, nsIHistoryEntry *, PRInt32 theIndex);
void GetURIHistTest(nsIHistoryEntry *);
void GetTitleHistTest(nsIHistoryEntry *);
void GetIsSubFrameTest(nsIHistoryEntry *);
void GetSHEnumTest(nsISHistory*, nsISimpleEnumerator *);
void SimpleEnumTest(nsISimpleEnumerator *);
void PurgeHistoryTest(nsISHistory *, PRInt32);
// Generated message map functions
protected:
//{{AFX_MSG(CNsIHistory)
afx_msg void OnInterfacesNsishistory();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -0,0 +1,246 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* David Epstein <depstein@netscape.com>
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Test cases for the nsiRequest Interface
#include "stdafx.h"
#include "TestEmbed.h"
#include "BrowserImpl.h"
#include "BrowserFrm.h"
#include "UrlDialog.h"
#include "ProfileMgr.h"
#include "ProfilesDlg.h"
#include "QaUtils.h"
#include "nsirequest.h"
#include <stdio.h>
/////////////////////////////////////////////////////////////////////////////
// CNsIRequest
/*CNsIRequest::CNsIRequest(nsIWebBrowser* mWebBrowser,
nsIBaseWindow* mBaseWindow,
nsIWebNavigation* mWebNav,
CBrowserImpl *mpBrowserImpl):CTests(mWebBrowser,mBaseWindow,mWebNav,mpBrowserImpl)
{
}*/
CNsIRequest::CNsIRequest(nsIWebBrowser* mWebBrowser,CBrowserImpl *mpBrowserImpl)
{
qaWebBrowser = mWebBrowser ;
qaBrowserImpl = mpBrowserImpl ;
}
CNsIRequest::~CNsIRequest()
{
}
/*BEGIN_MESSAGE_MAP(CNsIRequest, CTests)
//{{AFX_MSG_MAP(CNsIRequest)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()*/
/////////////////////////////////////////////////////////////////////////////
// CNsIRequest message handlers
// ***********************************************************************
// ***********************************************************************
// nsIRequest iface
// table columns corrsp to: pending, status, suspend, resume, cancel,
// setLoadGroup & getLoadGroup tests respectively.
Element UrlTable_Temp[] = {
{"http://www.netscape.com", 1, 1, 0, 0, 0, 1, 1},
{"http://www.yahoo.com", 0, 0, 1, 1, 0, 0, 0},
{"http://www.cisco.com", 0, 0, 0, 0, 1, 0, 0},
{"http://www.sun.com", 0, 0, 0, 0, 0, 1, 1},
{"http://www.intel.com", 1, 1, 1, 0, 0, 0, 0},
{"http://www.aol.com", 0, 1, 0, 0, 0, 1, 1}
};
void CNsIRequest::OnInterfacesNsirequest()
{
// note: nsIRequest tests are called:
// 1) in BrowserImpl.cpp, nsIStreamListener::OnDataAvailable()
// 2) as individual tests below
nsCString theSpec;
nsCOMPtr<nsIURI> theURI;
nsCOMPtr<nsIChannel> theChannel;
nsCOMPtr<nsILoadGroup> theLoadGroup(do_CreateInstance(NS_LOADGROUP_CONTRACTID));
int i=0;
QAOutput("Start nsIRequest tests.", 2);
// theSpec = "http://www.netscape.com";
for (i=0; i<6; i++)
{
theSpec = UrlTable_Temp[i].theUrl;
FormatAndPrintOutput("the uri spec = ", theSpec, 2);
rv = NS_NewURI(getter_AddRefs(theURI), theSpec);
if (!theURI)
{
QAOutput("We didn't get the URI. Test failed.", 1);
return;
}
else
RvTestResult(rv, "NS_NewURI", 1);
rv = NS_OpenURI(getter_AddRefs(theChannel), theURI, nsnull, theLoadGroup);
if (!theChannel)
{
QAOutput("We didn't get the Channel. Test failed.", 1);
return;
}
else if (!theLoadGroup)
{
QAOutput("We didn't get the Load Group. Test failed.", 2);
return;
}
else
RvTestResult(rv, "NS_OpenURI", 1);
nsCOMPtr<nsIStreamListener> listener(NS_STATIC_CAST(nsIStreamListener*, qaBrowserImpl));
nsCOMPtr<nsIWeakReference> 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()", 1);
// nsIRequest individual tests
QAOutput("***** Individual nsIRequest test begins. *****");
nsCOMPtr<nsIRequest> theRequest = do_QueryInterface(theChannel);
if (UrlTable_Temp[i].reqPend == TRUE)
IsPendingReqTest(theRequest);
if (UrlTable_Temp[i].reqStatus == TRUE)
GetStatusReqTest(theRequest);
if (UrlTable_Temp[i].reqSuspend == TRUE)
SuspendReqTest(theRequest);
if (UrlTable_Temp[i].reqResume == TRUE)
ResumeReqTest(theRequest);
if (UrlTable_Temp[i].reqCancel == TRUE)
CancelReqTest(theRequest);
if (UrlTable_Temp[i].reqSetLoadGroup == TRUE)
SetLoadGroupTest(theRequest, theLoadGroup);
if (UrlTable_Temp[i].reqGetLoadGroup == TRUE)
GetLoadGroupTest(theRequest);
QAOutput("- - - - - - - - - - - - - - - - - - - - -", 1);
} // end for loop
QAOutput("End nsIRequest tests.", 2);
}
void CNsIRequest::IsPendingReqTest(nsIRequest *request)
{
PRBool reqPending;
nsresult rv;
rv = request->IsPending(&reqPending);
RvTestResult(rv, "nsIRequest::IsPending() rv test", 1);
if (!reqPending)
QAOutput("Pending request = false.", 1);
else
QAOutput("Pending request = true.", 1);
}
void CNsIRequest::GetStatusReqTest(nsIRequest *request)
{
nsresult theStatusError;
nsresult rv;
rv = request->GetStatus(&theStatusError);
RvTestResult(rv, "nsIRequest::GetStatus() test", 1);
RvTestResult(rv, "the returned status error test", 1);
}
void CNsIRequest::SuspendReqTest(nsIRequest *request)
{
nsresult rv;
rv = request->Suspend();
RvTestResult(rv, "nsIRequest::Suspend() test", 1);
}
void CNsIRequest::ResumeReqTest(nsIRequest *request)
{
nsresult rv;
rv = request->Resume();
RvTestResult(rv, "nsIRequest::Resume() test", 1);
}
void CNsIRequest::CancelReqTest(nsIRequest *request)
{
nsresult rv;
nsresult status = NS_BINDING_ABORTED;
rv = request->Cancel(status);
RvTestResult(rv, "nsIRequest::Cancel() rv test", 1);
RvTestResult(status, "nsIRequest::Cancel() status test", 1);
}
void CNsIRequest::SetLoadGroupTest(nsIRequest *request,
nsILoadGroup *theLoadGroup)
{
nsresult rv;
nsCOMPtr<nsISimpleEnumerator> theSimpEnum;
rv = request->SetLoadGroup(theLoadGroup);
RvTestResult(rv, "nsIRequest::SetLoadGroup() rv test", 1);
}
void CNsIRequest::GetLoadGroupTest(nsIRequest *request)
{
nsCOMPtr<nsILoadGroup> theLoadGroup;
nsresult rv;
nsCOMPtr<nsISimpleEnumerator> theSimpEnum;
rv = request->GetLoadGroup(getter_AddRefs(theLoadGroup));
RvTestResult(rv, "nsIRequest::GetLoadGroup() rv test", 1);
rv = theLoadGroup->GetRequests(getter_AddRefs(theSimpEnum));
RvTestResult(rv, "nsIRequest:: LoadGroups' GetRequests() rv test", 1);
}

Просмотреть файл

@ -0,0 +1,96 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* David Epstein <depstein@netscape.com>
* Ashish Bhatt <ashishbhatt@netscape.com>
*/
// File Overview....
//
// Header file for nsiRequest interface test cases
#include "Tests.h"
/////////////////////////////////////////////////////////////////////////////
// CNsIRequest window
class CNsIRequest //: public CTests
{
// Construction
public:
/* CNsIRequest(nsIWebBrowser* mWebBrowser,
nsIBaseWindow* mBaseWindow,
nsIWebNavigation* mWebNav,
CBrowserImpl *mpBrowserImpl);
*/
CNsIRequest(nsIWebBrowser* mWebBrowser,CBrowserImpl *mpBrowserImpl);
// Attributes
public:
// Mozilla interfaces
//
nsCOMPtr<nsIWebBrowser> qaWebBrowser;
CBrowserImpl *qaBrowserImpl;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNsIRequest)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CNsIRequest();
public:
void OnInterfacesNsirequest();
// 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 *);
// Generated message map functions
protected:
/* //{{AFX_MSG(CNsIRequest)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()*/
};
typedef struct
{
char theUrl[1024];
bool reqPend;
bool reqStatus;
bool reqSuspend;
bool reqResume;
bool reqCancel;
bool reqSetLoadGroup;
bool reqGetLoadGroup;
} Element;
/////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -20,6 +20,7 @@
#define IDD_PREFS_START_PAGE 142
#define IDD_URLDIALOG 144
#define IDD_DIALOG1 145
#define IDD_RUNTESTSDLG 145
#define ID_URL_BAR 1001
#define ID_PROG_BAR 1002
#define IDC_PROMPT_ANSWER 1003
@ -81,6 +82,61 @@
#define ID_TOOLS_TESTYOURMETHOD 32801
#define ID_TOOLS_TESTYOURMETHOD2 32802
#define ID_INTERFACES_NSIREQUEST 32803
#define ID_INTERFACES_TEMP 32804
#define ID_INTERFACES_NSIDOMWINDOW_RUNALLTESTS 32808
#define ID_INTERFACES_NSIDOMWINDOW_GETDOMDOCUMENT 32809
#define ID_INTERFACES_NSIDOMWINDOW_GETPARENT 32810
#define ID_INTERFACES_NSIDOMWINDOW_GETSCROLLBARS 32811
#define ID_INTERFACES_NSIDOMWINDOW_GETFRAMES 32812
#define ID_INTERFACES_NSIDOMWINDOW_GETNAME 32813
#define ID_INTERFACES_NSIDOMWINDOW_GETSCSOLLX 32814
#define ID_INTERFACES_NSIDOMWINDOW_GETSCROLLY 32815
#define ID_INTERFACES_NSIDOMWINDOW_SCROLLTO 32816
#define ID_INTERFACES_NSIDOMWINDOW_SCROLLBY 32817
#define ID_INTERFACES_NSIDOMWINDOW_GETSELECTION 32818
#define ID_INTERFACES_NSIDOMWINDOW_SCROLLBYLINES 32819
#define ID_INTERFACES_NSIDOMWINDOW_SCROLLBYPAGES 32820
#define ID_INTERFACES_NSIDOMWINDOW_SIZETOCONTENT 32821
#define ID_INTERFACES_NSIDIRECTORYSERVICE_RUNALLTESTS 32826
#define ID_INTERFACES_NSIDIRECTORYSERVICE_INIT 32827
#define ID_INTERFACES_NSIDIRECTORYSERVICE_REGISTERPROVIDER 32828
#define ID_INTERFACES_NSIDIRECTORYSERVICE_UNREGISTERPROVIDER 32829
#define ID_INTERFACES_NSISELECTION_RUNALLTESTS 32832
#define ID_VERIFYBUGS_90195 32833
#define ID_INTERFACES_CALLBACKS_NSISTREAMLISTENER 32834
#define ID_INTERFACES_CALLBACKS_NSIREQUESTOBSERVER 32835
#define ID_INTERFACES_CALLBACKS_NSISTREAMOBSERVER 32836
#define ID_INTERFACES_NSISELECTION_GETANCHORNODE 32837
#define ID_INTERFACES_NSISELECTION_GETANCHOROFFSET 32838
#define ID_INTERFACES_NSISELECTION_GETFOCUSNODE 32839
#define ID_INTERFACES_NSISELECTION_GETFOCUSOFFSET 32840
#define ID_INTERFACES_NSISELECTION_GETISCOLLAPSED 32841
#define ID_INTERFACES_NSISELECTION_GETRANGECOUNT 32842
#define ID_INTERFACES_NSISELECTION_GETRANGEAT 32843
#define ID_INTERFACES_NSISELECTION_COLLAPSE 32844
#define ID_INTERFACES_NSISELECTION_EXTEND 32845
#define ID_INTERFACES_NSISELECTION_COLLAPSETOSTART 32846
#define ID_INTERFACES_NSISELECTION_COLLAPSETOEND 32847
#define ID_INTERFACES_NSISELECTION_CONTAINSNODE 32848
#define ID_INTERFACES_NSISELECTION_SELECTALLCHILDREN 32849
#define ID_INTERFACES_NSISELECTION_ADDRANGE 32850
#define ID_INTERFACES_NSISELECTION_REMOVERANGE 32851
#define ID_INTERFACES_NSISELECTION_REMOVEALLRANGES 32852
#define ID_INTERFACES_NSISELECTION_DELETEFROMDOCUMENT 32853
#define ID_INTERFACES_NSISELECTION_SELECTIONLANGUAGECHANGE 32854
#define ID_INTERFACES_NSISELECTION_TOSTRING 32855
#define ID_INTERFACES_NSISELECTION_A 32857
#define ID_INTERFACES_NSIPROFILE_RUNALLTESTS 32858
#define ID_INTERFACES_NSIPROFILE_GETPROFILECOUNT 32859
#define ID_INTERFACES_NSIPROFILE_GETCURRENTPROFILE 32860
#define ID_INTERFACES_NSIPROFILE_SETCURRENTPROFILE 32861
#define ID_INTERFACES_NSIPROFILE_GETPROFILELIST 32862
#define ID_INTERFACES_NSIPROFILE_PROFILEEXISTS 32863
#define ID_INTERFACES_NSIPROFILE_CREATENEWPROFILE 32864
#define ID_INTERFACES_NSIPROFILE_RENAMEPROFILE 32865
#define ID_INTERFACES_NSIPROFILE_DELETEPROFILE 32866
#define ID_INTERFACES_NSIPROFILE_CLONEPROFILE 32867
#define ID_INTERFACES_NSIPROFILE_SHUTDOWNCURRENTPROFILE 32868
#define ID_CLIPBOARDCMD_PASTE 42789
#define ID_CLIPBOARDCMD_COPYSELECTION 42790
#define ID_CLIPBOARDCMD_SELECTALL 42791
@ -97,8 +153,8 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 146
#define _APS_NEXT_COMMAND_VALUE 32804
#define _APS_NEXT_CONTROL_VALUE 1024
#define _APS_NEXT_COMMAND_VALUE 32869
#define _APS_NEXT_CONTROL_VALUE 1025
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Двоичные данные
embedding/qa/testembed/testembed.aps

Двоичный файл не отображается.

Просмотреть файл

@ -1,10 +1,10 @@
# Microsoft Developer Studio Project File - Name="mfcembed" - Package Owner=<4>
# Microsoft Developer Studio Project File - Name="testembed" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) External Target" 0x0106
CFG=mfcembed - Win32 Debug
CFG=testembed - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@ -13,12 +13,12 @@ CFG=mfcembed - Win32 Debug
!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 "testembed.mak" CFG="mfcembed - Win32 Debug"
!MESSAGE NMAKE /f "testembed.mak" CFG="testembed - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mfcembed - Win32 Release" (based on "Win32 (x86) External Target")
!MESSAGE "mfcembed - Win32 Debug" (based on "Win32 (x86) External Target")
!MESSAGE "testembed - Win32 Release" (based on "Win32 (x86) External Target")
!MESSAGE "testembed - Win32 Debug" (based on "Win32 (x86) External Target")
!MESSAGE
# Begin Project
@ -26,16 +26,16 @@ CFG=mfcembed - Win32 Debug
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
!IF "$(CFG)" == "mfcembed - Win32 Release"
!IF "$(CFG)" == "testembed - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Cmd_Line "NMAKE /f mfcembed.mak"
# PROP BASE Cmd_Line "NMAKE /f testembed.mak"
# PROP BASE Rebuild_Opt "/a"
# PROP BASE Target_File "mfcembed.exe"
# PROP BASE Bsc_Name "mfcembed.bsc"
# PROP BASE Target_File "testembed.exe"
# PROP BASE Bsc_Name "testembed.bsc"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
@ -43,20 +43,20 @@ CFG=mfcembed - Win32 Debug
# PROP Intermediate_Dir "Release"
# PROP Cmd_Line "nmake /f "makfile.win""
# PROP Rebuild_Opt "/a"
# PROP Target_File "WIN32_O.OBJ\mfcembed.exe"
# PROP Target_File "WIN32_O.OBJ\testembed.exe"
# PROP Bsc_Name ""
# PROP Target_Dir ""
!ELSEIF "$(CFG)" == "mfcembed - Win32 Debug"
!ELSEIF "$(CFG)" == "testembed - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Cmd_Line "NMAKE /f mfcembed.mak"
# PROP BASE Cmd_Line "NMAKE /f testembed.mak"
# PROP BASE Rebuild_Opt "/a"
# PROP BASE Target_File "mfcembed.exe"
# PROP BASE Bsc_Name "mfcembed.bsc"
# PROP BASE Target_File "testembed.exe"
# PROP BASE Bsc_Name "testembed.bsc"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
@ -72,12 +72,12 @@ CFG=mfcembed - Win32 Debug
# Begin Target
# Name "mfcembed - Win32 Release"
# Name "mfcembed - Win32 Debug"
# Name "testembed - Win32 Release"
# Name "testembed - Win32 Debug"
!IF "$(CFG)" == "mfcembed - Win32 Release"
!IF "$(CFG)" == "testembed - Win32 Release"
!ELSEIF "$(CFG)" == "mfcembed - Win32 Debug"
!ELSEIF "$(CFG)" == "testembed - Win32 Debug"
!ENDIF
@ -122,10 +122,34 @@ SOURCE=.\Dialogs.cpp
# End Source File
# Begin Source File
SOURCE=.\DomWindow.cpp
# End Source File
# Begin Source File
SOURCE=.\MostRecentUrls.cpp
# End Source File
# Begin Source File
SOURCE=.\nsiDirServ.cpp
# End Source File
# Begin Source File
SOURCE=.\nsiHistory.cpp
# End Source File
# Begin Source File
SOURCE=.\nsIRequest.cpp
# End Source File
# Begin Source File
SOURCE=.\nsIWebNav.cpp
# End Source File
# Begin Source File
SOURCE=.\nsProfile.cpp
# End Source File
# Begin Source File
SOURCE=.\Preferences.cpp
# End Source File
# Begin Source File
@ -146,14 +170,21 @@ SOURCE=.\QaUtils.cpp
# End Source File
# Begin Source File
SOURCE=.\Selection.cpp
# End Source File
# Begin Source File
<<<<<<< testembed.dsp
SOURCE=.\StdAfx.cpp
# End Source File
# Begin Source File
=======
SOURCE=.\TestCallbacks.cpp
# End Source File
# Begin Source File
>>>>>>> 1.3
SOURCE=.\TestEmbed.cpp
# End Source File
# Begin Source File
@ -194,6 +225,10 @@ SOURCE=.\Dialogs.h
# End Source File
# Begin Source File
SOURCE=.\DomWindow.h
# End Source File
# Begin Source File
SOURCE=.\IBrowserFrameGlue.h
# End Source File
# Begin Source File
@ -202,6 +237,26 @@ SOURCE=.\MostRecentUrls.h
# End Source File
# Begin Source File
SOURCE=.\nsiDirServ.h
# End Source File
# Begin Source File
SOURCE=.\nsiHistory.h
# End Source File
# Begin Source File
SOURCE=.\nsIRequest.h
# End Source File
# Begin Source File
SOURCE=.\nsIWebNav.h
# End Source File
# Begin Source File
SOURCE=.\nsProfile.h
# End Source File
# Begin Source File
SOURCE=.\Preferences.h
# End Source File
# Begin Source File
@ -226,6 +281,10 @@ SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\Selection.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
@ -250,7 +309,7 @@ SOURCE=.\winEmbedFileLocProvider.h
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\mfcembed.ico
SOURCE=.\res\testembed.ico
# End Source File
# Begin Source File

Просмотреть файл

@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
###############################################################################
Project: "mfcembed"=.\mfcembed.dsp - Package Owner=<4>
Project: "testembed"=.\testembed.dsp - Package Owner=<4>
Package=<5>
{{{

Просмотреть файл

@ -160,6 +160,139 @@ BEGIN
MENUITEM "nsI&SHistory", ID_INTERFACES_NSISHISTORY
MENUITEM "nsI&WebNav", ID_INTERFACES_NSIWEBNAV
MENUITEM "nsI&Request", ID_INTERFACES_NSIREQUEST
POPUP "nsIDirectoryService"
BEGIN
MENUITEM "Run All Tests", ID_INTERFACES_NSIDIRECTORYSERVICE_RUNALLTESTS
MENUITEM SEPARATOR
MENUITEM "Init", ID_INTERFACES_NSIDIRECTORYSERVICE_INIT
MENUITEM "Register Provider", ID_INTERFACES_NSIDIRECTORYSERVICE_REGISTERPROVIDER
MENUITEM "UnRegisterProvider", ID_INTERFACES_NSIDIRECTORYSERVICE_UNREGISTERPROVIDER
END
POPUP "nsIDomWindow"
BEGIN
MENUITEM "Run All Tests", ID_INTERFACES_NSIDOMWINDOW_RUNALLTESTS
MENUITEM SEPARATOR
MENUITEM "GetDomDocument", ID_INTERFACES_NSIDOMWINDOW_GETDOMDOCUMENT
MENUITEM "GetSelection", ID_INTERFACES_NSIDOMWINDOW_GETSELECTION
MENUITEM "GetParent", ID_INTERFACES_NSIDOMWINDOW_GETPARENT
MENUITEM SEPARATOR
MENUITEM "GetScrollBars", ID_INTERFACES_NSIDOMWINDOW_GETSCROLLBARS
MENUITEM "GetFrames", ID_INTERFACES_NSIDOMWINDOW_GETFRAMES
MENUITEM "GetName", ID_INTERFACES_NSIDOMWINDOW_GETNAME
MENUITEM SEPARATOR
MENUITEM "GetScsollX", ID_INTERFACES_NSIDOMWINDOW_GETSCSOLLX
MENUITEM "GetScrollY", ID_INTERFACES_NSIDOMWINDOW_GETSCROLLY
MENUITEM SEPARATOR
MENUITEM "ScrollTo", ID_INTERFACES_NSIDOMWINDOW_SCROLLTO
MENUITEM "ScrollBy", ID_INTERFACES_NSIDOMWINDOW_SCROLLBY
MENUITEM "ScrollByLines", ID_INTERFACES_NSIDOMWINDOW_SCROLLBYLINES
MENUITEM "ScrollByPages", ID_INTERFACES_NSIDOMWINDOW_SCROLLBYPAGES
MENUITEM SEPARATOR
MENUITEM "SizeToContent", ID_INTERFACES_NSIDOMWINDOW_SIZETOCONTENT
END
POPUP "nsISelection"
BEGIN
MENUITEM "Run All Tests", ID_INTERFACES_NSISELECTION_RUNALLTESTS
MENUITEM SEPARATOR
MENUITEM "GetAnchorNode", ID_INTERFACES_NSISELECTION_GETANCHORNODE
MENUITEM "GetAnchorOffset", ID_INTERFACES_NSISELECTION_GETANCHOROFFSET
MENUITEM "GetFocusNode", ID_INTERFACES_NSISELECTION_GETFOCUSNODE
MENUITEM "GetFocusOffset", ID_INTERFACES_NSISELECTION_GETFOCUSOFFSET
MENUITEM "GetIsCollapsed", ID_INTERFACES_NSISELECTION_GETISCOLLAPSED
MENUITEM "GetRangeCount", ID_INTERFACES_NSISELECTION_GETRANGECOUNT
MENUITEM SEPARATOR
MENUITEM "GetRangeAt", ID_INTERFACES_NSISELECTION_GETRANGEAT
MENUITEM "Collapse", ID_INTERFACES_NSISELECTION_COLLAPSE
MENUITEM "Extend", ID_INTERFACES_NSISELECTION_EXTEND
MENUITEM "CollapseToStart", ID_INTERFACES_NSISELECTION_COLLAPSETOSTART
MENUITEM "CollapseToEnd", ID_INTERFACES_NSISELECTION_COLLAPSETOEND
MENUITEM SEPARATOR
MENUITEM "ContainsNode", ID_INTERFACES_NSISELECTION_CONTAINSNODE
MENUITEM "SelectAllChildren", ID_INTERFACES_NSISELECTION_SELECTALLCHILDREN
MENUITEM SEPARATOR
MENUITEM "AddRange", ID_INTERFACES_NSISELECTION_ADDRANGE
MENUITEM "RemoveRange", ID_INTERFACES_NSISELECTION_REMOVERANGE
MENUITEM "RemoveAllRanges", ID_INTERFACES_NSISELECTION_REMOVEALLRANGES
MENUITEM SEPARATOR
MENUITEM "DeleteFromDocument", ID_INTERFACES_NSISELECTION_DELETEFROMDOCUMENT
MENUITEM "SelectionLanguageChange", ID_INTERFACES_NSISELECTION_SELECTIONLANGUAGECHANGE
MENUITEM "ToString", ID_INTERFACES_NSISELECTION_TOSTRING
END
POPUP "nsIProfile"
BEGIN
MENUITEM "Run All Tests", ID_INTERFACES_NSIPROFILE_RUNALLTESTS
MENUITEM SEPARATOR
MENUITEM "GetProfileCount", ID_INTERFACES_NSIPROFILE_GETPROFILECOUNT
MENUITEM "GetCurrentProfile", ID_INTERFACES_NSIPROFILE_GETCURRENTPROFILE
MENUITEM "SetCurrentProfile", ID_INTERFACES_NSIPROFILE_SETCURRENTPROFILE
MENUITEM SEPARATOR
MENUITEM "GetProfileList", ID_INTERFACES_NSIPROFILE_GETPROFILELIST
MENUITEM "ProfileExists", ID_INTERFACES_NSIPROFILE_PROFILEEXISTS
MENUITEM SEPARATOR
MENUITEM "CreateNewProfile", ID_INTERFACES_NSIPROFILE_CREATENEWPROFILE
MENUITEM "RenameProfile", ID_INTERFACES_NSIPROFILE_RENAMEPROFILE
MENUITEM "DeleteProfile", ID_INTERFACES_NSIPROFILE_DELETEPROFILE
MENUITEM "CloneProfile", ID_INTERFACES_NSIPROFILE_CLONEPROFILE
MENUITEM "ShutDownCurrentProfile", ID_INTERFACES_NSIPROFILE_SHUTDOWNCURRENTPROFILE
END
POPUP "CallBacks"
BEGIN
MENUITEM "nsIStreamListener", ID_INTERFACES_CALLBACKS_NSISTREAMLISTENER
MENUITEM "nsIRequestObserver", ID_INTERFACES_CALLBACKS_NSIREQUESTOBSERVER
MENUITEM "nsIStreamObserver", ID_INTERFACES_CALLBACKS_NSISTREAMOBSERVER
END
END
POPUP "T&ools"
BEGIN
@ -171,6 +304,7 @@ BEGIN
POPUP "Ve&rify Bugs"
BEGIN
MENUITEM "&70228", ID_VERIFYBUGS_70228
MENUITEM "90195", ID_VERIFYBUGS_90195
END
POPUP "Clip&BoardTest"
BEGIN
@ -444,13 +578,14 @@ BEGIN
EDITTEXT IDC_URLFIELD,30,66,132,14,ES_AUTOHSCROLL
END
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95
IDD_RUNTESTSDLG DIALOG DISCARDABLE 0, 0, 331, 186
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
CAPTION "Test Results"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
DEFPUSHBUTTON "Close",IDOK,274,165,50,14
CONTROL "List1",IDC_LIST1,"SysListView32",LVS_REPORT |
LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,317,154
END
@ -553,12 +688,12 @@ BEGIN
BOTTOMMARGIN, 88
END
IDD_DIALOG1, DIALOG
IDD_RUNTESTSDLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
RIGHTMARGIN, 324
TOPMARGIN, 7
BOTTOMMARGIN, 88
BOTTOMMARGIN, 179
END
END
#endif // APSTUDIO_INVOKED
@ -637,9 +772,15 @@ END
STRINGTABLE DISCARDABLE
BEGIN
ID_NAV_RELOAD "Tool Tip\nTool Tip"
ID_EDIT_SELECT_NONE "Select nothing in the document\nSelect None"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_INTERFACES_TEMP "Temporary"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -167,8 +167,14 @@ NS_METHOD winEmbedFileLocProvider::CloneMozBinDirectory(nsILocalFile **aLocalFil
// This will be set if a directory was passed to NS_InitXPCOM
// 2. If that doesn't work, set it to be the current process directory
<<<<<<< winEmbedFileLocProvider.cpp
// NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
nsCOMPtr<nsIProperties> directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID,&rv));
=======
nsCOMPtr<nsIProperties> directoryService =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
>>>>>>> 1.4
if (NS_FAILED(rv))
return rv;
@ -207,8 +213,14 @@ NS_METHOD winEmbedFileLocProvider::GetProductDirectory(nsILocalFile **aLocalFile
PRBool exists;
nsCOMPtr<nsILocalFile> localDir;
<<<<<<< winEmbedFileLocProvider.cpp
//NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
nsCOMPtr<nsIProperties> directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID,&rv));
=======
nsCOMPtr<nsIProperties> directoryService =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
>>>>>>> 1.4
if (NS_FAILED(rv)) return rv;
rv = directoryService->Get(NS_WIN_APPDATA_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(localDir));
if (NS_SUCCEEDED(rv))