Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
QaUtils.cpp File Reference
#include "stdafx.h"
#include "TestEmbed.h"
#include "BrowserView.h"
#include "BrowserImpl.h"
#include "BrowserFrm.h"
#include "QAUtils.h"

Go to the source code of this file.

Functions

void RvTestResultDlg (nsresult rv, CString pLine, BOOL bClearList)
void RvTestResult (nsresult rv, const char *pLine, int displayMethod)
void WriteToOutputFile (const char *pLine)
void QAOutput (const char *pLine, int displayMethod)
void FormatAndPrintOutput (const char *theInput, const char *theVar, int outputMode)
void FormatAndPrintOutput (const char *theInput, nsCAutoString theVar, int outputMode)
void FormatAndPrintOutput (const char *theInput, int theVar, int outputMode)
void FormatAndPrintOutput (const char *theInput, double theVar, int outputMode)
void FormatAndPrintOutput (const char *theInput, PRUint32 theVar, int outputMode)
void RequestName (nsIRequest *request, nsCString &stringMsg, int displayMethod)
void WebProgDOMWindowTest (nsIWebProgress *progress, const char *inString, int displayMethod)
void WebProgIsDocLoadingTest (nsIWebProgress *progress, const char *inString, int displayMethod)
nsIDOMWindowGetTheDOMWindow (nsIWebBrowser *webBrowser)
nsCAutoString GetTheURI (nsIURI *theURI, int displayMethod)
void onStateChangeString (char *theStateType, char *theDocType, nsCString stringMsg, PRUint32 status, int displayMode)
void SaveObject (nsISupports *theSupports)

Variables

storage getSupportObj

Function Documentation

void FormatAndPrintOutput ( const char *  theInput,
const char *  theVar,
int  outputMode 
)

Definition at line 206 of file QaUtils.cpp.

{
       nsCString outStr;
       CString strMsg;

       outStr = theInput;
       outStr += theVar;

       strMsg = outStr.get();

       switch (outputMode)
       {
       case 0:
              AfxMessageBox(strMsg); 
              break;
       case 1:
              WriteToOutputFile(outStr.get());
              break;
       case 2:
              WriteToOutputFile(outStr.get());
              AfxMessageBox(strMsg); 
              break;
       }
}

Here is the call graph for this function:

void FormatAndPrintOutput ( const char *  theInput,
nsCAutoString  theVar,
int  outputMode 
)

Definition at line 231 of file QaUtils.cpp.

{
       nsCString outStr;
       CString strMsg;

       outStr = theInput;
       outStr += theVar;

       strMsg = outStr.get();

       switch (outputMode)
       {
       case 0:
              AfxMessageBox(strMsg); 
              break;
       case 1:
              WriteToOutputFile(outStr.get());
              break;
       case 2:
              WriteToOutputFile(outStr.get());
              AfxMessageBox(strMsg); 
              break;
       }
}

Here is the call graph for this function:

void FormatAndPrintOutput ( const char *  theInput,
int  theVar,
int  outputMode 
)

Definition at line 256 of file QaUtils.cpp.

{
       nsCString outStr;
       CString strMsg;

       outStr = theInput;
       outStr.AppendInt(theVar);

       strMsg = outStr.get();

       switch (outputMode)
       {
       case 0:
              AfxMessageBox(strMsg); 
              break;
       case 1:
              WriteToOutputFile(outStr.get());
              break;
       case 2:
              WriteToOutputFile(outStr.get());
              AfxMessageBox(strMsg); 
              break;
       }
}

Here is the call graph for this function:

void FormatAndPrintOutput ( const char *  theInput,
double  theVar,
int  outputMode 
)

Definition at line 281 of file QaUtils.cpp.

{
       nsCString outStr;
       CString strMsg;

       outStr = theInput;
       outStr.AppendFloat(theVar);

       strMsg = outStr.get();

       switch (outputMode)
       {
       case 0:
              AfxMessageBox(strMsg); 
              break;
       case 1:
              WriteToOutputFile(outStr.get());
              break;
       case 2:
              WriteToOutputFile(outStr.get());
              AfxMessageBox(strMsg); 
              break;
       }
}

Here is the call graph for this function:

void FormatAndPrintOutput ( const char *  theInput,
PRUint32  theVar,
int  outputMode 
)

Definition at line 306 of file QaUtils.cpp.

{
       nsCString outStr;
       CString strMsg;

       outStr = theInput;
       outStr.AppendFloat(theVar);

       strMsg = outStr.get();

       switch (outputMode)
       {
       case 0:
              AfxMessageBox(strMsg); 
              break;
       case 1:
              WriteToOutputFile(outStr.get());
              break;
       case 2:
              WriteToOutputFile(outStr.get());
              AfxMessageBox(strMsg); 
              break;
       }
}

Here is the call graph for this function:

Definition at line 394 of file QaUtils.cpp.

{
       nsCOMPtr<nsIDOMWindow> theDOMWindow;

    webBrowser->GetContentDOMWindow(getter_AddRefs(theDOMWindow));
    if (!theDOMWindow) {
        QAOutput("Didn't get a DOM Window.");
              return nsnull;
       }
       return (theDOMWindow);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsCAutoString GetTheURI ( nsIURI theURI,
int  displayMethod 
)

Definition at line 406 of file QaUtils.cpp.

{
       nsresult rv;
       nsCAutoString uriString;

       if (!theURI) {
        QAOutput("nsIURI object is null. return failure.");
              return uriString;  //dep 3/30
       }
       rv = theURI->GetSpec(uriString);
    RvTestResult(rv, "nsIURI::GetSpec() test", displayMethod);
    FormatAndPrintOutput("the uri = ", uriString, displayMethod);

       return uriString;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void onStateChangeString ( char *  theStateType,
char *  theDocType,
nsCString  stringMsg,
PRUint32  status,
int  displayMode 
)

Definition at line 423 of file QaUtils.cpp.

{
       nsCString totalMsg;

       totalMsg = "OnStateChange(): ";
       totalMsg += theStateType;
       totalMsg += ", ";
       totalMsg += theDocType;
       totalMsg += ", ";
       totalMsg += stringMsg;
       totalMsg += ", status (hex) = ";
       totalMsg.AppendInt(status, 16);
       QAOutput(totalMsg.get(), displayMode);
}

Here is the call graph for this function:

void QAOutput ( const char *  pLine,
int  displayMethod 
)

Definition at line 187 of file QaUtils.cpp.

{
       // note: default displayMethod = 1 in .h file
       // displayMethod 0 = mfc dialog; 1 = output log file; 2 = both
//#if 0
   CString strLine = pLine;

   if (displayMethod == 0)
          AfxMessageBox(strLine);
   else if (displayMethod == 1)
          WriteToOutputFile(pLine);
   else 
   {
       WriteToOutputFile(pLine);
          AfxMessageBox(strLine);
   }
//#endif
}

Here is the call graph for this function:

void RequestName ( nsIRequest request,
nsCString stringMsg,
int  displayMethod 
)

Definition at line 332 of file QaUtils.cpp.

{
       nsresult rv;

       if (!request) {
              QAOutput("ERROR. nsIRequest object is Null. RequestName test fails.", displayMethod);
              return;
       }
       else
              rv = request->GetName(stringMsg);

       if(NS_SUCCEEDED(rv))                                                                                                          
              FormatAndPrintOutput("nsIRequest: The request name = ", stringMsg.get(), displayMethod);
       else
              QAOutput("nsIRequest: We didn't get the request name.", displayMethod);
}

Here is the call graph for this function:

void RvTestResult ( nsresult  rv,
const char *  pLine,
int  displayMethod 
)

Definition at line 82 of file QaUtils.cpp.

{
       // note: default displayMethod = 1 in .h file

       CString strLine = pLine;
       char theOutputLine[200];

       if (NS_FAILED(rv))
          strLine += " failed.";
       else
          strLine += " passed.";

       strcpy(theOutputLine, strLine);
       QAOutput(theOutputLine, displayMethod);
}

Here is the call graph for this function:

void RvTestResultDlg ( nsresult  rv,
CString  pLine,
BOOL  bClearList 
)

Definition at line 62 of file QaUtils.cpp.

{
       static CShowTestResults dlgResult ;
       if (!dlgResult)
              dlgResult.Create(IDD_RUNTESTSDLG);

       
       if (bClearList)
       {
              dlgResult.m_ListResults.DeleteAllItems();
              dlgResult.ShowWindow(true);
       }

       if (NS_FAILED(rv))
          dlgResult.AddItemToList(pLine,false);
       else
          dlgResult.AddItemToList(pLine,true);

}

Here is the call graph for this function:

void SaveObject ( nsISupports *  theSupports)

Definition at line 439 of file QaUtils.cpp.

{
       getSupportObj.sup = theSupports;
}

Here is the caller graph for this function:

void WebProgDOMWindowTest ( nsIWebProgress progress,
const char *  inString,
int  displayMethod 
)

Definition at line 349 of file QaUtils.cpp.

{
       nsresult rv;
       nsCString totalStr1, totalStr2;
       nsCOMPtr<nsIDOMWindow> theDOMWindow;

       totalStr1 = inString;
       totalStr1 += ": Didn't get the DOMWindow. Test failed.";

       totalStr2 = inString;
       totalStr2 += ": nsIWebProgress:DOMWindow attribute test";

       if (!progress) {
              QAOutput("ERROR. nsIWebProgress object is Null. WebProgDOMWindowTest fails.", displayMethod);
              return;
       }
       else
              rv = progress->GetDOMWindow(getter_AddRefs(theDOMWindow));
       if (!theDOMWindow)
              QAOutput(totalStr1.get(), displayMethod);
       else
              RvTestResult(rv, totalStr2.get(), displayMethod);
}

Here is the call graph for this function:

void WebProgIsDocLoadingTest ( nsIWebProgress progress,
const char *  inString,
int  displayMethod 
)

Definition at line 374 of file QaUtils.cpp.

{
       nsresult rv;
       PRBool docLoading;
       nsCString totalStr;

       totalStr = inString;
       totalStr += ": nsIWebProgress:IsDocumentLoading attribute test";

       if (!progress) {
              QAOutput("ERROR. nsIWebProgress object is Null. WebProgIsDocLoadingTest fails.", displayMethod);
              return;
       }
       else
       rv = progress->GetIsLoadingDocument(&docLoading);
       RvTestResult(rv, totalStr.get(), displayMethod);
       FormatAndPrintOutput("nsIWebProgress: isDocumentLoading return value = ", docLoading, displayMethod);
}

Here is the call graph for this function:

void WriteToOutputFile ( const char *  pLine)

Definition at line 98 of file QaUtils.cpp.

{ 
    CStdioFile myFile; 
    CFileException e; 
    CString strFileName = "c:\\temp\\TestOutput.txt"; 

    if(! myFile.Open( strFileName, CStdioFile::modeCreate | CStdioFile::modeWrite
                                                        | CStdioFile::modeNoTruncate, &e ) ) 
    { 
        CString failCause = "Unable to open file. Reason : "; 
        switch (e.m_cause) {
        case CFileException::none:
            failCause += "No error occurred.";
            break;

        case CFileException::generic:
            failCause += "An unspecified error occurred.";
            break;

        case CFileException::fileNotFound:
            failCause += "The file could not be located.";
            break;

        case CFileException::badPath:
            failCause += "All or part of the path is invalid.";
            break;

        case CFileException::tooManyOpenFiles:
            failCause += "The permitted number of open files was exceeded.";
            break;

        case CFileException::accessDenied:
            failCause += "The file could not be accessed.";
            break;

        case CFileException::invalidFile:
            failCause += "There was an attempt to use an invalid file handle.";
            break;

        case CFileException::removeCurrentDir:
            failCause += "The current working directory cannot be removed.";
            break;

        case CFileException::directoryFull:
            failCause += "There are no more directory entries.";
            break;

        case CFileException::badSeek:
            failCause += "There was an error trying to set the file pointer.";
            break;

        case CFileException::hardIO:
            failCause += "There was a hardware error.";
            break;

        case CFileException::sharingViolation:
            failCause += "SHARE.EXE was not loaded, or a shared region was locked.";
            break;

        case CFileException::lockViolation:
            failCause += "There was an attempt to lock a region that was already locked.";
            break;

        case CFileException::diskFull:
            failCause += "The disk is full.";
            break;

        case CFileException::endOfFile:
            failCause += "The end of file was reached.";
            break;

        default:
            failCause += "Some reason not documented in <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cfileexception.3a3a.m_cause.asp>.";
            break;
        }
        AfxMessageBox(failCause);
    } 
    else 
    { 
              myFile.SeekToEnd();
        CString strLine = pLine; 
        strLine += "\r\n"; 

        myFile.WriteString(strLine); 

        myFile.Close(); 
    } 
} 

Here is the caller graph for this function:


Variable Documentation

Definition at line 60 of file QaUtils.cpp.