Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
TestIOThreads.cpp File Reference
#include "TestCommon.h"
#include "nsIServiceManager.h"
#include "nsIEventTarget.h"
#include "nsCOMPtr.h"
#include "plevent.h"
#include "prlog.h"

Go to the source code of this file.


#define LOG(args)   PR_LOG(gTestLog, PR_LOG_DEBUG, args)


 PR_STATIC_CALLBACK (void *) HandleEvent(PLEvent *event)
 PR_STATIC_CALLBACK (void) DestroyEvent(PLEvent *event)
static nsresult RunTest ()
int main (int argc, char **argv)
 The Xalan testcases app.

Define Documentation

#define LOG (   args)    PR_LOG(gTestLog, PR_LOG_DEBUG, args)

Definition at line 50 of file TestIOThreads.cpp.

Function Documentation

int main ( int  argc,
char **  argv 

The Xalan testcases app.

Definition at line 81 of file TestIOThreads.cpp.

    if (test_common_init(&argc, &argv) != 0)
        return -1;

    nsresult rv;

#if defined(PR_LOGGING)
    gTestLog = PR_NewLogModule("Test");

    rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
    if (NS_FAILED(rv))
        return rv;

    rv = RunTest();
    if (NS_FAILED(rv))
        LOG(("RunTest failed [rv=%x]\n", rv));

    LOG(("sleeping main thread for 2 seconds...\n"));
    return 0;

Here is the call graph for this function:

Definition at line 52 of file TestIOThreads.cpp.

    LOG(("HandleEvent:%d\n", NS_PTR_TO_INT32(event->owner)));
    return nsnull;

Definition at line 58 of file TestIOThreads.cpp.

    delete event;
static nsresult RunTest ( ) [static]

Definition at line 63 of file TestIOThreads.cpp.

    nsresult rv;
    nsCOMPtr<nsIEventTarget> target = do_GetService(";1", &rv);
    if (NS_FAILED(rv))
        return rv;

    for (int i=0; i<10; ++i) {
        PLEvent *event = new PLEvent(); 
        PL_InitEvent(event, (void *) i, HandleEvent, DestroyEvent);
        LOG(("PostEvent:%d\n", i));
        if (NS_FAILED(target->PostEvent(event)))

    return rv;

Here is the call graph for this function:

Here is the caller graph for this function: