Modified test results for several interface tests to display to rv dialog.

a=asa for QA checkins that are not part of the default builds
This commit is contained in:
depstein%netscape.com 2002-09-28 01:41:25 +00:00
parent 05ef2e9b38
commit e406a306ec
13 changed files with 203 additions and 151 deletions

View File

@ -508,9 +508,10 @@ NS_IMETHODIMP CBrowserImpl::OnStopRequest(nsIRequest *request,
{
nsCString stringMsg;
RvTestResult(rv, "nsIStreamListener::OnStopRequest rv input", 1);
RequestName(request, stringMsg, 1);
QAOutput("##### END: nsIStreamListener::OnStopRequest() #####");
return NS_OK;
}

View File

@ -79,36 +79,36 @@ void CNsIFile::OnStartTests(UINT nMenuID)
return;
}
QAOutput("Begin nsIFile tests.", 2);
switch(nMenuID)
{
case ID_INTERFACES_NSIFILE_RUNALLTESTS :
QAOutput("Begin nsIFile tests.", 2);
RunAllTests(theTestFile,theFileOpDir);
QAOutput("End nsIFile tests.", 2);
break ;
case ID_INTERFACES_NSIFILE_INITWITHPATH :
InitWithPathTest(theTestFile);
InitWithPathTest(theTestFile, 2);
break ;
case ID_INTERFACES_NSIFILE_APPENDRELATICEPATH :
AppendRelativePathTest(theTestFile);
AppendRelativePathTest(theTestFile, 2);
break ;
case ID_INTERFACES_NSIFILE_EXISTS :
FileCreateTest(theTestFile);
FileCreateTest(theTestFile, 2);
break ;
case ID_INTERFACES_NSIFILE_CREATE :
FileExistsTest(theTestFile);
FileExistsTest(theTestFile, 2);
break ;
case ID_INTERFACES_NSIFILE_COPYTO :
FileCopyTest(theTestFile, theFileOpDir);
FileCopyTest(theTestFile, theFileOpDir, 2);
break ;
case ID_INTERFACES_NSIFILE_MOVETO :
FileMoveTest(theTestFile, theFileOpDir);
FileMoveTest(theTestFile, theFileOpDir, 2);
break ;
}
}
@ -122,37 +122,35 @@ void CNsIFile::OnStartTests(UINT nMenuID)
void CNsIFile::RunAllTests(nsILocalFile *theTestFile, nsILocalFile *theFileOpDir)
{
InitWithPathTest(theTestFile);
AppendRelativePathTest(theTestFile);
FileCreateTest(theTestFile);
FileExistsTest(theTestFile);
FileCopyTest(theTestFile, theFileOpDir);
FileMoveTest(theTestFile, theFileOpDir);
InitWithPathTest(theTestFile, 1);
AppendRelativePathTest(theTestFile, 1);
FileCreateTest(theTestFile, 1);
FileExistsTest(theTestFile, 1);
FileCopyTest(theTestFile, theFileOpDir, 1);
FileMoveTest(theTestFile, theFileOpDir, 1);
}
// ***********************************************************************
// Individual nsIFile tests
void CNsIFile::InitWithPathTest(nsILocalFile *theTestFile)
void CNsIFile::InitWithPathTest(nsILocalFile *theTestFile, PRInt16 displayMode)
{
rv = theTestFile->InitWithNativePath(NS_LITERAL_CSTRING("c:\\temp\\"));
RvTestResult(rv, "InitWithNativePath() test (initializing file path)", 2);
RvTestResult(rv, "InitWithNativePath() test (initializing file path)", displayMode);
RvTestResultDlg(rv, "InitWithNativePath() test (initializing file path)", true);
}
void CNsIFile::AppendRelativePathTest(nsILocalFile *theTestFile)
void CNsIFile::AppendRelativePathTest(nsILocalFile *theTestFile, PRInt16 displayMode)
{
rv = theTestFile->AppendRelativeNativePath(NS_LITERAL_CSTRING("myFile.txt"));
RvTestResult(rv, "AppendRelativeNativePath() test (append file to the path)", 2);
RvTestResult(rv, "AppendRelativeNativePath() test (append file to the path)", displayMode);
RvTestResultDlg(rv, "AppendRelativeNativePath() test (append file to the path)");
}
void CNsIFile::FileCreateTest(nsILocalFile *theTestFile)
void CNsIFile::FileCreateTest(nsILocalFile *theTestFile, PRInt16 displayMode)
{
PRBool exists = PR_TRUE;
@ -162,15 +160,16 @@ void CNsIFile::FileCreateTest(nsILocalFile *theTestFile)
rv = theTestFile->Exists(&exists);
if (!exists)
{
QAOutput("File doesn't exist. We'll try creating it.", 2);
QAOutput("File doesn't exist. We'll try creating it.", displayMode);
rv = theTestFile->Create(nsIFile::NORMAL_FILE_TYPE, 0777);
RvTestResult(rv, "File Create() test ('myFile.txt')", 2);
RvTestResult(rv, "File Create() test ('myFile.txt')", displayMode);
RvTestResultDlg(rv, "File Create() test ('myFile.txt')");
}
else
QAOutput("File already exists (myFile.txt). We won't create it.", 2);
QAOutput("File already exists (myFile.txt). We won't create it.", displayMode);
}
void CNsIFile::FileExistsTest(nsILocalFile *theTestFile)
void CNsIFile::FileExistsTest(nsILocalFile *theTestFile, PRInt16 displayMode)
{
PRBool exists = PR_TRUE;
@ -178,65 +177,71 @@ void CNsIFile::FileExistsTest(nsILocalFile *theTestFile)
rv = theTestFile->AppendRelativeNativePath(NS_LITERAL_CSTRING("myFile.txt"));
rv = theTestFile->Exists(&exists);
RvTestResult(rv, "File Exists() test ('myFile.txt')", displayMode);
RvTestResultDlg(rv, "File Exists() test ('myFile.txt')");
if (!exists)
QAOutput("Exists() test Failed. File (myFile.txt) doesn't exist.", 2);
QAOutput("Exists() test Failed. File (myFile.txt) doesn't exist.", displayMode);
else
QAOutput("Exists() test Passed. File (myFile.txt) exists.", 2);
QAOutput("Exists() test Passed. File (myFile.txt) exists.", displayMode);
}
void CNsIFile::FileCopyTest(nsILocalFile *theTestFile, nsILocalFile *theFileOpDir)
void CNsIFile::FileCopyTest(nsILocalFile *theTestFile, nsILocalFile *theFileOpDir,
PRInt16 displayMode)
{
PRBool exists = PR_TRUE;
QAOutput("Start File Copy test.", 2);
QAOutput("Start File Copy test.", displayMode);
rv = theFileOpDir->InitWithNativePath(NS_LITERAL_CSTRING("c:\\temp\\"));
if (NS_FAILED(rv))
QAOutput("The target dir wasn't found.", 2);
QAOutput("The target dir wasn't found.", displayMode);
else
QAOutput("The target dir was found.", 2);
QAOutput("The target dir was found.", displayMode);
rv = theTestFile->InitWithNativePath(NS_LITERAL_CSTRING("c:\\temp\\myFile.txt"));
if (NS_FAILED(rv))
QAOutput("The path wasn't found.", 2);
QAOutput("The path wasn't found.", displayMode);
else
QAOutput("The path was found.", 2);
QAOutput("The path was found.", displayMode);
rv = theTestFile->CopyToNative(theFileOpDir, NS_LITERAL_CSTRING("myFile2.txt"));
RvTestResult(rv, "rv CopyToNative() test", 2);
RvTestResult(rv, "rv CopyToNative() test", displayMode);
RvTestResultDlg(rv, "File CopyToNative() test ('myFile.txt')");
rv = theTestFile->InitWithNativePath(NS_LITERAL_CSTRING("c:\\temp\\myFile2.txt"));
rv = theTestFile->Exists(&exists);
if (!exists)
QAOutput("File didn't copy. CopyToNative() test Failed.", 2);
QAOutput("File didn't copy. CopyToNative() test Failed.", displayMode);
else
QAOutput("File copied. CopyToNative() test Passed.", 2);
QAOutput("File copied. CopyToNative() test Passed.", displayMode);
}
void CNsIFile::FileMoveTest(nsILocalFile *theTestFile, nsILocalFile *theFileOpDir)
void CNsIFile::FileMoveTest(nsILocalFile *theTestFile, nsILocalFile *theFileOpDir,
PRInt16 displayMode)
{
PRBool exists = PR_TRUE;
QAOutput("Start File Move test.", 2);
QAOutput("Start File Move test.", displayMode);
rv = theFileOpDir->InitWithNativePath(NS_LITERAL_CSTRING("c:\\Program Files\\"));
if (NS_FAILED(rv))
QAOutput("The target dir wasn't found.", 2);
QAOutput("The target dir wasn't found.", displayMode);
rv = theTestFile->InitWithNativePath(NS_LITERAL_CSTRING("c:\\temp\\myFile2.txt"));
if (NS_FAILED(rv))
QAOutput("The path wasn't found.", 2);
QAOutput("The path wasn't found.", displayMode);
rv = theTestFile->MoveToNative(theFileOpDir, NS_LITERAL_CSTRING("myFile2.txt"));
RvTestResult(rv, "MoveToNative() test", 2);
RvTestResult(rv, "MoveToNative() test", displayMode);
RvTestResultDlg(rv, "File MoveToNative() test ('myFile.txt')");
rv = theTestFile->InitWithNativePath(NS_LITERAL_CSTRING("c:\\Program Files\\myFile2.txt"));
rv = theTestFile->Exists(&exists);
if (!exists)
QAOutput("File wasn't moved. MoveToNative() test Failed.", 2);
QAOutput("File wasn't moved. MoveToNative() test Failed.", displayMode);
else
QAOutput("File was moved. MoveToNative() test Passed.", 2);
QAOutput("File was moved. MoveToNative() test Passed.", displayMode);
}

