Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes
CTests Class Reference

#include <Tests.h>

Collaboration diagram for CTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CTests (nsIWebBrowser *mWebBrowser, nsIBaseWindow *mBaseWindow, nsIWebNavigation *mWebNav, CBrowserImpl *mpBrowserImpl)
virtual ~CTests ()
virtual BOOL OnCmdMsg (UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo)

Public Attributes

nsCOMPtr< nsIWebBrowserqaWebBrowser
nsCOMPtr< nsIBaseWindowqaBaseWindow
nsCOMPtr< nsIWebNavigationqaWebNav
CBrowserImplqaBrowserImpl
CUrlDialog myDialog

Protected Member Functions

afx_msg void OnUpdateNavBack (CCmdUI *pCmdUI)
afx_msg void OnUpdateNavForward (CCmdUI *pCmdUI)
afx_msg void OnUpdateNavStop (CCmdUI *pCmdUI)
afx_msg void OnUpdateCut (CCmdUI *pCmdUI)
afx_msg void OnUpdateCopy (CCmdUI *pCmdUI)
afx_msg void OnUpdatePaste (CCmdUI *pCmdUI)
afx_msg void OnTestsChangeUrl ()
afx_msg void OnTestsGlobalHistory ()
afx_msg void OnTestsCreateFile ()
afx_msg void OnTestsCreateprofile ()
afx_msg void OnTestsAddTooltipListener ()
afx_msg void OnTestsAddWebProgListener ()
afx_msg void OnTestsAddHistoryListener ()
afx_msg void OnTestsRemovehistorylistener ()
afx_msg void OnTestsAddUriContentListenerByWebBrowser ()
afx_msg void OnTestsAddUriContentListenerByUriLoader ()
afx_msg void OnTestsAddUriContentListenerByOpenUri ()
afx_msg void OnTestsNSNewChannelAndAsyncOpen ()
afx_msg void OnTestsIOServiceNewURI ()
afx_msg void OnTestsProtocolHandlerNewURI ()
afx_msg void OnInterfacesNsifile ()
afx_msg void OnToolsRemoveGHPage ()
afx_msg void OnToolsRemoveAllGH ()
afx_msg void OnToolsViewLogfile ()
afx_msg void OnToolsDeleteLogfile ()
afx_msg void OnToolsTestYourMethod ()
afx_msg void OnToolsTestYourMethod2 ()
afx_msg void OnVerifybugs70228 ()
afx_msg void OnVerifybugs90195 ()
afx_msg void OnVerifybugs169617 ()
afx_msg void OnVerifybugs170274 ()
afx_msg void OnPasteTest ()
afx_msg void OnCopyTest ()
afx_msg void OnSelectAllTest ()
afx_msg void OnSelectNoneTest ()
afx_msg void OnCutSelectionTest ()
afx_msg void copyLinkLocationTest ()
afx_msg void canCopySelectionTest ()
afx_msg void canCutSelectionTest ()
afx_msg void canPasteTest ()
afx_msg void OnInterfacesNsirequest ()
afx_msg void OnInterfacesNsidomwindow ()
afx_msg void OnInterfacesNsidirectoryservice ()
afx_msg void OnInterfacesNsiselection ()
afx_msg void OnInterfacesNsiprofile ()
afx_msg void OnInterfacesNsishistory ()
afx_msg void OnInterfacesNsiwebnav ()
afx_msg void OnInterfacesNsiclipboardcommands ()
afx_msg void OnInterfacesNsiobserverservice ()
afx_msg void OnInterfacesNsiwebbrowser ()
afx_msg void OnInterfacesNsiwebprogress ()
afx_msg void OnInterfacesNsiwebbrowfind ()
afx_msg void OnInterfacesNsieditingsession ()
afx_msg void OnInterfacesNsicommandmgr ()
afx_msg void OnInterfacesNsicmdparams ()
afx_msg void OnInterfacesRunalltestcases ()
afx_msg void OnInterfacesNsichannel ()
afx_msg void OnInterfacesNsihttpchannel ()
void InitWithPathTest (nsILocalFile *)
void AppendRelativePathTest (nsILocalFile *)
void FileCreateTest (nsILocalFile *)
void FileExistsTest (nsILocalFile *)
void FileCopyTest (nsILocalFile *, nsILocalFile *)
void FileMoveTest (nsILocalFile *, nsILocalFile *)

Private Attributes

PRBool exists
nsCOMPtr< nsIURItheURI
nsCOMPtr< nsIChanneltheChannel
UINT nCommandID

Detailed Description

Definition at line 61 of file Tests.h.


Constructor & Destructor Documentation

CTests::CTests ( nsIWebBrowser mWebBrowser,
nsIBaseWindow mBaseWindow,
nsIWebNavigation mWebNav,
CBrowserImpl mpBrowserImpl 
)

Definition at line 327 of file Tests.cpp.

{
       qaWebBrowser = mWebBrowser;
       qaBaseWindow = mBaseWindow;
       qaWebNav = mWebNav;
       qaBrowserImpl = mpBrowserImpl;
}
CTests::~CTests ( ) [virtual]

Definition at line 338 of file Tests.cpp.

{

}

Member Function Documentation

afx_msg void CTests::canCopySelectionTest ( ) [protected]
afx_msg void CTests::canCutSelectionTest ( ) [protected]
afx_msg void CTests::canPasteTest ( ) [protected]
afx_msg void CTests::copyLinkLocationTest ( ) [protected]
void CTests::FileCopyTest ( nsILocalFile ,
nsILocalFile  
) [protected]
void CTests::FileMoveTest ( nsILocalFile ,
nsILocalFile  
) [protected]
BOOL CTests::OnCmdMsg ( UINT  nID,
int  nCode,
void pExtra,
AFX_CMDHANDLERINFO *  pHandlerInfo 
) [virtual]

Definition at line 939 of file Tests.cpp.

{
   // To handle Menu handlers add here. Don't have to do if not handling
   // menu handlers
       nCommandID = nID;

       return CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}

Here is the caller graph for this function:

afx_msg void CTests::OnCopyTest ( ) [protected]
afx_msg void CTests::OnCutSelectionTest ( ) [protected]

Definition at line 1045 of file Tests.cpp.

{
       CnsIChannelTests oChannelTests(qaWebBrowser, qaBrowserImpl);
       oChannelTests.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 991 of file Tests.cpp.

{
       CNsIClipBoardCmd  oClipCmd(qaWebBrowser);
       oClipCmd.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 1039 of file Tests.cpp.

{
       CnsICmdParams oCmdParams(qaWebBrowser);
       oCmdParams.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 1033 of file Tests.cpp.

{
       CnsICommandMgr oCommandMgr(qaWebBrowser);
       oCommandMgr.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 954 of file Tests.cpp.

{
       CNsIDirectoryService oNsIDirectoryService;
       oNsIDirectoryService.StartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 960 of file Tests.cpp.

{
       CDomWindow oDomWindow(qaWebBrowser);
       oDomWindow.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 1027 of file Tests.cpp.

{
       CnsIEditSession oEditSession(qaWebBrowser);
       oEditSession.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 1003 of file Tests.cpp.

{
       CNsIFile oFile ;
       oFile.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 1051 of file Tests.cpp.

{
       CnsIHttpChannelTests oHttpChannelTests(qaWebBrowser, qaBrowserImpl);
       oHttpChannelTests.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 997 of file Tests.cpp.

{
       CnsIObserServ oObserv;
       oObserv.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 972 of file Tests.cpp.

{
       CProfile oProfile(qaWebBrowser);
       oProfile.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 948 of file Tests.cpp.

{
       CNsIRequest oNsIRequest(qaWebBrowser,/*qaBaseWindow,qaWebNav,*/ qaBrowserImpl);
       oNsIRequest.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 966 of file Tests.cpp.

{
       CSelection oSelection(qaWebBrowser);
       oSelection.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 978 of file Tests.cpp.

{
       CNsIHistory oHistory(qaWebNav);
       oHistory.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 1021 of file Tests.cpp.

{
       CNsIWebBrowFind oWebBrowFind(qaWebBrowser, qaBrowserImpl);
       oWebBrowFind.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 1009 of file Tests.cpp.

{
       CNsIWebBrowser oWebBrowser(qaWebBrowser, qaBrowserImpl);
       oWebBrowser.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 984 of file Tests.cpp.

{
       CNsIWebNav oWebNav(qaWebNav);
       oWebNav.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 1015 of file Tests.cpp.

{
       CnsiWebProg oWebProgress(qaWebBrowser, qaBrowserImpl);
       oWebProgress.OnStartTests(nCommandID);
}

Here is the call graph for this function:

Definition at line 1060 of file Tests.cpp.

{
       CNsIFile oFile ;
       oFile.OnStartTests(ID_INTERFACES_NSIFILE_RUNALLTESTS);

       CNsIHistory oHistory(qaWebNav);
       oHistory.OnStartTests(ID_INTERFACES_NSISHISTORY_RUNALLTESTS);


       // Can only be run manually
//     CNsIWebNav oWebNav(qaWebNav);
//     oWebNav.OnStartTests(ID_INTERFACES_NSIWEBNAV_RUNALLTESTS);


       CnsIObserServ oObserv;
       oObserv.OnStartTests(ID_INTERFACES_NSIOBSERVERSERVICE_RUNALLTESTS);


       CNsIDirectoryService oNsIDirectoryService;
       oNsIDirectoryService.StartTests(ID_INTERFACES_NSIDIRECTORYSERVICE_RUNALLTESTS);


       CDomWindow oDomWindow(qaWebBrowser) ;
       oDomWindow.OnStartTests(ID_INTERFACES_NSIDOMWINDOW_RUNALLTESTS);


       // Can only be run manually
       //CSelection oSelection(qaWebBrowser);
       //oSelection.OnStartTests(ID_INTERFACES_NSISELECTION_RUNALLTESTS);


       CProfile oProfile(qaWebBrowser);
       oProfile.OnStartTests(ID_INTERFACES_NSIPROFILE_RUNALLTESTS);


       // Can only be run manually
       //CNsIClipBoardCmd  oClipCmd(qaWebBrowser);
       //oClipCmd.OnStartTests(nCommandID);


       CNsIRequest oNsIRequest(qaWebBrowser,/*qaBaseWindow,qaWebNav,*/ qaBrowserImpl);
       oNsIRequest.OnStartTests(ID_INTERFACES_NSIREQUEST_RUNALLTESTS);


       CNsIWebBrowser oWebBrowser(qaWebBrowser, qaBrowserImpl);
       oWebBrowser.OnStartTests(ID_INTERFACES_NSIWEBBROWSER_RUNALLTESTS);


       CnsiWebProg oWebProgress(qaWebBrowser, qaBrowserImpl);
       oWebProgress.OnStartTests(ID_INTERFACES_NSIWEBPROGRESS_RUNALLTESTS);


       CNsIWebBrowFind oWebBrowFind(qaWebBrowser, qaBrowserImpl);
       oWebBrowFind.OnStartTests(ID_INTERFACES_NSIWEBBROWSERFIND_RUNALLTESTS);


       CnsIEditSession oEditSession(qaWebBrowser);
       oEditSession.OnStartTests(ID_INTERFACES_NSIEDITINGSESSION_RUNALLTESTS);


       CnsICommandMgr oCommandMgr(qaWebBrowser);
       oCommandMgr.OnStartTests(ID_INTERFACES_NSICOMMANDMANAGER_RUNALLTESTS);


       CnsICmdParams oCmdParams(qaWebBrowser);
       oCmdParams.OnStartTests(ID_INTERFACES_NSICOMMANDPARAMS_RUNALLTESTS);

       CnsIChannelTests oChannelTests(qaWebBrowser, qaBrowserImpl);
       oChannelTests.OnStartTests(ID_INTERFACES_NSICHANNEL_RUNALLTESTS);

       CnsIHttpChannelTests oHttpChannelTests(qaWebBrowser, qaBrowserImpl);
       oHttpChannelTests.OnStartTests(ID_INTERFACES_NSIHTTPCHANNEL_RUNALLTESTS);
}

Here is the call graph for this function:

afx_msg void CTests::OnPasteTest ( ) [protected]
afx_msg void CTests::OnSelectAllTest ( ) [protected]
afx_msg void CTests::OnSelectNoneTest ( ) [protected]

Definition at line 510 of file Tests.cpp.

{
   // addSHistoryListener test

       nsWeakPtr weakling(
        do_GetWeakReference(NS_STATIC_CAST(nsISHistoryListener*, qaBrowserImpl)));

       rv = qaWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsISHistoryListener));
       RvTestResult(rv, "AddWebBrowserListener(). Add History Lstnr test", 2);
}

Here is the call graph for this function:

Definition at line 488 of file Tests.cpp.

{
    nsWeakPtr weakling(
        do_GetWeakReference(NS_STATIC_CAST(nsITooltipListener*, qaBrowserImpl)));
 
       rv = qaWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsITooltipListener));
       RvTestResult(rv, "AddWebBrowserListener(). Add Tooltip Listener test", 2);
}

Here is the call graph for this function:

Definition at line 571 of file Tests.cpp.

{
       nsCOMPtr<nsIURILoader> myLoader(do_GetService(NS_URI_LOADER_CONTRACTID,&rv));
       RvTestResult(rv, "nsIURILoader() object test", 1);

       if (!myLoader) {
              QAOutput("Didn't get urILoader object. test failed", 2);
              return;
       }

       if (myDialog.DoModal() == IDOK)
       {
              nsCAutoString theStr;

              theStr = myDialog.m_urlfield;
              rv = NS_NewURI(getter_AddRefs(theURI), theStr);
              RvTestResult(rv, "For OpenURI(): NS_NewURI() test", 1);
              FormatAndPrintOutput("theStr = ", theStr, 1);
              GetTheURI(theURI, 1);
              rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, nsnull);
              RvTestResult(rv, "For OpenURI(): NS_NewChannel() test", 1);
       }
       else {
              QAOutput("Didn't get a url. test failed", 2);
              return;
       }

       rv = myLoader->OpenURI(theChannel, PR_TRUE, qaBrowserImpl);
       RvTestResult(rv, "nsIUriLoader->OpenURI() test", 2);
}

Here is the call graph for this function:

Definition at line 547 of file Tests.cpp.

{
       nsCOMPtr<nsIURILoader> myLoader(do_GetService(NS_URI_LOADER_CONTRACTID,&rv));
       RvTestResult(rv, "nsIURILoader() object test", 1);

       if (!myLoader) {
              QAOutput("Didn't get urILoader object. test failed", 2);
              return;
       }

       nsCOMPtr<nsIURIContentListener> cntListener(NS_STATIC_CAST(nsIURIContentListener*, qaBrowserImpl));

       if (!cntListener) {
              QAOutput("Didn't get urIContentListener object. test failed", 2);
              return;
       }
       else {
              rv = myLoader->RegisterContentListener(cntListener);
              RvTestResult(rv, "nsIUriLoader->RegisterContentListener() test", 2);
       }
}

Here is the call graph for this function:

Definition at line 536 of file Tests.cpp.

{
    nsWeakPtr weakling(
        do_GetWeakReference(NS_STATIC_CAST(nsIURIContentListener*, qaBrowserImpl)));

    rv = qaWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsIURIContentListener));
       RvTestResult(rv, "AddWebBrowserListener(). add nsIURIContentListener test", 2);
}

Here is the call graph for this function:

Definition at line 499 of file Tests.cpp.

{
    nsWeakPtr weakling(
        do_GetWeakReference(NS_STATIC_CAST(nsIWebProgressListener*, qaBrowserImpl)));
 
       rv = qaWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsIWebProgressListener));
       RvTestResult(rv, "AddWebBrowserListener(). Add Web Prog Lstnr test", 2);
}

Here is the call graph for this function:

void CTests::OnTestsChangeUrl ( ) [protected]

Definition at line 348 of file Tests.cpp.

{
       if (!qaWebNav)
       {
              QAOutput("Web navigation object not found. Change URL test not performed.", 2);
              return;
       }

       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);
       }
       else
              QAOutput("Change URL test not executed.", 1);
}

Here is the call graph for this function:

Definition at line 433 of file Tests.cpp.

{
       //nsresult rv;

       PRBool exists;
    nsCOMPtr<nsILocalFile> theTestFile(do_GetService(NS_LOCAL_FILE_CONTRACTID));

    if (!theTestFile)
       {
              QAOutput("File object doesn't exist. No File tests performed.", 2);
              return;
       }


       QAOutput("Start Create File test.", 2);

       rv = theTestFile->InitWithNativePath(NS_LITERAL_CSTRING("c:\\temp\\theFile.txt"));
       rv = theTestFile->Exists(&exists);
       QAOutput("File (theFile.txt) doesn't exist. We'll create it.\r\n", 1);

       rv = theTestFile->Create(nsIFile::NORMAL_FILE_TYPE, 0777);
       RvTestResult(rv, "File Create() test", 2);
}

Here is the call graph for this function:

Definition at line 459 of file Tests.cpp.

{
    CProfilesDlg    myDialog;
    nsresult        rv;

       if (myDialog.DoModal() == IDOK)
    {
              nsCOMPtr<nsIProfile> theProfServ(do_GetService(NS_PROFILE_CONTRACTID,&rv));
              if (NS_FAILED(rv))
              {
                 QAOutput("Didn't get profile service. No profile tests performed.", 2);
                 return;
              }

          QAOutput("Start Profile switch test.", 2);

          QAOutput("Retrieved profile service.", 2);

       rv = theProfServ->SetCurrentProfile(myDialog.m_SelectedProfile.get());
          RvTestResult(rv, "SetCurrentProfile() (profile switching) test", 2);

          QAOutput("End Profile switch test.", 2);
    }
       else
          QAOutput("Profile switch test not executed.", 2);
}

Here is the call graph for this function:

Definition at line 373 of file Tests.cpp.

{
       // create instance of myHistory object. Call's XPCOM
       // service manager to pass the contract ID.

       PRBool theRetVal = PR_FALSE;

       nsCOMPtr<nsIGlobalHistory> myHistory(do_GetService(NS_GLOBALHISTORY_CONTRACTID));

       if (!myHistory)
       {
              QAOutput("Couldn't find history object. No GH tests performed.", 2);
              return;
       }

       if (myDialog.DoModal() == IDOK)
       {
              QAOutput("Begin IsVisited() and AddPage() tests.", 2);
              FormatAndPrintOutput("The history url = ", myDialog.m_urlfield, 1);

              // see if url is already in the GH file (pre-AddPage() test)
              rv = myHistory->IsVisited(myDialog.m_urlfield, &theRetVal);
           RvTestResult(rv, "rv IsVisited() test", 1);
              FormatAndPrintOutput("The IsVisited() boolean return value = ", theRetVal, 1);

              if (theRetVal)
                     QAOutput("URL has been visited. Won't execute AddPage().", 2);
              else
              {
                     QAOutput("URL hasn't been visited. Will execute AddPage().", 2);

                     // adds a url to the global history file
                     rv = myHistory->AddPage(myDialog.m_urlfield);

                     // prints addPage() results to output file
                     if (NS_FAILED(rv))
                     {
                            QAOutput("Invalid results for AddPage(). Url not added. Test failed.", 1);
                            return;
                     }
                     else
                            QAOutput("Valid results for AddPage(). Url added. Test passed.", 1);

                     // checks if url was visited (post-AddPage() test)
                     myHistory->IsVisited(myDialog.m_urlfield, &theRetVal);

                     if (theRetVal)
                            QAOutput("URL is visited; post-AddPage() test. IsVisited() test passed.", 1);
                     else
                            QAOutput("URL isn't visited; post-AddPage() test. IsVisited() test failed.", 1);
              }
              QAOutput("End IsVisited() and AddPage() tests.", 2);
       }
       else
              QAOutput("IsVisited() and AddPage() tests not executed.", 1);
}

Here is the call graph for this function:

Definition at line 636 of file Tests.cpp.

{
       nsCOMPtr<nsIIOService> ioService(do_GetIOService(&rv));
       if (!ioService) {
              QAOutput("We didn't get the IOService object.", 2);
              return;
       }

       if (myDialog.DoModal() == IDOK)
       {
              nsCAutoString theStr, retURI;

              theStr = myDialog.m_urlfield;

              rv = ioService->NewURI(theStr, nsnull, nsnull, getter_AddRefs(theURI));
              RvTestResult(rv, "ioService->NewURI() test", 2);

              if (!theURI)
                     QAOutput("We didn't get the nsIURI object for IOService test.", 2);
              else {
                     retURI = GetTheURI(theURI, 1);
                     FormatAndPrintOutput("The ioService->NewURI() output uri = ", retURI, 2);
              }
       }
}

Here is the call graph for this function:

Definition at line 604 of file Tests.cpp.

{
       nsCOMPtr<nsIChannel> theChannel;
       nsCOMPtr<nsILoadGroup> theLoadGroup(do_CreateInstance(NS_LOADGROUP_CONTRACTID));

       if (myDialog.DoModal() == IDOK)
       {
              nsCAutoString theStr;

              theStr = myDialog.m_urlfield;

              rv = NS_NewURI(getter_AddRefs(theURI), theStr);
              RvTestResult(rv, "NS_NewURI() test", 2);
              rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, nsnull);
              RvTestResult(rv, "NS_NewChannel() test", 2);

              if (!theChannel)
              {
                 QAOutput("We didn't get the Channel for AsyncOpen(). Test failed.", 1);
                 return;
              }

              QAOutput("AynchOpen() test:", 2);

              // this calls nsIStreamListener::OnDataAvailable()
              CnsIChannelTests  *channelTests = new CnsIChannelTests(qaWebBrowser, qaBrowserImpl);
              channelTests->AsyncOpenTest(theChannel, 2);;
       }
}

Here is the call graph for this function:

Definition at line 664 of file Tests.cpp.

{
       nsCOMPtr<nsIIOService> ioService(do_GetIOService(&rv));

       if (!ioService) {
              QAOutput("We didn't get the IOService object.", 2);
              return;
       }

       if (myDialog.DoModal() == IDOK)
       {
              nsCAutoString theStr, retStr;
              nsCOMPtr<nsIURI> theOriginalURI;
              nsIURI *theReturnURI = nsnull;
              nsIChannel *theReturnChannel = nsnull;
              const char *theProtocol;

              nsCOMPtr<nsIProtocolHandler> protocolHandler;

              theStr = myDialog.m_urlfield;
              theProtocol = myDialog.m_protocolvalue;
              FormatAndPrintOutput("The protocol scheme = ", theProtocol, 1);
              rv = ioService->GetProtocolHandler(theProtocol, getter_AddRefs(protocolHandler));
              RvTestResult(rv, "ioService->GetProtocolHandler() test", 2);
              rv = qaWebNav->GetCurrentURI(getter_AddRefs(theOriginalURI));
              if (!protocolHandler) {
                     QAOutput("We didn't get the protocolHandler object.", 2);
                     return;
              }
              rv = protocolHandler->NewURI(theStr, nsnull, theOriginalURI, &theReturnURI);
              if (!theOriginalURI)
                     QAOutput("We didn't get the original nsIURI object.", 2);
              else if (!theReturnURI)
                     QAOutput("We didn't get the output nsIURI object.", 2);

              RvTestResult(rv, "protocolHandler->NewURI() test", 2);

           retStr = GetTheURI(theReturnURI, 1);

          // simple string compare to see if input & output URLs match
           if (strcmp(myDialog.m_urlfield, retStr.get()) == 0)
                 QAOutput("The in/out URIs MATCH.", 1);
           else
                 QAOutput("The in/out URIs don't MATCH.", 1);

              // other protocol handler tests:

              // GetScheme() test
              nsCAutoString theScheme;
              rv = protocolHandler->GetScheme(theScheme);
              RvTestResult(rv, "protocolHandler->GetScheme() test", 1);
              FormatAndPrintOutput("GetScheme() = ", theScheme, 1);

              // GetDefaultPort() test
              PRInt32 theDefaultPort;
              rv = protocolHandler->GetDefaultPort(&theDefaultPort);
              RvTestResult(rv, "protocolHandler->GetDefaultPort() test", 1);
              FormatAndPrintOutput("GetDefaultPort() = ", theDefaultPort, 1);

              // GetProtocolFlags() test
              PRUint32 theProtocolFlags;
              rv = protocolHandler->GetProtocolFlags(&theProtocolFlags);
              RvTestResult(rv, "protocolHandler->GetDefaultPort() test", 1);
              FormatAndPrintOutput("GetProtocolFlags() = ", theProtocolFlags, 1);

              // NewChannel() test
              rv = protocolHandler->NewChannel(theReturnURI, &theReturnChannel);
              RvTestResult(rv, "protocolHandler->NewChannel() test", 1);
              if (!theReturnChannel)
                     QAOutput("We didn't get the returned nsIChannel object.", 1);


              // AllowPort() test
              PRBool retPort;
              rv = protocolHandler->AllowPort(theDefaultPort, "http", &retPort);
              RvTestResult(rv, "protocolHandler->AllowPort() test", 1);
              FormatAndPrintOutput("AllowPort() boolean = ", retPort, 1);

              
       }
}

Here is the call graph for this function:

Definition at line 523 of file Tests.cpp.

{
  // RemoveSHistoryListener test

       nsWeakPtr weakling(
        do_GetWeakReference(NS_STATIC_CAST(nsISHistoryListener*, qaBrowserImpl)));

       rv = qaWebBrowser->RemoveWebBrowserListener(weakling, NS_GET_IID(nsISHistoryListener));
       RvTestResult(rv, "RemoveWebBrowserListener(). Remove History Lstnr test", 2);
}

Here is the call graph for this function:

Definition at line 838 of file Tests.cpp.

{
       CStdioFile myFile; 
    CFileException e; 
    CString strFileName = "c:\\temp\\TestOutput.txt"; 
       myFile.Open( strFileName, CStdioFile::modeCreate | CStdioFile::modeWrite
                        | CStdioFile::modeNoTruncate, &e );       
       myFile.Close();

       nsCOMPtr<nsILocalFile> theOriginalFile(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));

       rv = theOriginalFile->InitWithNativePath(NS_LITERAL_CSTRING("c:\\temp\\TestOutput.txt"));
    nsCOMPtr<nsIFile> theTestFile = do_QueryInterface(theOriginalFile);
       rv = theTestFile->Remove(PR_FALSE);
}

Here is the call graph for this function:

Definition at line 798 of file Tests.cpp.

{

       nsCOMPtr<nsIGlobalHistory> myGHistory(do_GetService(NS_GLOBALHISTORY_CONTRACTID));
       if (!myGHistory)
       {
              QAOutput("Could not get the global history object.", 2);
              return;
       }

       nsCOMPtr<nsIBrowserHistory> myHistory = do_QueryInterface(myGHistory, &rv);
       if(NS_FAILED(rv)) {
              QAOutput("Could not get the history object.", 2);
              return;
       }

       QAOutput("Begin removal of all pages from the GH file.", 2);

       rv = myHistory->RemoveAllPages();
       RvTestResult(rv, "removeAllPages().", 2);

       QAOutput("End removal of all pages from the GH file.", 2);
}

Here is the call graph for this function:

Definition at line 750 of file Tests.cpp.

{
       PRBool theRetVal = PR_FALSE;
       nsCOMPtr<nsIGlobalHistory> myGHistory(do_GetService(NS_GLOBALHISTORY_CONTRACTID));

       if (!myGHistory)
       {
              QAOutput("Could not get the global history object.", 2);
              return;
       }

       nsCOMPtr<nsIBrowserHistory> myHistory = do_QueryInterface(myGHistory, &rv);
       if(NS_FAILED(rv)) {
              QAOutput("Could not get the history object.", 2);
              return;
       }

       if (myDialog.DoModal() == IDOK)
       {
              QAOutput("Begin URL removal from the GH file.", 2);

              myGHistory->IsVisited(myDialog.m_urlfield, &theRetVal);
              if (theRetVal)
              {
                     nsCOMPtr<nsIIOService> ios = do_GetIOService();
                     if (ios)
                     {
                            nsCOMPtr<nsIURI> uri;
                            ios->NewURI(nsDependentCString(myDialog.m_urlfield), nsnull, nsnull,
                                                 getter_AddRefs(uri));
                            if (uri)
                            {
                                   rv = myHistory->RemovePage(uri);
                                   RvTestResult(rv, "RemovePage() test (url removal from GH file)", 2);
                            }
                     }
              }
              else
              {
                     QAOutput("The URL wasn't in the GH file.\r\n", 1);
              }
              QAOutput("End URL removal from the GH file.", 2);
       }
       else
              QAOutput("URL removal from the GH file not executed.", 2);
}

Here is the call graph for this function:

Definition at line 856 of file Tests.cpp.

{      
       // place your test code here
}

Definition at line 863 of file Tests.cpp.

{
       // place your test code here
}

Definition at line 822 of file Tests.cpp.

{
       char theURI[1024];

       CStdioFile myFile; 
    CFileException e; 
    CString strFileName = "c:\\temp\\TestOutput.txt"; 
       myFile.Open( strFileName, CStdioFile::modeCreate | CStdioFile::modeWrite
                        | CStdioFile::modeNoTruncate, &e );               
       myFile.Close();

       strcpy(theURI, "file://C|/temp/TestOutput.txt");
       rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theURI).get(),
               nsIWebNavigation::LOAD_FLAGS_NONE, nsnull,nsnull, nsnull);
}
afx_msg void CTests::OnUpdateCopy ( CCmdUI *  pCmdUI) [protected]
afx_msg void CTests::OnUpdateCut ( CCmdUI *  pCmdUI) [protected]
afx_msg void CTests::OnUpdateNavBack ( CCmdUI *  pCmdUI) [protected]
afx_msg void CTests::OnUpdateNavForward ( CCmdUI *  pCmdUI) [protected]
afx_msg void CTests::OnUpdateNavStop ( CCmdUI *  pCmdUI) [protected]
afx_msg void CTests::OnUpdatePaste ( CCmdUI *  pCmdUI) [protected]

Definition at line 896 of file Tests.cpp.

{
       nsCOMPtr<nsIURILoader> myLoader(do_GetService(NS_URI_LOADER_CONTRACTID,&rv));
       nsCAutoString theStr;

       QAOutput("Verification for bug 169617!", 2);

       theStr = "file://C|/Program Files";
       rv = NS_NewURI(getter_AddRefs(theURI), theStr);
       RvTestResult(rv, "NS_NewURI() test for file url", 1);

       GetTheURI(theURI, 1);

       rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, nsnull);
       RvTestResult(rv, "NS_NewChannel() test for file url", 1);

       rv = myLoader->OpenURI(theChannel, PR_TRUE, qaBrowserImpl);
       RvTestResult(rv, "nsIUriLoader->OpenURI() test for file url", 2);

}

Here is the call graph for this function:

Definition at line 917 of file Tests.cpp.

{
       nsCOMPtr<nsIURILoader> myLoader(do_GetService(NS_URI_LOADER_CONTRACTID,&rv));
       nsCAutoString theStr;

       QAOutput("Verification for bug 170274!", 2);

       theStr = "data:text/plain;charset=iso-8859-7,%be%fg%be";
       rv = NS_NewURI(getter_AddRefs(theURI), theStr);
       RvTestResult(rv, "NS_NewURI() test for data url", 1);

       GetTheURI(theURI, 1);

       rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, nsnull);
       RvTestResult(rv, "NS_NewChannel() test for data url", 1);

       rv = myLoader->OpenURI(theChannel, PR_TRUE, qaBrowserImpl);
       RvTestResult(rv, "nsIUriLoader->OpenURI() test for data url", 2);
}

