2001-09-26 02:58:40 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
2001-09-22 04:49:38 +04:00
|
|
|
*
|
2001-09-26 02:58:40 +04:00
|
|
|
* 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/
|
2001-09-22 04:49:38 +04:00
|
|
|
*
|
2001-09-26 02:58:40 +04:00
|
|
|
* 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.
|
2001-09-22 04:49:38 +04:00
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-26 02:58:40 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2001-09-22 04:49:38 +04:00
|
|
|
*
|
2001-09-26 02:58:40 +04:00
|
|
|
* Contributor(s):
|
2001-09-22 04:49:38 +04:00
|
|
|
* David Epstein <depstein@netscape.com>
|
|
|
|
* Ashish Bhatt <ashishbhatt@netscape.com>
|
2001-09-26 02:58:40 +04:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2001-09-22 04:49:38 +04:00
|
|
|
|
|
|
|
// File Overview....
|
|
|
|
//
|
|
|
|
// Test cases for the nsiWebNavigation Interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "testembed.h"
|
|
|
|
#include "qautils.h"
|
2001-11-27 00:47:06 +03:00
|
|
|
#include "nsiwebnav.h"
|
2001-09-22 04:49:38 +04:00
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
#define new DEBUG_NEW
|
|
|
|
#undef THIS_FILE
|
|
|
|
static char THIS_FILE[] = __FILE__;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// CNsIWebNav
|
|
|
|
|
2001-11-27 00:47:06 +03:00
|
|
|
CNsIWebNav::CNsIWebNav(nsIWebNavigation *mWebNav)
|
2001-09-22 04:49:38 +04:00
|
|
|
{
|
2001-11-27 00:47:06 +03:00
|
|
|
qaWebNav = mWebNav ;
|
2001-09-22 04:49:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
CNsIWebNav::~CNsIWebNav()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// CNsIWebNav message handlers
|
|
|
|
// ***********************************************************************
|
|
|
|
// nsIWebNavigation iface
|
|
|
|
// ***********************************************************************
|
|
|
|
|
|
|
|
// Url table for web navigation
|
|
|
|
NavElement UrlTable[] = {
|
2002-04-20 06:24:27 +04:00
|
|
|
{"http://www.intel.com/", nsIWebNavigation::LOAD_FLAGS_NONE},
|
2001-09-22 04:49:38 +04:00
|
|
|
{"http://www.yahoo.com/", nsIWebNavigation::LOAD_FLAGS_NONE},
|
2002-04-06 06:58:50 +04:00
|
|
|
{"http://www.oracle.com/", nsIWebNavigation::LOAD_FLAGS_IS_LINK},
|
2001-09-22 04:49:38 +04:00
|
|
|
{"http://www.sun.com/", nsIWebNavigation::LOAD_FLAGS_IS_REFRESH},
|
2002-04-20 06:24:27 +04:00
|
|
|
{"ftp://ftp.mozilla.org/", nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY},
|
2002-02-02 05:34:27 +03:00
|
|
|
{"https://www.yahoo.com/", nsIWebNavigation::LOAD_FLAGS_NONE},
|
2001-09-22 04:49:38 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-11-27 00:47:06 +03:00
|
|
|
|
|
|
|
void CNsIWebNav::OnStartTests(UINT nMenuID)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch(nMenuID)
|
|
|
|
{
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_RUNALLTESTS :
|
|
|
|
RunAllTests();
|
|
|
|
break ;
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_GETCANGOBACK :
|
|
|
|
CanGoBackTest();
|
|
|
|
break ;
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_GETCANGOFORWARD :
|
|
|
|
CanGoForwardTest();
|
|
|
|
break ;
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_GOBACK :
|
|
|
|
GoBackTest();
|
|
|
|
break ;
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_GOFORWARD :
|
|
|
|
GoForwardTest();
|
|
|
|
break ;
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_GOTOINDEX :
|
|
|
|
GoToIndexTest();
|
|
|
|
break ;
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_LOADURI :
|
|
|
|
LoadUriandReload();
|
|
|
|
break ;
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_RELOAD :
|
2002-04-06 06:58:50 +04:00
|
|
|
ReloadTest(nsIWebNavigation::LOAD_FLAGS_NONE);
|
2001-11-27 00:47:06 +03:00
|
|
|
break ;
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_STOP :
|
|
|
|
StopUriTest("http://www.microsoft.com/");
|
|
|
|
break ;
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_GETDOCUMENT :
|
|
|
|
GetDocumentTest();
|
|
|
|
break ;
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_GETCURRENTURI :
|
|
|
|
GetCurrentURITest();
|
|
|
|
break ;
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_GETSESSIONHISTORY :
|
|
|
|
GetSHTest();
|
|
|
|
break ;
|
|
|
|
case ID_INTERFACES_NSIWEBNAV_SETSESSIONHISTORY :
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CNsIWebNav::LoadUriandReload()
|
|
|
|
{
|
|
|
|
int i=0;
|
|
|
|
// LoadURI() & reload tests
|
|
|
|
|
|
|
|
QAOutput("Run a few LoadURI() tests.", 2);
|
|
|
|
|
2002-02-02 05:34:27 +03:00
|
|
|
for (i=0; i < 6; i++)
|
2001-11-27 00:47:06 +03:00
|
|
|
{
|
|
|
|
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;
|
2002-02-02 05:34:27 +03:00
|
|
|
case 5:
|
|
|
|
ReloadTest(nsIWebNavigation::LOAD_FLAGS_NONE);
|
|
|
|
break;
|
2001-11-27 00:47:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CNsIWebNav::RunAllTests()
|
2001-09-22 04:49:38 +04:00
|
|
|
{
|
|
|
|
int i=0;
|
|
|
|
|
2001-11-27 00:47:06 +03:00
|
|
|
if ( qaWebNav)
|
2001-09-22 04:49:38 +04:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2001-11-27 00:47:06 +03:00
|
|
|
|
2001-09-22 04:49:38 +04:00
|
|
|
// ***********************************************************************
|
|
|
|
// Individual nsIWebNavigation tests
|
|
|
|
|
|
|
|
void CNsIWebNav::CanGoBackTest()
|
|
|
|
{
|
|
|
|
PRBool canGoBack = PR_FALSE;
|
2001-11-27 00:47:06 +03:00
|
|
|
rv = qaWebNav->GetCanGoBack(&canGoBack);
|
2001-09-22 04:49:38 +04:00
|
|
|
RvTestResult(rv, "GetCanGoBack() attribute test", 2);
|
|
|
|
FormatAndPrintOutput("canGoBack value = ", canGoBack, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CNsIWebNav::GoBackTest()
|
|
|
|
{
|
2001-11-27 00:47:06 +03:00
|
|
|
rv = qaWebNav->GoBack();
|
2001-09-22 04:49:38 +04:00
|
|
|
RvTestResult(rv, "GoBack() test", 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CNsIWebNav::CanGoForwardTest()
|
|
|
|
{
|
|
|
|
PRBool canGoForward = PR_FALSE;
|
2001-11-27 00:47:06 +03:00
|
|
|
rv = qaWebNav->GetCanGoForward(&canGoForward);
|
2001-09-22 04:49:38 +04:00
|
|
|
RvTestResult(rv, "GetCanGoForward() attribute test", 2);
|
|
|
|
FormatAndPrintOutput("canGoForward value = ", canGoForward, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CNsIWebNav::GoForwardTest()
|
|
|
|
{
|
2001-11-27 00:47:06 +03:00
|
|
|
rv = qaWebNav->GoForward();
|
2001-09-22 04:49:38 +04:00
|
|
|
RvTestResult(rv, "GoForward() test", 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CNsIWebNav::GoToIndexTest()
|
|
|
|
{
|
|
|
|
PRInt32 theIndex = 0;
|
|
|
|
|
2001-11-27 00:47:06 +03:00
|
|
|
rv = qaWebNav->GotoIndex(theIndex);
|
2001-09-22 04:49:38 +04:00
|
|
|
RvTestResult(rv, "GotoIndex() test", 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CNsIWebNav::LoadUriTest(char *theUrl, const unsigned long theFlag)
|
|
|
|
{
|
|
|
|
char theTotalString[500];
|
2001-11-27 00:47:06 +03:00
|
|
|
char theFlagName[200];
|
2001-09-22 04:49:38 +04:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2001-12-01 01:35:33 +03:00
|
|
|
rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).get(),
|
|
|
|
theFlag,
|
|
|
|
nsnull,
|
|
|
|
nsnull,
|
|
|
|
nsnull);
|
2001-09-22 04:49:38 +04:00
|
|
|
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];
|
2001-11-27 00:47:06 +03:00
|
|
|
char theFlagName[200];
|
2001-09-22 04:49:38 +04:00
|
|
|
|
|
|
|
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 | \
|
2001-11-27 00:47:06 +03:00
|
|
|
nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY:
|
|
|
|
strcpy(theFlagName, "nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE | "
|
|
|
|
"nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY");
|
2001-09-22 04:49:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-11-27 00:47:06 +03:00
|
|
|
rv = qaWebNav->Reload(theFlag);
|
2001-09-22 04:49:38 +04:00
|
|
|
sprintf(theTotalString, "%s%s%s%s", "Reload(): ", " w/ ", theFlagName, " test");
|
|
|
|
RvTestResult(rv, theTotalString, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CNsIWebNav::StopUriTest(char *theUrl)
|
|
|
|
{
|
|
|
|
char theTotalString[200];
|
|
|
|
|
2001-12-01 01:35:33 +03:00
|
|
|
qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).get(),
|
|
|
|
nsIWebNavigation::LOAD_FLAGS_NONE,
|
|
|
|
nsnull,
|
|
|
|
nsnull,
|
|
|
|
nsnull);
|
|
|
|
rv = qaWebNav->Stop(nsIWebNavigation::STOP_ALL);
|
2001-09-22 04:49:38 +04:00
|
|
|
sprintf(theTotalString, "%s%s%s", "Stop(): ", theUrl, " test");
|
|
|
|
RvTestResult(rv, theTotalString, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CNsIWebNav::GetDocumentTest()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMDocument> theDocument;
|
|
|
|
nsCOMPtr<nsIDOMDocumentType> theDocType;
|
|
|
|
|
2001-11-27 00:47:06 +03:00
|
|
|
rv = qaWebNav->GetDocument(getter_AddRefs(theDocument));
|
2001-09-22 04:49:38 +04:00
|
|
|
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;
|
|
|
|
|
2001-11-27 00:47:06 +03:00
|
|
|
rv = qaWebNav->GetCurrentURI(getter_AddRefs(theUri));
|
2001-09-22 04:49:38 +04:00
|
|
|
if (!theUri) {
|
|
|
|
QAOutput("We didn't get the URI. Test failed.", 2);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
RvTestResult(rv, "GetCurrentURI() test", 2);
|
|
|
|
|
2002-03-16 05:31:53 +03:00
|
|
|
nsCAutoString uriString;
|
|
|
|
rv = theUri->GetSpec(uriString);
|
2001-09-22 04:49:38 +04:00
|
|
|
RvTestResult(rv, "nsIURI::GetSpec() for nsIWebNav test", 1);
|
|
|
|
|
2002-03-16 05:31:53 +03:00
|
|
|
FormatAndPrintOutput("the nsIWebNav uri = ", uriString, 2);
|
2001-09-22 04:49:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void CNsIWebNav::GetSHTest()
|
|
|
|
{
|
|
|
|
PRInt32 numOfElements;
|
|
|
|
|
|
|
|
nsCOMPtr<nsISHistory> theSessionHistory;
|
2001-11-27 00:47:06 +03:00
|
|
|
rv = qaWebNav->GetSessionHistory(getter_AddRefs(theSessionHistory));
|
2001-09-22 04:49:38 +04:00
|
|
|
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);
|
|
|
|
}
|