View File

@ -56,12 +56,12 @@ public:
public:
void OnStartTests(UINT nMenuID);
void RunAllTests(nsILocalFile*, nsILocalFile *);
void InitWithPathTest(nsILocalFile*);
void AppendRelativePathTest(nsILocalFile*);
void FileCreateTest(nsILocalFile*);
void FileExistsTest(nsILocalFile*);
void FileCopyTest(nsILocalFile*, nsILocalFile *);
void FileMoveTest(nsILocalFile*, nsILocalFile *);
void InitWithPathTest(nsILocalFile*, PRInt16);
void AppendRelativePathTest(nsILocalFile*, PRInt16);
void FileCreateTest(nsILocalFile*, PRInt16);
void FileExistsTest(nsILocalFile*, PRInt16);
void FileCopyTest(nsILocalFile*, nsILocalFile *, PRInt16);
void FileMoveTest(nsILocalFile*, nsILocalFile *, PRInt16);
protected:

View File

@ -95,17 +95,17 @@ void CnsIObserServ::OnStartTests(UINT nMenuID)
case ID_INTERFACES_NSIOBSERVERSERVICE_ENUMERATEOBSERVERS :
QAOutput("Adding observers first", 2);
AddObserversTest(1);
EnumerateObserversTest();
EnumerateObserversTest(1);
break;
case ID_INTERFACES_NSIOBSERVERSERVICE_NOTIFYOBSERVERS :
NotifyObserversTest();
NotifyObserversTest(1);
break;
case ID_INTERFACES_NSIOBSERVERSERVICE_REMOVEOBSERVERS :
QAOutput("Adding observers first.", 2);
AddObserversTest(1);
RemoveObserversTest();
RemoveObserversTest(1);
break;
default :
@ -116,10 +116,10 @@ void CnsIObserServ::OnStartTests(UINT nMenuID)
void CnsIObserServ::RunAllTests()
{
AddObserversTest(2);
EnumerateObserversTest();
NotifyObserversTest();
RemoveObserversTest();
AddObserversTest(1);
EnumerateObserversTest(1);
NotifyObserversTest(1);
RemoveObserversTest(1);
}
void CnsIObserServ::AddObserversTest(int displayType)
@ -127,6 +127,8 @@ void CnsIObserServ::AddObserversTest(int displayType)
int i;
nsCOMPtr<nsIObserverService>observerService(do_GetService("@mozilla.org/observer-service;1",&rv));
RvTestResult(rv, "nsIObserverService object test", displayType);
RvTestResultDlg(rv, "nsIObserverService object test", true);
QAOutput("\n nsIObserverService::AddObserversTest().");
if (!observerService)
@ -141,10 +143,11 @@ void CnsIObserServ::AddObserversTest(int displayType)
ObserverTable[i].theOwnsWeak);
FormatAndPrintOutput("The observer to be added = ", ObserverTable[i].theTopic, 1);
RvTestResult(rv, "AddObservers() test", displayType);
RvTestResultDlg(rv, "AddObservers() test");
}
}
void CnsIObserServ::RemoveObserversTest()
void CnsIObserServ::RemoveObserversTest(int displayType)
{
int i;
@ -161,12 +164,13 @@ void CnsIObserServ::RemoveObserversTest()
{
rv = observerService->RemoveObserver(this, ObserverTable[i].theTopic);
FormatAndPrintOutput("The observer to be removed = ", ObserverTable[i].theTopic, 1);
RvTestResult(rv, "RemoveObservers() test", 2);
RvTestResult(rv, "RemoveObservers() test", displayType);
RvTestResultDlg(rv, "RemoveObservers() test");
}
}
void CnsIObserServ::NotifyObserversTest()
void CnsIObserServ::NotifyObserversTest(int displayType)
{
PRInt32 i;
nsCOMPtr<nsIObserverService>observerService(do_GetService("@mozilla.org/observer-service;1",&rv));
@ -177,12 +181,13 @@ void CnsIObserServ::NotifyObserversTest()
{
FormatAndPrintOutput("The notified observer = ", ObserverTable[i].theTopic, 1);
rv = observerService->NotifyObservers(nsnull, ObserverTable[i].theTopic, 0);
RvTestResult(rv, "NotifyObservers() test", 2);
RvTestResult(rv, "NotifyObservers() test", displayType);
RvTestResultDlg(rv, "NotifyObservers() test");
}
}
void CnsIObserServ::EnumerateObserversTest()
void CnsIObserServ::EnumerateObserversTest(int displayType)
{
PRInt32 i=0;
nsCOMPtr<nsIObserverService> observerService(do_GetService("@mozilla.org/observer-service;1",&rv));
@ -202,7 +207,8 @@ void CnsIObserServ::EnumerateObserversTest()
rv = observerService->EnumerateObservers(ObserverTable[i].theTopic,
getter_AddRefs(simpleEnum));
RvTestResult(rv, "EnumerateObserversTest() test", 2);
RvTestResult(rv, "EnumerateObserversTest() test", displayType);
RvTestResultDlg(rv, "EnumerateObserversTest() test");
if (!simpleEnum)
{
QAOutput("Didn't get SimpleEnumerator object. Tests fail.");
@ -219,6 +225,7 @@ void CnsIObserServ::EnumerateObserversTest()
rv = observer->Observe(observer, ObserverTable[i].theTopic, 0);
RvTestResult(rv, "nsIObserver() test", 1);
RvTestResultDlg(rv, "nsIObserver() test");
// compare 'this' with observer object
if( this == NS_REINTERPRET_CAST(CnsIObserServ*,NS_REINTERPRET_CAST(void*, observer.get())))

View File

@ -64,9 +64,9 @@ public:
void RunAllTests();
void AddObserversTest(int);
void RemoveObserversTest();
void NotifyObserversTest();
void EnumerateObserversTest();
void RemoveObserversTest(int);
void NotifyObserversTest(int);
void EnumerateObserversTest(int);
void OnStartTests(UINT nMenuID);
};

View File

@ -101,7 +101,8 @@ void CNsIWebBrowser::WBGetContainerWindow()
QAOutput("Didn't get web browser chrome object.", 2);
else {
rv = qaWebBrowserChrome->ShowAsModal();
RvTestResult(rv, "nsIWebBrowserChrome::ShowAsModal() test", 2);
RvTestResult(rv, "nsIWebBrowserChrome::ShowAsModal() test", 1);
RvTestResultDlg(rv, "nsIWebBrowserChrome::ShowAsModal() test");
}
}
@ -126,7 +127,8 @@ void CNsIWebBrowser::WBGetURIContentListener()
else {
nsCOMPtr<nsISupports> qaSupports;
rv = qaURIContentListener->GetLoadCookie(getter_AddRefs(qaSupports));
RvTestResult(rv, "nsIURIContentListener::GetLoadCookie() test", 2);
RvTestResult(rv, "nsIURIContentListener::GetLoadCookie() test", 1);
RvTestResultDlg(rv, "nsIURIContentListener::GetLoadCookie() test");
}
}
@ -152,7 +154,8 @@ void CNsIWebBrowser::WBGetDOMWindow()
QAOutput("Didn't get dom window object.", 2);
else {
rv = qaDOMWindow->ScrollTo(50,50);
RvTestResult(rv, "nsIDOMWindow::ScrollTo() test", 2);
RvTestResult(rv, "nsIDOMWindow::ScrollTo() test", 1);
RvTestResultDlg(rv, "nsIDOMWindow::ScrollTo() test");
}
}
@ -207,7 +210,7 @@ void CNsIWebBrowser::WBSSetupProperty()
// nsIWebBrowserSetup methods
nsCOMPtr <nsIWebBrowserSetup> qaWBSetup(do_QueryInterface(qaWebBrowser, &rv));
RvTestResult(rv, "nsIWebBrowserSetup object test", 2);
RvTestResult(rv, "nsIWebBrowserSetup object test", 1);
RvTestResultDlg(rv, "nsIWebBrowserSetup object test");
if (!qaWBSetup) {

View File

@ -48,6 +48,7 @@
#include "testembed.h"
#include "qautils.h"
#include "nsiwebnav.h"
#include "UrlDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@ -113,8 +114,7 @@ void CNsIWebNav::OnStartTests(UINT nMenuID)
GoToIndexTest();
break ;
case ID_INTERFACES_NSIWEBNAV_LOADURI :
LoadUriTest(UrlTable[0].theUri, UrlTable[1].theFlag);
FormatAndPrintOutput("the loadFlag = ", nsIWebNavigation::LOAD_FLAGS_MASK, 2);
LoadUriTest(nsnull, nsnull, 1);
break ;
case ID_INTERFACES_NSIWEBNAV_RELOAD :
ReloadTest(nsIWebNavigation::LOAD_FLAGS_NONE);
@ -269,11 +269,29 @@ void CNsIWebNav::GoToIndexTest()
RvTestResult(rv, "GotoIndex() test", 2);
}
void CNsIWebNav::LoadUriTest(char *theUrl, PRUint32 theFlag)
void CNsIWebNav::LoadUriTest(char *theUrl, PRUint32 theFlag,
PRInt16 displayMode)
{
char theTotalString[500];
char theFlagName[200];
if (displayMode == 1) // load just one url from Url dialog
{
CUrlDialog myDialog;
if (myDialog.DoModal() == IDOK)
{
QAOutput("Begin Change URL test.", 1);
rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(myDialog.m_urlfield).get(),
myDialog.m_flagvalue, nsnull,nsnull, nsnull);
RvTestResult(rv, "rv LoadURI() test", 1);
FormatAndPrintOutput("The url = ", myDialog.m_urlfield, 2);
FormatAndPrintOutput("The flag = ", myDialog.m_flagvalue, 1);
QAOutput("End Change URL test.", 1);
}
return;
}
switch(theFlag)
{
case nsIWebNavigation::LOAD_FLAGS_NONE:

View File

@ -72,7 +72,7 @@ public:
void CanGoForwardTest();
void GoForwardTest();
void GoToIndexTest();
void LoadUriTest(char *, PRUint32);
void LoadUriTest(char *, PRUint32, PRInt16 displayMode=2);
void ReloadTest(PRUint32);
void StopUriTest(char *, PRUint32);
void GetDocumentTest(void);

View File

@ -293,9 +293,6 @@ void CProfile::RenameProfile()
rv = oNsProfile->RenameProfile(currProfileName, T2W("New default"));
RvTestResultDlg(rv, "oNsProfile->RenameProfile");
}
void CProfile::DeleteProfile()
@ -317,8 +314,6 @@ void CProfile::DeleteProfile()
rv = oNsProfile->DeleteProfile(currProfileName, PR_TRUE);
RvTestResultDlg(rv, "oNsProfile->DeleteProfile");
}
void CProfile::CloneProfile()
@ -352,7 +347,5 @@ void CProfile::ShutDownCurrentProfile()
RvTestResultDlg(rv, "Cannot get the nsIprofile object");
return ;
}
}

View File

@ -133,7 +133,7 @@ void CNsIDirectoryService::Init()
rv = theDirService->Init();
RvTestResult(rv, "rv Init() test", 1);
RvTestResultDlg(rv, "rv Init() test", true);
}
void CNsIDirectoryService::RegisterProvider()
{
@ -151,7 +151,7 @@ void CNsIDirectoryService::RegisterProvider()
}
rv= theDirService->RegisterProvider(provider);
RvTestResult(rv, "rv RegisterProvider() test", 1);
RvTestResultDlg(rv, "rv RegisterProvider() test");
}
void CNsIDirectoryService::UnRegisterProvider()
{
@ -170,6 +170,7 @@ void CNsIDirectoryService::UnRegisterProvider()
rv= theDirService->RegisterProvider(provider);
rv= theDirService->UnregisterProvider(provider);
RvTestResult(rv, "rv UnRegisterProvider() test", 1);
RvTestResultDlg(rv, "rv UnRegisterProvider() test");
}

View File

@ -129,25 +129,27 @@ void CNsIHistory::OnStartTests(UINT nMenuID)
switch(nMenuID)
{
case ID_INTERFACES_NSISHISTORY_RUNALLTESTS :
QAOutput("Begin nsISHistory tests.", 2);
RunAllTests();
QAOutput("End nsISHistory tests.", 2);
break ;
case ID_INTERFACES_NSISHISTORY_GETCOUNT :
GetCountTest(theSessionHistory, &numEntries);
GetCountTest(theSessionHistory, &numEntries, 2);
break ;
case ID_INTERFACES_NSISHISTORY_GETINDEX :
GetIndexTest(theSessionHistory, &theIndex);
GetIndexTest(theSessionHistory, &theIndex, 2);
break ;
case ID_INTERFACES_NSISHISTORY_GETMAXLENGTH :
GetMaxLengthTest(theSessionHistory, &theMaxLength);
GetMaxLengthTest(theSessionHistory, &theMaxLength, 2);
break ;
case ID_INTERFACES_NSISHISTORY_SETMAXLENGTH :
SetMaxLengthTest(theSessionHistory, theMaxLength);
SetMaxLengthTest(theSessionHistory, theMaxLength, 2);
break ;
case ID_INTERFACES_NSISHISTORY_GETENTRYATINDEX :
//GetEntryAtIndex(0, PR_FALSE, getter_AddRefs(theHistoryEntry));
for (theIndex = 0; theIndex < numEntries; theIndex++)
{
FormatAndPrintOutput("the index = ", theIndex, 2);
FormatAndPrintOutput("the index = ", theIndex, 1);
rv = theSessionHistory->GetEntryAtIndex(theIndex, PR_FALSE, getter_AddRefs(theHistoryEntry));
RvTestResult(rv, "GetEntryAtIndex() test", 1);
@ -157,14 +159,14 @@ void CNsIHistory::OnStartTests(UINT nMenuID)
QAOutput("We didn't get the History Entry object. No more tests performed.", 1);
return;
}
GetURIHistTest(theHistoryEntry);
GetTitleHistTest(theHistoryEntry);
GetIsSubFrameTest(theHistoryEntry);
GetURIHistTest(theHistoryEntry, 2);
GetTitleHistTest(theHistoryEntry, 2);
GetIsSubFrameTest(theHistoryEntry, 2);
} // end for loop
break ;
case ID_INTERFACES_NSISHISTORY_PURGEHISTORY :
PurgeHistoryTest(theSessionHistory, numEntries);
PurgeHistoryTest(theSessionHistory, numEntries, 2);
break ;
case ID_INTERFACES_NSISHISTORY_GETSHISTORYENUMERATOR :
//GetSHistoryEnumerator(getter_AddRefs(theSimpleEnum));
@ -177,20 +179,20 @@ void CNsIHistory::OnStartTests(UINT nMenuID)
QAOutput("theSimpleEnum for GetSHistoryEnumerator() invalid. Test failed.", 1);
return;
}
SimpleEnumTest(theSimpleEnum);
SimpleEnumTest(theSimpleEnum, 2);
break ;
case ID_INTERFACES_NSISHISTORY_NSIHISTORYENTRY_RUNALLTESTS :
RunAllHistoryEntryTests();
RunAllHistoryEntryTests(2);
break ;
case ID_INTERFACES_NSISHISTORY_NSIHISTORYENTRY_GETURI :
GetURIHistTest(theHistoryEntry);
GetURIHistTest(theHistoryEntry, 2);
break ;
case ID_INTERFACES_NSISHISTORY_NSIHISTORYENTRY_GETTITLE :
GetTitleHistTest(theHistoryEntry);
GetTitleHistTest(theHistoryEntry, 2);
break ;
case ID_INTERFACES_NSISHISTORY_NSIHISTORYENTRY_GETISSUBFRAME :
GetIsSubFrameTest(theHistoryEntry);
GetIsSubFrameTest(theHistoryEntry, 2);
break ;
}
@ -219,21 +221,21 @@ void CNsIHistory::RunAllTests()
return;
}
else {
QAOutput("theSessionHistory object was created.", 2);
QAOutput("theSessionHistory object was created.", 1);
theSessionHistory->GetCount(&numEntries);
}
// test count attribute in nsISHistory.idl
GetCountTest(theSessionHistory, &numEntries);
GetCountTest(theSessionHistory, &numEntries, 1);
// test index attribute in nsISHistory.idl
GetIndexTest(theSessionHistory, &theIndex);
GetIndexTest(theSessionHistory, &theIndex, 1);
// test maxLength attribute in nsISHistory.idl
SetMaxLengthTest(theSessionHistory, theMaxLength);
GetMaxLengthTest(theSessionHistory, &theMaxLength);
SetMaxLengthTest(theSessionHistory, theMaxLength, 1);
GetMaxLengthTest(theSessionHistory, &theMaxLength, 1);
QAOutput("Start nsiHistoryEntry tests.", 2);
QAOutput("Start nsiHistoryEntry tests.", 1);
// get theHistoryEntry object
rv = theSessionHistory->GetEntryAtIndex(0, PR_FALSE, getter_AddRefs(theHistoryEntry));
@ -255,7 +257,7 @@ void CNsIHistory::RunAllTests()
for (theIndex = 0; theIndex < numEntries; theIndex++)
{
FormatAndPrintOutput("the index = ", theIndex, 2);
FormatAndPrintOutput("the index = ", theIndex, 1);
//GetEntryAtIndexTest(theSessionHistory,theHistoryEntry, theIndex);
@ -268,13 +270,13 @@ void CNsIHistory::RunAllTests()
// nsiHistoryEntry.idl tests
// test URI attribute in nsIHistoryEntry.idl
GetURIHistTest(theHistoryEntry);
GetURIHistTest(theHistoryEntry, 1);
// test title attribute in nsIHistoryEntry.idl
GetTitleHistTest(theHistoryEntry);
GetTitleHistTest(theHistoryEntry, 1);
// test isSubFrame attribute in nsIHistoryEntry.idl
GetIsSubFrameTest(theHistoryEntry);
GetIsSubFrameTest(theHistoryEntry, 1);
} // end for loop
} // end outer else
@ -292,58 +294,62 @@ void CNsIHistory::RunAllTests()
if (!theSimpleEnum)
QAOutput("theSimpleEnum for GetSHistoryEnumerator() invalid. Test failed.", 1);
else
SimpleEnumTest(theSimpleEnum);
SimpleEnumTest(theSimpleEnum, 1);
// PurgeHistory() test
PurgeHistoryTest(theSessionHistory, numEntries);
PurgeHistoryTest(theSessionHistory, numEntries, 1);
}
// ***********************************************************************
// Individual nsISHistory tests
void CNsIHistory::GetCountTest(nsISHistory *theSessionHistory, PRInt32 *numEntries)
void CNsIHistory::GetCountTest(nsISHistory *theSessionHistory, PRInt32 *numEntries,
PRInt16 displayMode)
{
rv = theSessionHistory->GetCount(numEntries);
if (*numEntries < 0)
QAOutput("numEntries for GetCount() < 0. Test failed.", 1);
else {
FormatAndPrintOutput("GetCount():number of entries = ", *numEntries, 2);
FormatAndPrintOutput("GetCount():number of entries = ", *numEntries, displayMode);
RvTestResult(rv, "GetCount() (count attribute) test", 1);
RvTestResultDlg(rv, "GetCount() (count attribute) test");
}
}
void CNsIHistory::GetIndexTest(nsISHistory *theSessionHistory, PRInt32 *theIndex)
void CNsIHistory::GetIndexTest(nsISHistory *theSessionHistory, PRInt32 *theIndex,
PRInt16 displayMode)
{
rv = theSessionHistory->GetIndex(theIndex);
if (*theIndex <0)
QAOutput("theIndex for GetIndex() < 0. Test failed.", 1);
else {
FormatAndPrintOutput("GetIndex():the index = ", *theIndex, 2);
FormatAndPrintOutput("GetIndex():the index = ", *theIndex, displayMode);
RvTestResult(rv, "GetIndex() (index attribute) test", 1);
RvTestResultDlg(rv, "GetIndex() (index attribute) test");
}
}
void CNsIHistory::SetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 theMaxLength)
void CNsIHistory::SetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 theMaxLength,
PRInt16 displayMode)
{
rv = theSessionHistory->SetMaxLength(theMaxLength);
if (theMaxLength < 0)
QAOutput("theMaxLength for SetMaxLength() < 0. Test failed.", 1);
else {
RvTestResult(rv, "SetMaxLength() (MaxLength attribute) test", 1);
RvTestResult(rv, "SetMaxLength() (MaxLength attribute) test", displayMode);
RvTestResultDlg(rv, "SetMaxLength() (MaxLength attribute) test");
}
}
void CNsIHistory::GetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 *theMaxLength)
void CNsIHistory::GetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 *theMaxLength,
PRInt16 displayMode)
{
rv = theSessionHistory->GetMaxLength(theMaxLength);
if (*theMaxLength<0)
QAOutput("theMaxLength for GetMaxLength() < 0. Test failed.", 1);
else {
FormatAndPrintOutput("GetMaxLength():theMaxLength = ", *theMaxLength, 2);
FormatAndPrintOutput("GetMaxLength():theMaxLength = ", *theMaxLength, displayMode);
RvTestResult(rv, "GetMaxLength() (MaxLength attribute) test", 1);
RvTestResultDlg(rv, "GetMaxLength() (MaxLength attribute) test");
}
@ -368,7 +374,8 @@ void CNsIHistory::GetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 *theM
}*/
void CNsIHistory::GetURIHistTest(nsIHistoryEntry* theHistoryEntry)
void CNsIHistory::GetURIHistTest(nsIHistoryEntry* theHistoryEntry,
PRInt16 displayMode)
{
rv = theHistoryEntry->GetURI(getter_AddRefs(theUri));
RvTestResult(rv, "GetURI() (URI attribute) test", 1);
@ -382,11 +389,12 @@ void CNsIHistory::GetURIHistTest(nsIHistoryEntry* theHistoryEntry)
if (NS_FAILED(rv))
QAOutput("We didn't get the uriString.", 1);
else
FormatAndPrintOutput("The SH Url = ", uriString, 2);
FormatAndPrintOutput("The SH Url = ", uriString, displayMode);
}
}
void CNsIHistory::GetTitleHistTest(nsIHistoryEntry* theHistoryEntry)
void CNsIHistory::GetTitleHistTest(nsIHistoryEntry* theHistoryEntry,
PRInt16 displayMode)
{
nsXPIDLString theTitle;
const char * titleCString;
@ -400,11 +408,12 @@ void CNsIHistory::GetTitleHistTest(nsIHistoryEntry* theHistoryEntry)
}
titleCString = NS_ConvertUCS2toUTF8(theTitle).get();
FormatAndPrintOutput("The title = ", (char *)titleCString, 2);
FormatAndPrintOutput("The title = ", (char *)titleCString, displayMode);
}
void CNsIHistory::GetIsSubFrameTest(nsIHistoryEntry* theHistoryEntry)
void CNsIHistory::GetIsSubFrameTest(nsIHistoryEntry* theHistoryEntry,
PRInt16 displayMode)
{
PRBool isSubFrame;
@ -412,7 +421,7 @@ void CNsIHistory::GetIsSubFrameTest(nsIHistoryEntry* theHistoryEntry)
RvTestResult(rv, "GetIsSubFrame() (isSubFrame attribute) test", 1);
RvTestResultDlg(rv, "GetIsSubFrame() (isSubFrame attribute) test");
FormatAndPrintOutput("The subFrame boolean value = ", isSubFrame, 2);
FormatAndPrintOutput("The subFrame boolean value = ", isSubFrame, displayMode);
}
/*
@ -427,7 +436,8 @@ void CNsIHistory::GetSHEnumTest(nsISHistory *theSessionHistory,
}
*/
void CNsIHistory::SimpleEnumTest(nsISimpleEnumerator *theSimpleEnum)
void CNsIHistory::SimpleEnumTest(nsISimpleEnumerator *theSimpleEnum,
PRInt16 displayMode)
{
PRBool bMore = PR_FALSE;
nsCOMPtr<nsISupports> nextObj;
@ -449,11 +459,12 @@ void CNsIHistory::SimpleEnumTest(nsISimpleEnumerator *theSimpleEnum)
if (NS_FAILED(rv))
QAOutput("uriString for GetSpec() invalid. Test failed.", 1);
else
FormatAndPrintOutput("The SimpleEnum URL = ", uriString, 2);
FormatAndPrintOutput("The SimpleEnum URL = ", uriString, displayMode);
}
}
void CNsIHistory::PurgeHistoryTest(nsISHistory* theSessionHistory, PRInt32 numEntries)
void CNsIHistory::PurgeHistoryTest(nsISHistory* theSessionHistory, PRInt32 numEntries,
PRInt16 displayMode)
{
rv = theSessionHistory->PurgeHistory(numEntries);
RvTestResult(rv, "PurgeHistory() test", 1);
@ -461,7 +472,7 @@ void CNsIHistory::PurgeHistoryTest(nsISHistory* theSessionHistory, PRInt32 numEn
FormatAndPrintOutput("PurgeHistory(): num requested entries for removal = ", numEntries, 1);
}
void CNsIHistory::RunAllHistoryEntryTests()
void CNsIHistory::RunAllHistoryEntryTests(PRInt16 displayMode)
{
PRInt32 numEntries = 5;
PRInt32 theIndex;
@ -478,7 +489,7 @@ void CNsIHistory::RunAllHistoryEntryTests()
if (!theSessionHistory)
{
QAOutput("theSessionHistory object wasn't created. No session history tests performed.", 2);
QAOutput("theSessionHistory object wasn't created. No session history tests performed.", displayMode);
return;
}
else
@ -500,7 +511,7 @@ void CNsIHistory::RunAllHistoryEntryTests()
for (theIndex = 0; theIndex < numEntries; theIndex++)
{
FormatAndPrintOutput("the index = ", theIndex, 2);
FormatAndPrintOutput("the index = ", theIndex, displayMode);
//GetEntryAtIndexTest(theSessionHistory,theHistoryEntry, theIndex);
@ -513,13 +524,13 @@ void CNsIHistory::RunAllHistoryEntryTests()
// nsiHistoryEntry.idl tests
// test URI attribute in nsIHistoryEntry.idl
GetURIHistTest(theHistoryEntry);
GetURIHistTest(theHistoryEntry, displayMode);
// test title attribute in nsIHistoryEntry.idl
GetTitleHistTest(theHistoryEntry);
GetTitleHistTest(theHistoryEntry, displayMode);
// test isSubFrame attribute in nsIHistoryEntry.idl
GetIsSubFrameTest(theHistoryEntry);
GetIsSubFrameTest(theHistoryEntry, displayMode);
} // end for loop
} // end outer else

View File

@ -70,20 +70,20 @@ public:
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);
void GetCountTest(nsISHistory *, PRInt32 *, PRInt16);
void GetIndexTest(nsISHistory *, PRInt32 *, PRInt16);
void GetMaxLengthTest(nsISHistory *, PRInt32 *, PRInt16);
void SetMaxLengthTest(nsISHistory *, PRInt32, PRInt16);
void GetEntryAtIndexTest(nsISHistory *, nsIHistoryEntry *, PRInt32 theIndex, PRInt16);
void GetURIHistTest(nsIHistoryEntry *, PRInt16);
void GetTitleHistTest(nsIHistoryEntry *, PRInt16);
void GetIsSubFrameTest(nsIHistoryEntry *, PRInt16);
void GetSHEnumTest(nsISHistory*, nsISimpleEnumerator *, PRInt16);
void SimpleEnumTest(nsISimpleEnumerator *, PRInt16);
void PurgeHistoryTest(nsISHistory *, PRInt32, PRInt16);
void RunAllTests();
void OnStartTests(UINT nMenuID);
void RunAllHistoryEntryTests();
void RunAllHistoryEntryTests(PRInt16);
// Generated message map functions
protected:

View File

@ -88,7 +88,7 @@ Element ReqTable[] = {
{"http://www.intel.com/", 1, 1, 1, 0, 0, 0, 0},
{"http://www.aol.com/", 0, 1, 0, 0, 0, 1, 1},
{"https://www.yahoo.com/", 1, 1, 1, 1, 0, 1, 1},
{" data:text/plain;charset=iso-8859-7,%be%fg%be",
{"data:text/plain;charset=iso-8859-7,%be%fg%be",
1, 1, 1, 1, 0, 1, 1},
{"file://C|/Program Files/", 1, 1, 1, 1, 0, 1, 1},
{"ftp://ftp.netscape.com/", 1, 1, 1, 1, 0, 1, 1},
@ -223,7 +223,7 @@ nsIChannel * CNsIRequest::GetTheChannel(int i, nsILoadGroup *theLoadGroup)
nsCOMPtr<nsIChannel> theChannel;
theSpec = ReqTable[i].theUrl;
FormatAndPrintOutput("the input uri = ", theSpec, 2);
FormatAndPrintOutput("the input uri = ", theSpec, 1);
rv = NS_NewURI(getter_AddRefs(theURI), theSpec);
@ -240,6 +240,7 @@ nsIChannel * CNsIRequest::GetTheChannel(int i, nsILoadGroup *theLoadGroup)
else
QAOutput("The in/out URIs don't MATCH.", 1);
RvTestResult(rv, "NS_NewURI", 1);
RvTestResultDlg(rv, "NS_NewURI", true);
}
rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, theLoadGroup);
@ -248,8 +249,10 @@ nsIChannel * CNsIRequest::GetTheChannel(int i, nsILoadGroup *theLoadGroup)
QAOutput("We didn't get the Channel. Test failed.", 1);
return NULL;
}
else
else {
RvTestResult(rv, "NS_NewChannel", 1);
RvTestResultDlg(rv, "NS_NewURI");
}
nsCOMPtr<nsIStreamListener> listener(NS_STATIC_CAST(nsIStreamListener*, qaBrowserImpl));
nsCOMPtr<nsIWeakReference> thisListener(dont_AddRef(NS_GetWeakReference(listener)));
@ -258,6 +261,7 @@ nsIChannel * CNsIRequest::GetTheChannel(int i, nsILoadGroup *theLoadGroup)
// this calls nsIStreamListener::OnDataAvailable()
rv = theChannel->AsyncOpen(listener, nsnull);
RvTestResult(rv, "AsyncOpen()", 1);
RvTestResultDlg(rv, "AsyncOpen()");
return theChannel;
}
@ -270,6 +274,7 @@ void CNsIRequest::IsPendingReqTest(nsIRequest *request)
rv = request->IsPending(&reqPending);
RvTestResult(rv, "nsIRequest::IsPending() rv test", 1);
RvTestResultDlg(rv, "nsIRequest::IsPending() rv test()");
if (!reqPending)
QAOutput("Pending request = false.", 1);
@ -284,8 +289,9 @@ void CNsIRequest::GetStatusReqTest(nsIRequest *request)
rv = request->GetStatus(&theStatusError);
RvTestResult(rv, "nsIRequest::GetStatus() test", 1);
RvTestResult(rv, "the returned status error test", 1);
RvTestResultDlg(rv, "nsIRequest::GetStatus() test");
RvTestResult(theStatusError, "the returned status error test", 1);
RvTestResultDlg(theStatusError, "the returned status error test");
}
void CNsIRequest::SuspendReqTest(nsIRequest *request)
@ -294,6 +300,7 @@ void CNsIRequest::SuspendReqTest(nsIRequest *request)
rv = request->Suspend();
RvTestResult(rv, "nsIRequest::Suspend() test", 1);
RvTestResultDlg(rv, "nsIRequest::Suspend() test");
}
void CNsIRequest::ResumeReqTest(nsIRequest *request)
@ -302,6 +309,7 @@ void CNsIRequest::ResumeReqTest(nsIRequest *request)
rv = request->Resume();
RvTestResult(rv, "nsIRequest::Resume() test", 1);
RvTestResultDlg(rv, "nsIRequest::Resume() test");
}
void CNsIRequest::CancelReqTest(nsIRequest *request)
@ -311,7 +319,9 @@ void CNsIRequest::CancelReqTest(nsIRequest *request)
rv = request->Cancel(status);
RvTestResult(rv, "nsIRequest::Cancel() rv test", 1);
RvTestResultDlg(rv, "nsIRequest::Cancel() test");
RvTestResult(status, "nsIRequest::Cancel() status test", 1);
RvTestResultDlg(status, "nsIRequest::Cancel() status test");
}
void CNsIRequest::SetLoadGroupTest(nsIRequest *request,
@ -322,6 +332,7 @@ void CNsIRequest::SetLoadGroupTest(nsIRequest *request,
rv = request->SetLoadGroup(theLoadGroup);
RvTestResult(rv, "nsIRequest::SetLoadGroup() rv test", 1);
RvTestResultDlg(rv, "nsIRequest::SetLoadGroup() rv test");
}
void CNsIRequest::GetLoadGroupTest(nsIRequest *request)
@ -332,8 +343,10 @@ void CNsIRequest::GetLoadGroupTest(nsIRequest *request)
rv = request->GetLoadGroup(getter_AddRefs(theLoadGroup));
RvTestResult(rv, "nsIRequest::GetLoadGroup() rv test", 1);
RvTestResultDlg(rv, "nsIRequest::GetLoadGroup() rv test");
rv = theLoadGroup->GetRequests(getter_AddRefs(theSimpEnum));
RvTestResult(rv, "nsIRequest:: LoadGroups' GetRequests() rv test", 1);
RvTestResultDlg(rv, "nsIRequest:: LoadGroups' GetRequests() rv test");
}