added more urls with more diversity to the URLTable. Stop() now tests with all 3 flags. Modified nsIWebNav code.

a=asa for QA checkins that are not part of the default builds
This commit is contained in:
depstein%netscape.com 2002-05-29 03:13:37 +00:00
Родитель c9e6923275
Коммит a84997bc3a
5 изменённых файлов: 135 добавлений и 87 удалений

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

@ -659,6 +659,33 @@ void CTests::OnToolsTestYourMethod2()
{
// place your test code here
// nsIWebProgress test cases
// get webProg object
nsCOMPtr<nsIInterfaceRequestor> qaIReq(do_QueryInterface(qaWebBrowser));
nsCOMPtr<nsIWebProgress> qaWebProgress(do_GetInterface(qaIReq));
if (!qaWebProgress)
QAOutput("Didn't get web progress object.", 2);
else
QAOutput("We got web progress object.", 2);
// addWebProgListener
nsCOMPtr<nsIWebProgressListener> listener(NS_STATIC_CAST(nsIWebProgressListener*, qaBrowserImpl));
rv = qaWebProgress->AddProgressListener(listener, nsIWebProgress::NOTIFY_ALL);
RvTestResult(rv, "nsIWebProgress::AddProgressListener() test", 2);
// removeWebProgListener
rv = qaWebProgress->RemoveProgressListener(listener);
RvTestResult(rv, "nsIWebProgress::RemoveProgressListener() test", 2);
// getTheDOMWindow
nsCOMPtr<nsIDOMWindow> qaDOMWindow;
rv = qaWebProgress->GetDOMWindow(getter_AddRefs(qaDOMWindow));
if (!qaWebProgress)
QAOutput("Didn't get DOM Window object.", 2);
else
RvTestResult(rv, "nsIWebProgress::GetDOMWindow() test", 2);
}
// ***********************************************************************

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

