Back to index

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

#include <nsirequest.h>

Collaboration diagram for CNsIRequest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CNsIRequest (nsIWebBrowser *mWebBrowser, CBrowserImpl *mpBrowserImpl)
virtual ~CNsIRequest ()
void OnInterfacesNsirequest ()
void OnStartTests (UINT nMenuID)
void RunAllTests (int)
void RunIndividualTests (UINT nMenuID, int)
nsIChannelGetTheChannel (int, nsILoadGroup *)

Static Public Member Functions

static void IsPendingReqTest (nsIRequest *)
static void GetStatusReqTest (nsIRequest *)
static void SuspendReqTest (nsIRequest *)
static void ResumeReqTest (nsIRequest *)
static void CancelReqTest (nsIRequest *)
static void SetLoadGroupTest (nsIRequest *, nsILoadGroup *)
static void GetLoadGroupTest (nsIRequest *)

Public Attributes

nsCOMPtr< nsIWebBrowserqaWebBrowser
CBrowserImplqaBrowserImpl

Detailed Description

Definition at line 49 of file nsirequest.h.


Constructor & Destructor Documentation

CNsIRequest::CNsIRequest ( nsIWebBrowser mWebBrowser,
CBrowserImpl mpBrowserImpl 
)

Definition at line 60 of file nsirequest.cpp.

{
       qaWebBrowser = mWebBrowser ;
       qaBrowserImpl = mpBrowserImpl ;
}

Definition at line 67 of file nsirequest.cpp.

{
}

Member Function Documentation

void CNsIRequest::CancelReqTest ( nsIRequest request) [static]

Definition at line 317 of file nsirequest.cpp.