Here is the call graph for this function:

Definition at line 872 of file Tests.cpp.

{
       nsCOMPtr<nsIHelperAppLauncherDialog>
                     myHALD(do_CreateInstance(NS_IHELPERAPPLAUNCHERDLG_CONTRACTID));
       if (!myHALD)
              QAOutput("Object not created. It should be. It's a component!", 2);
       else
              QAOutput("Object is created. It's a component!", 2);
}

Here is the call graph for this function:

Definition at line 882 of file Tests.cpp.

{
    nsWeakPtr weakling(
        do_GetWeakReference(NS_STATIC_CAST(nsITooltipListener*, qaBrowserImpl)));

    rv = qaWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsITooltipListener));
       RvTestResult(rv, "AddWebBrowserListener(). Add Tool Tip Lstnr test", 2);

/*     nsCOMPtr<nsITooltipTextProvider> oTooltipTextProvider = do_GetService(NS_TOOLTIPTEXTPROVIDER_CONTRACTID) ;
       if (!oTooltipTextProvider)
              AfxMEssageBox("Asdfadf");
*/
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 94 of file Tests.h.

Definition at line 79 of file Tests.h.

Definition at line 97 of file Tests.h.

Definition at line 76 of file Tests.h.

Definition at line 78 of file Tests.h.

Definition at line 75 of file Tests.h.

Definition at line 77 of file Tests.h.

Definition at line 96 of file Tests.h.

Definition at line 95 of file Tests.h.


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