@ -77,15 +77,19 @@ CNsIWebNav::~CNsIWebNav()
// Url table for web navigation
NavElement UrlTable[] = {
{"http://www.intel.com/", nsIWebNavigation::LOAD_FLAGS_NONE},
{"http://www.yahoo.com/", nsIWebNavigation::LOAD_FLAGS_NONE},
{"http://www.yahoo.com/", nsIWebNavigation::LOAD_FLAGS_MASK},
{"http://www.oracle.com/", nsIWebNavigation::LOAD_FLAGS_IS_LINK},
{"http://www.sun.com/", nsIWebNavigation::LOAD_FLAGS_IS_REFRESH},
{"ftp://ftp.netscape.com", nsIWebNavigation::LOAD_FLAGS_BYPASS_HISTORY},
{"ftp://ftp.mozilla.org/", nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY},
{"https://www.yahoo.com/", nsIWebNavigation::LOAD_FLAGS_NONE},
{"https://www.yahoo.com/", nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE},
{"https://www.cisco.com", nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY},
{"about:plugins", nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE},
{"javascript:", nsIWebNavigation::LOAD_FLAGS_NONE},
{"file://C|/Program Files", nsIWebNavigation::LOAD_FLAGS_NONE}
};
void CNsIWebNav::OnStartTests(UINT nMenuID)
{
@ -110,13 +114,14 @@ void CNsIWebNav::OnStartTests(UINT nMenuID)
GoToIndexTest();
break ;
case ID_INTERFACES_NSIWEBNAV_LOADURI :
LoadUriandReload();
LoadUriTest(UrlTable[0].theUri, UrlTable[0].theFlag);
break ;
case ID_INTERFACES_NSIWEBNAV_RELOAD :
ReloadTest(nsIWebNavigation::LOAD_FLAGS_NONE);
break ;
case ID_INTERFACES_NSIWEBNAV_STOP :
StopUriTest("http://www.microsoft.com/");
StopUriTest("file://C|/Program Files",
nsIWebNavigation::STOP_ALL);
break ;
case ID_INTERFACES_NSIWEBNAV_GETDOCUMENT :
GetDocumentTest();
@ -133,14 +138,63 @@ void CNsIWebNav::OnStartTests(UINT nMenuID)
}
void CNsIWebNav::LoadUriandReload()
void CNsIWebNav::RunAllTests()
{
int i=0;
if (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);
LoadUriandReload(11);
// Stop() tests
StopUriTest("http://www.microsoft.com", nsIWebNavigation::STOP_ALL);
StopUriTest("https://www.microsoft.com/", nsIWebNavigation::STOP_NETWORK);
StopUriTest("ftp://ftp.microsoft.com/", nsIWebNavigation::STOP_CONTENT);
// document test
GetDocumentTest();
// uri test
GetCurrentURITest();
// session history test
GetSHTest();
}
void CNsIWebNav::LoadUriandReload(int URItotal)
{
int i=0;
// LoadURI() & reload tests
QAOutput("Run a few LoadURI() tests.", 2);
QAOutput("Run a few LoadURI() and Reload() tests.", 2);
for (i=0; i < 6; i++)
for (i=0; i < URItotal; i++)
{
LoadUriTest(UrlTable[i].theUri, UrlTable[i].theFlag);
switch (i)
@ -170,81 +224,10 @@ void CNsIWebNav::LoadUriandReload()
}
void CNsIWebNav::RunAllTests()
{
int i=0;
if ( 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;
@ -361,8 +344,6 @@ void CNsIWebNav::ReloadTest(const unsigned long theFlag)
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");
strcpy(theFlagName, "cache & proxy");
break;
}
@ -372,17 +353,26 @@ void CNsIWebNav::ReloadTest(const unsigned long theFlag)
RvTestResult(rv, theTotalString, 2);
}
void CNsIWebNav::StopUriTest(char *theUrl)
void CNsIWebNav::StopUriTest(char *theUrl, const unsigned long theFlag)
{
char theTotalString[200];
char flagString[100];
if (theFlag == nsIWebNavigation::STOP_ALL)
strcpy(flagString, "STOP_ALL");
else if (theFlag == nsIWebNavigation::STOP_NETWORK)
strcpy(flagString, "STOP_NETWORK");
else
strcpy(flagString, "STOP_CONTENT");
qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
rv = qaWebNav->Stop(nsIWebNavigation::STOP_ALL);
sprintf(theTotalString, "%s%s%s", "Stop(): ", theUrl, " test");
rv = qaWebNav->Stop(theFlag);
sprintf(theTotalString, "%s%s%s%s", "Stop(): ", theUrl, " test: ", flagString);
RvTestResult(rv, theTotalString, 2);
}

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

@ -74,11 +74,11 @@ public:
void GoToIndexTest();
void LoadUriTest(char *, const unsigned long);
void ReloadTest(const unsigned long);
void StopUriTest(char *);
void StopUriTest(char *, const unsigned long);
void GetDocumentTest(void);
void GetCurrentURITest(void);
void GetSHTest(void);
void LoadUriandReload();
void LoadUriandReload(int);
void OnStartTests(UINT nMenuID);
void RunAllTests();

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

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

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

@ -746,6 +746,10 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,131,22,50,14
LTEXT "Enter URL here:",IDC_ENTER_URLTEXT,64,55,71,8
EDITTEXT IDC_URLFIELD,25,68,134,14,ES_AUTOHSCROLL
COMBOBOX IDC_COMBO1,25,29,86,72,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
CONTROL "Select Load Flag:",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,32,14,80,10
END
IDD_RUNTESTSDLG DIALOG DISCARDABLE 0, 0, 331, 186
@ -868,6 +872,33 @@ END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog Info
//
IDD_URLDIALOG DLGINIT
BEGIN
IDC_COMBO1, 0x403, 6, 0
0x4f4e, 0x454e, 0x0020,
IDC_COMBO1, 0x403, 5, 0
0x414d, 0x4b53, "\000"
IDC_COMBO1, 0x403, 8, 0
0x5349, 0x4c5f, 0x4e49, 0x004b,
IDC_COMBO1, 0x403, 15, 0
0x5942, 0x4150, 0x5353, 0x485f, 0x5349, 0x4f54, 0x5952, "\000"
IDC_COMBO1, 0x403, 16, 0
0x4552, 0x4c50, 0x4341, 0x5f45, 0x4948, 0x5453, 0x524f, 0x0059,
IDC_COMBO1, 0x403, 13, 0
0x5942, 0x4150, 0x5353, 0x435f, 0x4341, 0x4548, "\000"
IDC_COMBO1, 0x403, 13, 0
0x5942, 0x4150, 0x5353, 0x505f, 0x4f52, 0x5958, "\000"
IDC_COMBO1, 0x403, 15, 0
0x4843, 0x5241, 0x4553, 0x5f54, 0x4843, 0x4e41, 0x4547, "\000"
0
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table