{
       nsresult      rv;
       nsresult      status = NS_BINDING_ABORTED;

       rv = request->Cancel(status);
    RvTestResult(rv, "nsIRequest::Cancel() rv test", 1);
    RvTestResultDlg(rv, "nsIRequest::Cancel() test");
    RvTestResult(status, "nsIRequest::Cancel() status test", 1);
    RvTestResultDlg(status, "nsIRequest::Cancel() status test");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 340 of file nsirequest.cpp.

{
       nsCOMPtr<nsILoadGroup> theLoadGroup;
       nsresult      rv;
       nsCOMPtr<nsISimpleEnumerator> theSimpEnum;

       rv = request->GetLoadGroup(getter_AddRefs(theLoadGroup));
    RvTestResult(rv, "nsIRequest::GetLoadGroup() rv test", 1);
    RvTestResultDlg(rv, "nsIRequest::GetLoadGroup() rv test");

       rv = theLoadGroup->GetRequests(getter_AddRefs(theSimpEnum));
    RvTestResult(rv, "nsIRequest:: LoadGroups' GetRequests() rv test", 1);
    RvTestResultDlg(rv, "nsIRequest:: LoadGroups' GetRequests() rv test");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 287 of file nsirequest.cpp.

{
       nsresult      theStatusError;
       nsresult rv;

       rv = request->GetStatus(&theStatusError);
    RvTestResult(rv, "nsIRequest::GetStatus() test", 1);
       RvTestResultDlg(rv, "nsIRequest::GetStatus() test");
    RvTestResult(theStatusError, "the returned status error test", 1);
    RvTestResultDlg(theStatusError, "the returned status error test");
} 

Here is the call graph for this function:

Here is the caller graph for this function:

nsIChannel * CNsIRequest::GetTheChannel ( int  i,
nsILoadGroup theLoadGroup 
)

Definition at line 217 of file nsirequest.cpp.

{
       nsCAutoString theSpec, retURI;
       nsCOMPtr<nsIURI> theURI;
       nsCOMPtr<nsIChannel> theChannel;

       theSpec = ReqTable[i].theUrl;
       FormatAndPrintOutput("the input uri = ", theSpec, 1);

       rv = NS_NewURI(getter_AddRefs(theURI), theSpec);

       if (!theURI)
       {
          QAOutput("We didn't get the URI. Test failed.", 1);
          return nsnull;
       }
       else {
          retURI = GetTheURI(theURI, 1);
          // simple string compare to see if input & output URLs match
          if (strcmp(ReqTable[i].theUrl, retURI.get()) == 0)
                QAOutput("The in/out URIs MATCH.", 1);
          else
                QAOutput("The in/out URIs don't MATCH.", 1);
          RvTestResult(rv, "NS_NewURI", 1);
          RvTestResultDlg(rv, "NS_NewURI", true);
       }

       rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, theLoadGroup);
       if (!theChannel)
       {
          QAOutput("We didn't get the Channel. Test failed.", 1);
          return nsnull;
       }
       else {
          RvTestResult(rv, "NS_NewChannel", 1);
          RvTestResultDlg(rv, "NS_NewChannel");
       }

       nsCOMPtr<nsIStreamListener> listener(NS_STATIC_CAST(nsIStreamListener*, qaBrowserImpl));
       nsCOMPtr<nsIWeakReference> thisListener(do_GetWeakReference(listener));
       qaWebBrowser->AddWebBrowserListener(thisListener, NS_GET_IID(nsIStreamListener));

       if (!listener) {
          QAOutput("We didn't get the listener for AsyncOpen(). Test failed.", 1);
          return nsnull;
       }
       // this calls nsIStreamListener::OnDataAvailable()
       rv = theChannel->AsyncOpen(listener, nsnull);
       RvTestResult(rv, "AsyncOpen()", 1);
       RvTestResultDlg(rv, "AsyncOpen()");

       return theChannel;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 272 of file nsirequest.cpp.

{
       PRBool   reqPending;
       nsresult rv;  

       rv = request->IsPending(&reqPending);
    RvTestResult(rv, "nsIRequest::IsPending() rv test", 1);
       RvTestResultDlg(rv, "nsIRequest::IsPending() rv test()");

       if (!reqPending)
              QAOutput("Pending request = false.", 1);
       else
              QAOutput("Pending request = true.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 96 of file nsirequest.cpp.

{
       if (nMenuID == ID_INTERFACES_NSIREQUEST_RUNALLTESTS)
              RunAllTests(9);
       else
              RunIndividualTests(nMenuID, 9);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CNsIRequest::ResumeReqTest ( nsIRequest request) [static]

Definition at line 308 of file nsirequest.cpp.

{
       nsresult      rv;

       rv = request->Resume();
    RvTestResult(rv, "nsIRequest::Resume() test", 1);
    RvTestResultDlg(rv, "nsIRequest::Resume() test");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 163 of file nsirequest.cpp.

{
       // note: nsIRequest tests are called:
       // 1) in BrowserImpl.cpp, nsIStreamListener::OnDataAvailable()
       // 2) as individual tests below

       nsCOMPtr<nsIChannel> theChannel;
       nsCOMPtr<nsILoadGroup> theLoadGroup(do_CreateInstance(NS_LOADGROUP_CONTRACTID));
       if (!theLoadGroup)
       {
              QAOutput("We didn't get the Load Group. Test failed.", 2);
              return;
       }

       int i=0;

    QAOutput("Start nsIRequest tests.", 1);      

       for (i=0; i<reqTotal; i++)
       {
              // nsIRequest individual tests

              QAOutput("********** Individual nsIRequest test begins. **********");

              theChannel = GetTheChannel(i, theLoadGroup);
              nsCOMPtr<nsIRequest> theRequest = do_QueryInterface(theChannel);

              if (ReqTable[i].reqPend == TRUE)
                     IsPendingReqTest(theRequest);

              if (ReqTable[i].reqStatus == TRUE)
                     GetStatusReqTest(theRequest);

              if (ReqTable[i].reqSuspend == TRUE)
                     SuspendReqTest(theRequest); 

              if (ReqTable[i].reqResume == TRUE)
                     ResumeReqTest(theRequest);  

              if (ReqTable[i].reqCancel == TRUE)
                     CancelReqTest(theRequest);  

              if (ReqTable[i].reqSetLoadGroup == TRUE)
                     SetLoadGroupTest(theRequest, theLoadGroup);      

              if (ReqTable[i].reqGetLoadGroup == TRUE)
                     GetLoadGroupTest(theRequest);

              QAOutput("- - - - - - - - - - - - - - - - - - - - -", 1);
       } // end for loop
    QAOutput("End nsIRequest tests.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CNsIRequest::RunIndividualTests ( UINT  nMenuID,
int  reqTotal 
)

Definition at line 104 of file nsirequest.cpp.

{
       nsCOMPtr<nsIChannel> theChannel;
       nsCOMPtr<nsILoadGroup> theLoadGroup(do_CreateInstance(NS_LOADGROUP_CONTRACTID));
       nsCOMPtr<nsIURI> theURI;
       if (!theLoadGroup)
       {
              QAOutput("We didn't get the Load Group. Test failed.", 2);
              return;
       }
       int i=0;

    QAOutput("Start selected nsIRequest test.", 2);     

       for (i=0; i<reqTotal; i++)
       {
              // nsIRequest individual tests

              QAOutput("********** Individual nsIRequest test begins. **********");

              theChannel = GetTheChannel(i, theLoadGroup);
              nsCOMPtr<nsIRequest> theRequest = do_QueryInterface(theChannel);

              switch(nMenuID)
              {
                     
              case ID_INTERFACES_NSIREQUEST_GETNAME :
                     break;
              case ID_INTERFACES_NSIREQUEST_ISPENDING :
                     IsPendingReqTest(theRequest);
                     break;
              case ID_INTERFACES_NSIREQUEST_GETSTATUS :
                     GetStatusReqTest(theRequest);
                     break;
              case ID_INTERFACES_NSIREQUEST_CANCEL :
                     CancelReqTest(theRequest);  
                     break;
              case ID_INTERFACES_NSIREQUEST_SUSPEND :
                     SuspendReqTest(theRequest); 
                     break;
              case ID_INTERFACES_NSIREQUEST_RESUME :
                     ResumeReqTest(theRequest);  
                     break;
              case ID_INTERFACES_NSIREQUEST_GETLOADGROUP :
                     GetLoadGroupTest(theRequest);
                     break;
              case ID_INTERFACES_NSIREQUEST_SETLOADGROUP :
                     SetLoadGroupTest(theRequest, theLoadGroup);      
                     break;
              case ID_INTERFACES_NSIREQUEST_GETLOADFLAGS :
                     break;
              case ID_INTERFACES_NSIREQUEST_SETLOADFLAGS :
                     break;
              }

       } // end for loop
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CNsIRequest::SetLoadGroupTest ( nsIRequest request,
nsILoadGroup theLoadGroup 
) [static]

Definition at line 329 of file nsirequest.cpp.

{
       nsresult      rv;
       nsCOMPtr<nsISimpleEnumerator> theSimpEnum;

       rv = request->SetLoadGroup(theLoadGroup);
    RvTestResult(rv, "nsIRequest::SetLoadGroup() rv test", 1);
    RvTestResultDlg(rv, "nsIRequest::SetLoadGroup() rv test");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CNsIRequest::SuspendReqTest ( nsIRequest request) [static]

Definition at line 299 of file nsirequest.cpp.

{
       nsresult      rv;

       rv = request->Suspend();
    RvTestResult(rv, "nsIRequest::Suspend() test", 1);
    RvTestResultDlg(rv, "nsIRequest::Suspend() test");
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 61 of file nsirequest.h.

Definition at line 60 of file nsirequest.h.


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