Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
CNsIWebNav Class Reference

#include <nsIWebNav.h>

Collaboration diagram for CNsIWebNav:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CNsIWebNav (nsIWebNavigation *mWebNav)
void CanGoBackTest (PRInt16)
void GoBackTest (PRInt16)
void CanGoForwardTest (PRInt16)
void GoForwardTest (PRInt16)
void GoToIndexTest (PRInt16)
void LoadURITest (char *, PRUint32, PRInt16 displayMode=1, PRBool runAllTests=PR_FALSE)
void ReloadTest (PRUint32, PRInt16)
void StopURITest (char *, PRUint32, PRInt16)
void GetDocumentTest (PRInt16)
void GetCurrentURITest (PRInt16)
void GetReferringURITest (PRInt16)
void GetSHTest (PRInt16)
void SetSHTest (PRInt16)
void LoadUriandReload (int)
void OnStartTests (UINT nMenuID)
void RunAllTests ()
virtual ~CNsIWebNav ()

Public Attributes

nsCOMPtr< nsIWebNavigationqaWebNav

Detailed Description

Definition at line 56 of file nsIWebNav.h.


Constructor & Destructor Documentation

Definition at line 61 of file nsIWebNav.cpp.

{
       qaWebNav = mWebNav ;
}
CNsIWebNav::~CNsIWebNav ( ) [virtual]

Definition at line 66 of file nsIWebNav.cpp.

{
}

Member Function Documentation

Definition at line 241 of file nsIWebNav.cpp.

