*not part of the buld*
blackConnect tests update git-svn-id: svn://10.0.0.236/trunk@99925 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -22,7 +22,9 @@
|
||||
*/
|
||||
|
||||
#include "plstr.h"
|
||||
#include "prmem.h"
|
||||
#include "stdio.h"
|
||||
#include "prthread.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "iMThreadContext.h"
|
||||
#include "iMThreadComponent.h"
|
||||
@@ -32,7 +34,10 @@
|
||||
#include <stdlib.h>
|
||||
#include "nsID.h"
|
||||
|
||||
iMThreadContext* context;
|
||||
iMThreadContext* context=NULL;
|
||||
void* eThread=NULL;
|
||||
FILE *file=NULL;
|
||||
|
||||
MTStartImpl::MTStartImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
@@ -42,25 +47,47 @@ MTStartImpl::MTStartImpl()
|
||||
NS_GET_IID(iMThreadContext),
|
||||
(void**)&context);
|
||||
if(NS_FAILED(rv)) {
|
||||
printf("Create instance of context failed!!!");
|
||||
fprintf(stderr, "Create instance of context failed!!!");
|
||||
return;
|
||||
}
|
||||
char* first;
|
||||
context->GetNext(&first);
|
||||
char* first=(char*)PR_Malloc(sizeof(char*));
|
||||
|
||||
|
||||
context->GetContractID(0,1,&first);
|
||||
nsCID firstCID;
|
||||
firstCID.Parse(first);
|
||||
printf("ClassID is %s\n", firstCID.ToString());
|
||||
iMThreadComponent* tComponent;
|
||||
iMThreadComponent* tComponent=NULL;
|
||||
rv = nsComponentManager::CreateInstance(firstCID,
|
||||
nsnull,
|
||||
NS_GET_IID(iMThreadComponent),
|
||||
(void**)&tComponent);
|
||||
if(NS_FAILED(rv)) {
|
||||
printf("Create instance failed from %s!!!",first);
|
||||
fprintf(stderr, "Create instance failed from %s!!!",first);
|
||||
return;
|
||||
}
|
||||
|
||||
eThread = PR_GetCurrentThread();
|
||||
|
||||
char* res=(char*)PR_Malloc(sizeof(char*));
|
||||
context->GetResFile(&res);
|
||||
|
||||
if ((file = fopen(res, "w+t")) == NULL) {
|
||||
fprintf(stderr, "ERROR: can't open file %s\n",res);
|
||||
}
|
||||
char* tmp="0,0,";
|
||||
fwrite(tmp,1,PL_strlen(tmp),file);
|
||||
sprintf(tmp,"%d\n",eThread);
|
||||
fwrite(tmp,1,PL_strlen(tmp),file);
|
||||
fclose(file);
|
||||
|
||||
tComponent->Initialize(context);
|
||||
tComponent->Execute("First from MTStart");
|
||||
nsIComponentManager* cm;
|
||||
rv = NS_GetGlobalComponentManager(&cm);
|
||||
if(NS_FAILED(rv)) {
|
||||
fprintf(stderr, "ERROR: Can't get GlobalComponentManager!!\n");
|
||||
}
|
||||
tComponent->THack(cm);
|
||||
tComponent->Execute(0,1);
|
||||
}
|
||||
|
||||
MTStartImpl::~MTStartImpl()
|
||||
@@ -68,12 +95,3 @@ MTStartImpl::~MTStartImpl()
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(MTStartImpl, iMTStart);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user