Index: BrowserView.cpp
===================================================================
RCS file: /cvsroot/mozilla/embedding/tests/mfcembed/BrowserView.cpp,v
retrieving revision 1.8
diff -u -6 -r1.8 BrowserView.cpp
--- BrowserView.cpp	2001/04/16 20:34:33	1.8
+++ BrowserView.cpp	2001/05/18 23:49:06
@@ -48,12 +48,15 @@
 #include "stdafx.h"
 #include "MfcEmbed.h"
 #include "BrowserView.h"
 #include "BrowserImpl.h"
 #include "BrowserFrm.h"
 #include "Dialogs.h"
+#include "UrlDialog.h"
+#include "ProfileMgr.h"
+#include "ProfilesDlg.h"
 
 // Print Includes
 #include "PrintProgressDialog.h"
 
 
 #ifdef _DEBUG
@@ -67,18 +70,14 @@
 
 BEGIN_MESSAGE_MAP(CBrowserView, CWnd)
 	//{{AFX_MSG_MAP(CBrowserView)
 	ON_WM_CREATE()
 	ON_WM_DESTROY()
 	ON_WM_SIZE()
-
-	// UrlBar command handlers
-	ON_COMMAND(IDOK, OnNewUrlEnteredInUrlBar)
 	ON_CBN_SELENDOK(ID_URL_BAR, OnUrlSelectedInUrlBar)
-
-	// Menu/Toolbar command handlers
+	ON_COMMAND(IDOK, OnNewUrlEnteredInUrlBar)
 	ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
 	ON_COMMAND(ID_FILE_SAVE_AS, OnFileSaveAs)
 	ON_COMMAND(ID_VIEW_SOURCE, OnViewSource)
 	ON_COMMAND(ID_VIEW_INFO, OnViewInfo)
 	ON_COMMAND(ID_NAV_BACK, OnNavBack)
 	ON_COMMAND(ID_NAV_FORWARD, OnNavForward)
@@ -88,29 +87,35 @@
 	ON_COMMAND(ID_EDIT_CUT, OnCut)
 	ON_COMMAND(ID_EDIT_COPY, OnCopy)
 	ON_COMMAND(ID_EDIT_PASTE, OnPaste)
     ON_COMMAND(ID_EDIT_UNDO, OnUndoUrlBarEditOp)
 	ON_COMMAND(ID_EDIT_SELECT_ALL, OnSelectAll)
 	ON_COMMAND(ID_EDIT_SELECT_NONE, OnSelectNone)
+	ON_COMMAND(ID_COPY_LINK_LOCATION, OnCopyLinkLocation)
 	ON_COMMAND(ID_OPEN_LINK_IN_NEW_WINDOW, OnOpenLinkInNewWindow)
 	ON_COMMAND(ID_VIEW_IMAGE, OnViewImageInNewWindow)
-	ON_COMMAND(ID_COPY_LINK_LOCATION, OnCopyLinkLocation)
 	ON_COMMAND(ID_SAVE_LINK_AS, OnSaveLinkAs)
 	ON_COMMAND(ID_SAVE_IMAGE_AS, OnSaveImageAs)
 	ON_COMMAND(ID_EDIT_FIND, OnShowFindDlg)
 	ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
 	ON_UPDATE_COMMAND_UI(ID_FILE_PRINT, OnUpdateFilePrint)
 	ON_REGISTERED_MESSAGE(WM_FINDMSG, OnFindMsg)
-
-	// Menu/Toolbar UI update handlers
+	ON_COMMAND(ID_TESTS_CHANGEURL, OnTestsChangeUrl)
+	ON_COMMAND(ID_TESTS_GLOBALHISTORY, OnTestsGlobalHistory)
+	ON_COMMAND(ID_TOOLS_REMOVEGHPAGE, OnToolsRemoveGHPage)
+	ON_COMMAND(ID_TESTS_CREATEFILE, OnTestsCreateFile)
 	ON_UPDATE_COMMAND_UI(ID_NAV_BACK, OnUpdateNavBack)
 	ON_UPDATE_COMMAND_UI(ID_NAV_FORWARD, OnUpdateNavForward)
 	ON_UPDATE_COMMAND_UI(ID_NAV_STOP, OnUpdateNavStop)
 	ON_UPDATE_COMMAND_UI(ID_EDIT_CUT, OnUpdateCut)
 	ON_UPDATE_COMMAND_UI(ID_EDIT_COPY, OnUpdateCopy)
 	ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE, OnUpdatePaste)
+	ON_COMMAND(ID_INTERFACES_NSIFILE, OnInterfacesNsifile)
+	ON_COMMAND(ID_TESTS_CREATEPROFILE, OnTestsCreateprofile)
+	ON_COMMAND(ID_INTERFACES_NSISHISTORY, OnInterfacesNsishistory)
+	ON_COMMAND(ID_VERIFYBUGS_70228, OnVerifybugs70228)
 	//}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
 
 CBrowserView::CBrowserView()
 {
@@ -126,12 +131,14 @@
 
 	m_pFindDlg = NULL;
   m_pPrintProgressDlg = NULL;
 
   m_bUrlBarClipOp = FALSE;
   m_bCurrentlyPrinting = FALSE;
+
+  char *theUrl = "http://www.aol.com/";
 }
 
 CBrowserView::~CBrowserView()
 {
 }
 
@@ -166,12 +173,14 @@
 	//
 	rv = NS_OK;
 	mWebNav = do_QueryInterface(mWebBrowser, &rv);
 	if(NS_FAILED(rv))
 		return rv;
 
+//	mSessionHistory = do_GetInterface(mWebBrowser, &rv); // de: added 5/11
+
 	// Create the CBrowserImpl object - this is the object
 	// which implements the interfaces which are required
 	// by an app embedding mozilla i.e. these are the interfaces
 	// thru' which the *embedded* browser communicates with the
 	// *embedding* app
 	//
@@ -229,14 +238,24 @@
 	rv = mBaseWindow->Create();
 
     // Register the BrowserImpl object to receive progress messages
 	// These callbacks will be used to update the status/progress bars
     nsWeakPtr weakling(
         dont_AddRef(NS_GetWeakReference(NS_STATIC_CAST(nsIWebProgressListener*, mpBrowserImpl))));
-    (void)mWebBrowser->AddWebBrowserListener(weakling, 
-							    NS_GET_IID(nsIWebProgressListener));
+    rv = mWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsIWebProgressListener));
+	
+	if (NS_FAILED(rv))
+	{
+		AfxMessageBox("Web Progress Listener not added.");
+		WriteToOutputFile("Web Progress Listener not added.\r\n");
+	}
+	else
+	{
+		AfxMessageBox("Web Progress Listener added.");
+		WriteToOutputFile("Web Progress Listener added.\r\n");
+	}
 
 	// Finally, show the web browser window
 	mBaseWindow->SetVisibility(PR_TRUE);
 
 	return S_OK;
 }
@@ -252,12 +271,27 @@
 	if(mpBrowserImpl)
 	{
 		mpBrowserImpl->Release();
 		mpBrowserImpl = nsnull;
 	}
 
+	nsWeakPtr weakling(
+    dont_AddRef(NS_GetWeakReference(NS_STATIC_CAST(nsIWebProgressListener*, mpBrowserImpl))));
+	nsresult rv;
+    rv = mWebBrowser->RemoveWebBrowserListener(weakling, NS_GET_IID(nsIWebProgressListener));
+	if (NS_FAILED(rv))
+	{
+		AfxMessageBox("Web Progress Listener not removed.");
+		WriteToOutputFile("Web Progress Listener not removed.\r\n");
+	}
+	else
+	{
+		AfxMessageBox("Web Progress Listener removed.");
+		WriteToOutputFile("Web Progress Listener removed.\r\n");
+	}
+
 	return NS_OK;
 }
 
 BOOL CBrowserView::PreCreateWindow(CREATESTRUCT& cs) 
 {
 	if (!CWnd::PreCreateWindow(cs))
@@ -986,7 +1020,592 @@
         case WA_INACTIVE:
             focus->Deactivate();
             break;
         default:
             break;
     }
+}
+
+// de: Start QA test cases here
+// *********************************************************
+// *********************************************************
+
+void CBrowserView::OnTestsChangeUrl() 
+{
+	char *theUrl = "http://www.aol.com/";
+	CUrlDialog myDialog;
+	nsresult rv;
+
+//	nsCOMPtr<nsIURI> pURI;
+
+	if (!mWebNav)
+	{
+		AfxMessageBox("Web navigation object not found. Change URL test not performed.");
+		WriteToOutputFile("Web navigation object not found. Change URL test not performed.\r\n");
+		return;
+	}
+
+	if (myDialog.DoModal() == IDOK)
+	{
+		AfxMessageBox("Begin Change URL test.");
+		WriteToOutputFile("Begin Change URL test.\r\n");
+		strcpy(theUrl, myDialog.m_urlfield);
+		mWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).GetUnicode(), 
+						nsIWebNavigation::LOAD_FLAGS_NONE);
+		WriteToOutputFile("\r\nLoadURI() method is called.");
+		WriteToOutputFile("theUrl = ");
+		WriteToOutputFile(theUrl);
+
+/*
+		char *uriSpec;
+		// GetcurrentURI() declared in nsIP3PUI.idl
+		// used with webNav obj in nsP3PObserverHTML.cpp, line 239
+		// this will be used as an indep routine to verify the URI load
+		rv = mWebNav->GetCurrentURI( getter_AddRefs( pURI ) );
+		if(NS_FAILED(rv) || !pURI)
+			AfxMessageBox("Bad result for GetCurrentURI().");
+
+		rv = pURI->GetSpec(&uriSpec);;
+		if (NS_FAILED(rv))
+			AfxMessageBox("Bad result for GetSpec().");
+
+		AfxMessageBox("Start URL validation test().");
+		if (strcmp(uriSpec, theUrl) == 0)
+		{
+			WriteToOutputFile("Url loaded successfully. Test Passed.");	
+		}
+		else
+		{
+			WriteToOutputFile("Url didn't load successfully. Test Failed.");
+		}
+*/
+		AfxMessageBox("End Change URL test.");
+		WriteToOutputFile("End Change URL test.\r\n");
+	}
+	else
+	{
+		AfxMessageBox("Change URL test not executed.");
+		WriteToOutputFile("Change URL test not executed.\r\n");
+	}
+}
+
+// *********************************************************
+
+void CBrowserView::OnTestsGlobalHistory() 
+{
+	// create instance of myHistory object. Call's XPCOM
+	// service manager to pass the contract ID.
+
+	char *theUrl = "http://www.bogussite.com/";
+	CUrlDialog myDialog;
+
+	PRBool theRetVal = PR_FALSE;
+	nsresult rv;
+
+	nsCOMPtr<nsIGlobalHistory> myHistory(do_GetService(NS_GLOBALHISTORY_CONTRACTID));
+
+	if (!myHistory)
+	{
+		WriteToOutputFile("Couldn't find history object. No GH tests performed.\r\n");
+		AfxMessageBox("Couldn't find history object. No GH tests performed.");
+		return;
+	}
+
+	if (myDialog.DoModal() == IDOK)
+	{
+		AfxMessageBox("Begin IsVisited() and AddPage() tests.");
+		WriteToOutputFile("Begin IsVisited() and AddPage() tests.\r\n");
+
+		strcpy(theUrl, myDialog.m_urlfield);
+
+		WriteToOutputFile("theUrl = ");
+		WriteToOutputFile(theUrl);
+
+		// see if url is already in the GH file (pre-AddPage() test)
+		myHistory->IsVisited(theUrl, &theRetVal);
+
+		if (theRetVal)
+		{
+			WriteToOutputFile("URL has been visited. Won't execute AddPage().\r\n");
+			AfxMessageBox("URL has been visited. Won't execute AddPage().");
+		}
+		else
+		{
+			WriteToOutputFile("URL hasn't been visited. Will execute AddPage().\r\n");
+			AfxMessageBox("URL hasn't been visited. Will execute AddPage().");
+			// adds a url to the global history file
+			rv = myHistory->AddPage(theUrl);
+
+			// prints addPage() results to output file
+			if (NS_FAILED(rv))
+			{
+				WriteToOutputFile("Invalid results for AddPage(). Url not added. Test failed.\r\n");
+				return;
+			}
+			else
+			{
+				WriteToOutputFile("Valid results for AddPage(). Url added. Test passed.\r\n");
+			}
+
+			// checks if url was visited (post-AddPage() test)
+ 			myHistory->IsVisited(theUrl, &theRetVal);
+
+			if (theRetVal)
+			{
+				WriteToOutputFile("URL is visited; post-AddPage() test. IsVisited() test passed.\r\n");
+			}
+			else
+			{
+				WriteToOutputFile("URL isn't visited; post-AddPage() test. IsVisited() test failed.\r\n");
+			}
+		}
+		AfxMessageBox("End IsVisited() and AddPage() tests.");
+		WriteToOutputFile("End IsVisited() and AddPage() tests.\r\n");
+	}
+	else
+	{
+		AfxMessageBox("IsVisited() and AddPage() tests not executed.");
+		WriteToOutputFile("IsVisited() and AddPage() tests not executed.\r\n");
+	}
+}
+
+
+
+// *********************************************************
+
+void CBrowserView::OnTestsCreateFile() 
+{
+   nsresult rv;
+   PRBool exists;
+   nsCOMPtr<nsILocalFile> theTestFile(do_GetService(NS_LOCAL_FILE_CONTRACTID));
+
+    if (!theTestFile)
+	{
+		WriteToOutputFile("File object doesn't exist. No File tests performed.\r\n");
+		AfxMessageBox("File object doesn't exist. No File tests performed.");
+		return;
+	}
+
+
+	AfxMessageBox("Start Create File test.");
+	WriteToOutputFile("\r\nStart Create File test.\r\n");
+
+	rv = theTestFile->InitWithPath("c:\\temp\\theFile.txt");
+	rv = theTestFile->Exists(&exists);
+
+	WriteToOutputFile("File doesn't exist. We'll create it.\r\n");
+	rv = theTestFile->Create(nsIFile::NORMAL_FILE_TYPE, 0777);
+	if (NS_FAILED(rv))
+	{
+		AfxMessageBox("We failed to create the file (theFile.txt).");
+		WriteToOutputFile("Create() test Failed.\r\n");
+	}
+	else
+	{
+		AfxMessageBox("We created the file (theFile.txt).");
+		WriteToOutputFile("Create() test Passed.\r\n");
+	}
+}
+
+// *********************************************************
+
+void CBrowserView::OnTestsCreateprofile() 
+{
+    CProfilesDlg    myDialog;
+    nsresult        rv;
+
+	if (myDialog.DoModal() == IDOK)
+    {       
+//      NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);
+		nsCOMPtr<nsIProfile> theProfServ(do_GetService(NS_PROFILE_CONTRACTID));
+		if (!theProfServ)
+		{
+		   WriteToOutputFile("Didn't get profile service. No profile tests performed.\r\n");
+		   AfxMessageBox("Didn't get profile service. No profile tests performed.");
+		   return;
+		}
+
+        if (theProfServ)
+		{
+		   AfxMessageBox("Start Profile switch test.");
+		   WriteToOutputFile("Start Profile switch test.\r\n");
+
+		   AfxMessageBox("Retrieved profile service.");
+           rv = theProfServ->SetCurrentProfile(myDialog.m_SelectedProfile.GetUnicode());
+		   if (NS_SUCCEEDED(rv))
+		      AfxMessageBox("SetCurrentProfile() passed. Profile switched.");
+		   else
+			  AfxMessageBox("SetCurrentProfile() didn't pass.Profile not switched.");
+
+		   AfxMessageBox("End Profile switch test.");
+		   WriteToOutputFile("End Profile switch test.\r\n");
+		}
+    }
+	else
+	{
+	   AfxMessageBox("Profile switch test not executed.");
+	   WriteToOutputFile("Profile switch test not executed.\r\n");
+	}	
+}
+
+// *********************************************************
+// *********************************************************
+//					TOOLS to help us
+
+
+void CBrowserView::OnToolsRemoveGHPage() 
+{
+	char *theUrl = "http://www.bogussite.com/";
+	CUrlDialog myDialog;
+	PRBool theRetVal = PR_FALSE;
+	nsresult rv;
+	nsCOMPtr<nsIGlobalHistory> myGHistory(do_GetService(NS_GLOBALHISTORY_CONTRACTID));
+	if (!myGHistory)
+	{
+		WriteToOutputFile("Could not get the global history object.\r\n");
+		AfxMessageBox("Could not get the global history object.");
+		return;
+	}
+	nsCOMPtr<nsIBrowserHistory> myHistory = do_QueryInterface(myGHistory, &rv);
+	if(!NS_SUCCEEDED(rv)) {
+		WriteToOutputFile("Could not get the history object.\r\n");
+		AfxMessageBox("Could not get the global history object.");
+		return;
+	}
+//	nsCOMPtr<nsIBrowserHistory> myHistory(do_GetInterface(myGHistory));
+
+
+	if (myDialog.DoModal() == IDOK)
+	{
+		WriteToOutputFile("Begin URL removal from the GH file.\r\n");
+		AfxMessageBox("Begin URL removal from the GH file.");
+		strcpy(theUrl, myDialog.m_urlfield);
+
+		myGHistory->IsVisited(theUrl, &theRetVal);
+		if (theRetVal)
+		{
+			rv = myHistory->RemovePage(theUrl);
+			if (NS_SUCCEEDED(rv))
+			{
+				WriteToOutputFile("\r\nThe URL was removed from the GH file.\r\n");
+				AfxMessageBox("The URL was removed from the GH file.");
+			}
+			else
+			{
+				WriteToOutputFile("\r\nThe URL wasn't removed from the GH file.\r\n");
+				AfxMessageBox("The URL wasn't removed from the GH file.");
+			}
+		}
+		else
+		{
+			WriteToOutputFile("The URL wasn't in the GH file.\r\n");
+		}
+		WriteToOutputFile("End URL removal from the GH file.\r\n");
+		AfxMessageBox("End URL removal from the GH file.");
+	}
+	else
+	{
+		WriteToOutputFile("URL removal from the GH file not executed.\r\n");
+		AfxMessageBox("URL removal from the GH file not executed.");
+	}
+}
+
+// ***********************************************************************
+// ************************** Interface Tests ****************************
+// ***********************************************************************
+
+// nsIFile:
+
+void CBrowserView::OnInterfacesNsifile() 
+{
+   nsCOMPtr<nsILocalFile> theTestFile(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+   nsCOMPtr<nsILocalFile> theFileOpDir(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+
+   nsresult rv;
+   PRBool exists;
+
+    if (!theTestFile)
+ 	{
+		WriteToOutputFile("File object doesn't exist. No File tests performed.\r\n");
+		AfxMessageBox("File object doesn't exist. No File tests performed.");
+		return;
+	}
+	if (!theFileOpDir)
+ 	{
+		WriteToOutputFile("Dir object doesn't exist. No File tests performed.\r\n");
+		AfxMessageBox("File object doesn't exist. No File tests performed.");
+		return;
+	}
+
+	AfxMessageBox("Begin nsIFile tests.");
+	WriteToOutputFile("\r\nBegin testing nsIFile InitWithPath(), AppendRelativePath(), \
+						Create(), and Exists() methods.\r\n");
+
+	rv = theTestFile->InitWithPath("c:\\temp\\");
+	if (NS_FAILED(rv))
+	{
+		AfxMessageBox("We failed to initialize file path.");
+		WriteToOutputFile("InitWithPath() test Failed.");
+	}
+	else
+	{
+		AfxMessageBox("We initialized file path.");
+		WriteToOutputFile("InitWithPath() test Passed.");
+	}
+
+	rv = theTestFile->AppendRelativePath("myFile.txt");
+	if (NS_FAILED(rv))
+	{
+		AfxMessageBox("We failed to append the file.");
+		WriteToOutputFile("AppendRelativePath() test Failed.");
+	}
+	else
+	{
+		AfxMessageBox("We appended the file.");
+		WriteToOutputFile("AppendRelativePath() test Passed.");
+	}
+
+	rv = theTestFile->Exists(&exists);
+	if (!exists)
+	{
+		AfxMessageBox("File doesn't exist. We'll try creating it.");
+		WriteToOutputFile("File doesn't exist. We'll try creating it.\r\n");
+		rv = theTestFile->Create(nsIFile::NORMAL_FILE_TYPE, 0777);
+		if (NS_FAILED(rv))
+		{
+			AfxMessageBox("We failed to create the file (myFile.txt).");
+			WriteToOutputFile("Create() test Failed.");
+		}
+		else
+		{
+			AfxMessageBox("We created the file (myFile.txt).");
+			WriteToOutputFile("Create() test Passed.");
+		}
+	}
+	else
+	{
+		AfxMessageBox("File already exists (myFile.txt). We won't create it.");
+		WriteToOutputFile("File already exists (myFile.txt). We won't create it.");
+	}
+
+
+	rv = theTestFile->Exists(&exists);
+	if (!exists)
+	{
+		AfxMessageBox("File (myFile.txt) doesn't exist.");
+		WriteToOutputFile("Exists() test Failed.");
+	}
+	else
+	{
+		AfxMessageBox("File (myFile.txt) exists.");
+		WriteToOutputFile("Exists() test Passed.");
+	}
+
+	// FILE COPY test
+
+	AfxMessageBox("Start File Copy test.");
+	WriteToOutputFile("Start File Copy test.");
+
+	rv = theFileOpDir->InitWithPath("c:\\temp\\");
+	if (NS_FAILED(rv))
+	{
+		AfxMessageBox("The target dir wasn't found.");
+		WriteToOutputFile("The target dir wasn't found.");
+	}
+	else
+	{
+		AfxMessageBox("The target dir was found.");
+		WriteToOutputFile("The target dir was found.");
+	}
+	rv = theTestFile->InitWithPath("c:\\temp\\myFile.txt");
+	if (NS_FAILED(rv))
+		AfxMessageBox("The path wasn't found.");
+	else
+		AfxMessageBox("The path was found.");
+	rv = theTestFile->CopyTo(theFileOpDir, "myFile2.txt");
+	if (NS_FAILED(rv))
+		AfxMessageBox("rv CopyTo() test failed.");
+	else
+		AfxMessageBox("rv CopyTo() test succeeded.");
+
+	rv = theTestFile->InitWithPath("c:\\temp\\myFile2.txt");
+	rv = theTestFile->Exists(&exists);
+	if (!exists)
+	{
+		AfxMessageBox("File didn't copy.");
+		WriteToOutputFile("CopyTo() test Failed.");
+	}
+	else
+	{
+		AfxMessageBox("File copied.");
+		WriteToOutputFile("CopyTo() test Passed.");
+	}	
+
+		// FILE MOVE test
+
+	AfxMessageBox("Start File Move test.");
+	WriteToOutputFile("Start File Move test.");
+
+	rv = theFileOpDir->InitWithPath("c:\\Program Files\\");
+	if (NS_FAILED(rv))
+	{
+		AfxMessageBox("The target dir wasn't found.");
+		WriteToOutputFile("The target dir wasn't found.");
+	}
+
+	rv = theTestFile->InitWithPath("c:\\temp\\myFile2.txt");
+	if (NS_FAILED(rv))
+		AfxMessageBox("The path wasn't found.");
+
+	rv = theTestFile->MoveTo(theFileOpDir, "myFile2.txt");
+	if (NS_FAILED(rv))
+		AfxMessageBox("rv MoveTo() test failed.");
+	else
+		AfxMessageBox("rv MoveTo() test succeeded.");
+	rv = theTestFile->InitWithPath("c:\\Program Files\\myFile2.txt");
+	rv = theTestFile->Exists(&exists);
+	if (!exists)
+	{
+		AfxMessageBox("File wasn't moved.");
+		WriteToOutputFile("MoveTo() test Failed.");
+	}
+	else
+	{
+		AfxMessageBox("File was moved.");
+		WriteToOutputFile("MoveTo() test Passed.");
+	}	
+
+	AfxMessageBox("End nsIFile tests.");
+	WriteToOutputFile("\r\nEnd testing nsIFile InitWithPath(), AppendRelativePath(), \
+						Create(), and Exists() methods.\r\n");
+	
+}
+
+// nsISHistory:
+
+void CBrowserView::OnInterfacesNsishistory() 
+{
+   nsresult rv;
+   boolean modifyIndex;
+   long numEntries = 0;
+
+   nsCOMPtr<nsISHistory> theSessionHistory(do_CreateInstance(NS_SHISTORY_CONTRACTID));
+   nsCOMPtr<nsIHistoryEntry> theHistoryEntry(do_CreateInstance(NS_HISTORYENTRY_CONTRACTID));
+   nsCOMPtr<nsISHistoryListener> theSHListener(do_CreateInstance(NS_SHISTORYLISTENER_CONTRACTID));
+   // do_QueryInterface
+   // NS_HISTORYENTRY_CONTRACTID
+   // NS_SHISTORYLISTENER_CONTRACTID
+
+  
+   if (!theSessionHistory)
+   {
+	   AfxMessageBox("theSessionHistory object wasn't created. No tests performed.");
+	   return;
+   }
+   if (!theHistoryEntry)
+   {
+	   AfxMessageBox("NSISHistory Listener not added.");
+	   return;
+   }
+
+   // addSHistoryListener test
+	nsWeakPtr weakling(
+        dont_AddRef(NS_GetWeakReference(NS_STATIC_CAST(nsISHistoryListener*, mpBrowserImpl))));
+	rv = mWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsISHistoryListener));
+
+	if (NS_FAILED(rv))
+	{
+		AfxMessageBox("NSISHistory Listener not added.");
+		WriteToOutputFile("NSISHistory Listener not added.\r\n");
+	}
+	else
+	{
+		AfxMessageBox("NSISHistory Listener added.");
+		WriteToOutputFile("NSISHistory Listener added.\r\n");
+	}
+
+/*
+   // getEntryAtIndex() test
+    theHistoryEntry = theSessionHistory->GetEntryAtIndex(index, modifyIndex);
+    if (!theHistoryEntry)
+    {
+		AfxMessageBox("We got the History Entry.");	
+	}
+	else
+	{
+		AfxMessageBox("We didn't get the History Entry.");
+	}
+
+*/
+
+///*
+   // PurgeHistory() test
+   rv = theSessionHistory->PurgeHistory(numEntries);
+   if (NS_FAILED(rv))
+	   AfxMessageBox("Purge History test failed.");
+   else
+	   AfxMessageBox("Purge History test succeeded.");
+//*/
+
+      // RemoveSHistoryListener test
+/*
+       nsWeakPtr weakling(
+       dont_AddRef(NS_GetWeakReference(NS_STATIC_CAST(nsISHistoryListener*, mpBrowserImpl))));
+	   rv = theSessionHistory->RemoveSHistoryListener(weakling);
+*/
+}
+
+
+// ***************** Local Methods ******************
+
+void CBrowserView::WriteToOutputFile(char *pLine) 
+{ 
+    CStdioFile myFile; 
+    CFileException e; 
+    CString strFileName = "c:\\temp\\MFCoutfile"; 
+
+    if(! myFile.Open( strFileName, CStdioFile::modeCreate | CStdioFile::modeWrite
+								| CStdioFile::modeNoTruncate, &e ) ) 
+    { 
+        CString failCause = "Unable to open file. Reason : "; 
+        failCause += e.m_cause; 
+        AfxMessageBox(failCause); 
+    } 
+    else 
+    { 
+		myFile.SeekToEnd();
+        CString strLine = pLine; 
+        strLine += "\r\n"; 
+
+        myFile.WriteString(strLine); 
+
+        myFile.Close(); 
+    } 
+} 
+
+
+// ***************** Bug Verifications ******************
+
+void CBrowserView::OnVerifybugs70228() 
+{
+/*
+	nsCOMPtr<nsIHelperAppLauncherDialog> 
+			myHALD(do_GetService(NS_IHELPERAPPLAUNCHERDLG_CONTRACTID));
+	if (!myHALD)
+		AfxMessageBox("Object not created. It's NOT a service!");
+	else
+		AfxMessageBox("Object is created. But should it?! It's NOT a service!");
+
+	nsCOMPtr<nsIHelperAppLauncherDialog> 
+			myHALD(do_CreateInstance(NS_IHELPERAPPLAUNCHERDLG_CONTRACTID));
+	if (!myHALD)
+		AfxMessageBox("Object not created. It should be. It's a component!");
+	else
+		AfxMessageBox("Object is created. It's a component!");	
+*/
+/*
+nsCOMPtr<nsIHelperAppLauncher> 
+			myHAL(do_CreateInstance(NS_IHELPERAPPLAUNCHERDLG_CONTRACTID));
+
+	rv = myHALD->show(myHal, mySupp);
+*/	
 }