{
   PRBool canGoBack = PR_FALSE;
   rv =  qaWebNav->GetCanGoBack(&canGoBack);
   RvTestResult(rv, "GetCanGoBack() attribute test", displayMode);
   FormatAndPrintOutput("canGoBack value = ", canGoBack, displayMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 255 of file nsIWebNav.cpp.

{
   PRBool canGoForward = PR_FALSE;
   rv =  qaWebNav->GetCanGoForward(&canGoForward);
   RvTestResult(rv, "GetCanGoForward() attribute test", displayMode);
   FormatAndPrintOutput("canGoForward value = ", canGoForward, displayMode); 
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 425 of file nsIWebNav.cpp.

{
   nsCOMPtr<nsIURI> theURI;

   rv =  qaWebNav->GetCurrentURI(getter_AddRefs(theURI));
   if (!theURI) {
      QAOutput("We didn't get the URI. Test failed.", 2);
         return;
   }
   else
         RvTestResult(rv, "GetCurrentURI() test", displayMode);

   nsCAutoString uriString;
   rv = theURI->GetSpec(uriString);
   RvTestResult(rv, "nsIURI::GetSpec() for nsIWebNav test", 1);

   FormatAndPrintOutput("the nsIWebNav uri = ", uriString, displayMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 408 of file nsIWebNav.cpp.

{
   nsCOMPtr<nsIDOMDocument> theDocument;
   nsCOMPtr<nsIDOMDocumentType> theDocType;
   
   rv =  qaWebNav->GetDocument(getter_AddRefs(theDocument));
   if (!theDocument) {
         QAOutput("We didn't get the document. Test failed.", 2);
         return;
   }
   else
         RvTestResult(rv, "GetDocument() test", displayMode);

   rv = theDocument->GetDoctype(getter_AddRefs(theDocType));
   RvTestResult(rv, "nsIDOMDocument::GetDoctype() for nsIWebNav test", displayMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 444 of file nsIWebNav.cpp.

{
   nsCOMPtr<nsIURI> theURI;
   nsCAutoString uriString;
   CUrlDialog myDialog;
   if (myDialog.DoModal() == IDOK)
   {
         uriString = myDialog.m_urlfield;
         rv = NS_NewURI(getter_AddRefs(theURI), uriString);
         if (theURI)
               QAOutput("We GOT the URI.", 1);
         else
               QAOutput("We DIDN'T GET the URI.", 1);
         rv = qaWebNav->GetReferringURI(getter_AddRefs(theURI));
         RvTestResult(rv, "GetReferringURI() test", displayMode);
//       rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(myDialog.m_urlfield).get(),
//                                                      myDialog.m_flagvalue, theURI, nsnull, nsnull);
   }
   if (!theURI) {
      QAOutput("We didn't get the URI. Test failed.", 2);
         return;
   }

   rv = theURI->GetSpec(uriString);
   RvTestResult(rv, "nsIURI::GetSpec() for nsIWebNav test", 1);

   FormatAndPrintOutput("the nsIWebNav uri = ", uriString, displayMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 473 of file nsIWebNav.cpp.

{
   PRInt32 numOfElements;

   nsCOMPtr<nsISHistory> theSessionHistory;
   rv =  qaWebNav->GetSessionHistory(getter_AddRefs(theSessionHistory));
   if (!theSessionHistory) {
      QAOutput("We didn't get the session history. Test failed.", 2);
         return;
   }
   else
         RvTestResult(rv, "GetSessionHistory() test", displayMode);

   rv = theSessionHistory->GetCount(&numOfElements);
   RvTestResult(rv, "nsISHistory::GetCount() for nsIWebNav test", 1);
 
   FormatAndPrintOutput("the sHist entry count = ", numOfElements, displayMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 249 of file nsIWebNav.cpp.

{
   rv =  qaWebNav->GoBack();
   RvTestResult(rv, "GoBack() test", displayMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 263 of file nsIWebNav.cpp.

{
   rv =  qaWebNav->GoForward();
   RvTestResult(rv, "GoForward() test", displayMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 269 of file nsIWebNav.cpp.

{
   PRInt32 theIndex = 0;

   rv =  qaWebNav->GotoIndex(theIndex);
   RvTestResult(rv, "GotoIndex() test", displayMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 198 of file nsIWebNav.cpp.

{
   int i=0, j=0;
   // LoadURI() & reload tests

   QAOutput("Run a few LoadURI() and Reload() tests.", 1);

   for (j=0; j < 9; j++) 
   {
          for (i=0; i < URItotal; i++)
          {
                 LoadURITest(UrlTable[i].theURI, UrlTable[j].theFlag, 2, PR_TRUE);
                 switch (i)
                 {
                 case 0:
                        ReloadTest(nsIWebNavigation::LOAD_FLAGS_NONE, 1);
                        break;
                 case 1:
                        ReloadTest(nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE, 1);
                        break;
                 case 2:
                        ReloadTest(nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY, 1);
                        break;
                 // simulate shift-reload
                 case 3:
                        ReloadTest(nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE |
                                            nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY, 1);
                        break;
                 case 4:
                        ReloadTest(nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE, 1);
                        break;
                 case 5:
                        ReloadTest(nsIWebNavigation::LOAD_FLAGS_NONE, 1);
                        break;
                 } 
          }
   }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CNsIWebNav::LoadURITest ( char *  theUrl,
PRUint32  theFlag,
PRInt16  displayMode = 1,
PRBool  runAllTests = PR_FALSE 
)

Definition at line 277 of file nsIWebNav.cpp.

{
   char theTotalString[500];
   char theFlagName[200];

   if (runAllTests == PR_FALSE)    // 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, displayMode);
              FormatAndPrintOutput("The flag = ", myDialog.m_flagvalue, displayMode);
              QAOutput("End Change URL test.", 1);
         }
         return;
   }

   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 = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).get(), 
                          theFlag,
                          nsnull,
                          nsnull,
                          nsnull);
   sprintf(theTotalString, "%s%s%s%s%s", "LoadURI(): ", theUrl, " w/ ", theFlagName, " test");
   RvTestResult(rv, theTotalString, displayMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CNsIWebNav::ReloadTest ( PRUint32  theFlag,
PRInt16  displayMode 
)

Definition at line 340 of file nsIWebNav.cpp.

{
   char theTotalString[500];
   char theFlagName[200];

  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, "cache & proxy");
      break;
  } 

   rv =  qaWebNav->Reload(theFlag);
   sprintf(theTotalString, "%s%s%s%s", "Reload(): ", " w/ ", theFlagName, " test");
   RvTestResult(rv, theTotalString, displayMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 143 of file nsIWebNav.cpp.

{
   int i=0;

   if (qaWebNav)
          QAOutput("We have the web nav object.", 1);
   else {
          QAOutput("We don't have the web nav object. No tests performed.", 2);
          return;
   }

   // load a couple of URLs to get things going
       LoadURITest("http://www.cisco.com", nsIWebNavigation::LOAD_FLAGS_NONE, 2, PR_TRUE);
       LoadURITest("www.google.com", nsIWebNavigation::LOAD_FLAGS_NONE, 2, PR_TRUE);
       
   // canGoBack attribute test
   CanGoBackTest(1);

   // GoBack test
   GoBackTest(2);

   // canGoForward attribute test
   CanGoForwardTest(1);

   // GoForward test
   GoForwardTest(2);

   // GotoIndex test
   GoToIndexTest(2);

   // LoadURI() & reload tests

   QAOutput("Run a few LoadURI() tests.", 1);

       
   LoadUriandReload(11);

 
       // Stop() tests
   StopURITest("http://www.microsoft.com", nsIWebNavigation::STOP_ALL, 1);
   StopURITest("https://www.microsoft.com/", nsIWebNavigation::STOP_NETWORK, 1);
   StopURITest("ftp://ftp.microsoft.com/", nsIWebNavigation::STOP_CONTENT, 1);

   // document test
   GetDocumentTest(1);
   
   // uri test
   GetCurrentURITest(1);
   GetReferringURITest(1);

   // session history test
   SetSHTest(1);
   GetSHTest(1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 492 of file nsIWebNav.cpp.

{
   nsCOMPtr<nsISHistory> theSessionHistory, tempSHObject;
   // we want to save the existing session history
   rv =  qaWebNav->GetSessionHistory(getter_AddRefs(theSessionHistory));
   // this will create the test session history object
   tempSHObject = do_CreateInstance(NS_SHISTORY_CONTRACTID);
   rv = qaWebNav->SetSessionHistory(tempSHObject);
   RvTestResult(rv, "SetSessionHistory() test", displayMode);
   if (!tempSHObject)
      QAOutput("We didn't get the session history test object. Test failed.", 2);
       // we now reset the previous session history
   rv =  qaWebNav->SetSessionHistory(theSessionHistory);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CNsIWebNav::StopURITest ( char *  theUrl,
PRUint32  theFlag,
PRInt16  displayMode 
)

Definition at line 384 of file nsIWebNav.cpp.

{
   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(theFlag);
   sprintf(theTotalString, "%s%s%s%s", "Stop(): ", theUrl, " test: ", flagString);
   RvTestResult(rv, theTotalString, displayMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 64 of file nsIWebNav.h.


The documentation for this class was generated from the following files: