fix for bug #5804. get pop3Test to build on Linux.

This commit is contained in:
sspitzer%netscape.com 1999-05-01 02:12:10 +00:00
Родитель b71bb5f33c
Коммит c23ef233b3
3 изменённых файлов: 30 добавлений и 9 удалений

Просмотреть файл

@ -23,7 +23,7 @@ srcdir = @srcdir@
include $(DEPTH)/config/autoconf.mk
#commented out because they don't build
#DIRS = pop3
DIRS = pop3
include $(topsrcdir)/config/config.mk

Просмотреть файл

@ -53,6 +53,8 @@ LIBS = \
-lpref \
-lmozjs \
-lraptorbase \
-ljsdom \
-ljsurl \
-lrdfbase_s \
-lrdfutil_s \
-lgmbase$(MOZ_TOOLKIT) \

Просмотреть файл

@ -63,6 +63,7 @@
#define XPCOM_DLL "libxpcom.so"
#define PREF_DLL "libpref.so"
#define APPCORES_DLL "libappcores.so"
#define APPSHELL_DLL "libnsappshell.so"
#endif
#endif
@ -91,7 +92,7 @@ static NS_DEFINE_IID(kFileLocatorCID, NS_FILELOCATOR_CID);
class nsPop3TestDriver : public nsIUrlListener
{
public:
nsPop3TestDriver(nsINetService * pService);
nsPop3TestDriver(nsINetService * pService, PLEventQueue *queue);
virtual ~nsPop3TestDriver();
NS_DECL_ISUPPORTS
@ -121,6 +122,7 @@ public:
nsresult OnIdentityCheck();
protected:
PLEventQueue *m_eventQueue;
char m_urlSpec[200]; // "sockstub://hostname:port" it does not include the command specific data...
char m_urlString[500]; // string representing the current url being run. Includes host AND command specific data.
char m_userData[250]; // generic string buffer for storing the current user entered data...
@ -131,13 +133,15 @@ protected:
NS_IMPL_ISUPPORTS(nsPop3TestDriver, nsIUrlListener::GetIID())
nsPop3TestDriver::nsPop3TestDriver(nsINetService * pNetService)
nsPop3TestDriver::nsPop3TestDriver(nsINetService * pNetService,
PLEventQueue *queue)
{
NS_INIT_REFCNT();
m_urlSpec[0] = '\0';
m_urlString[0] = '\0';
m_runningURL = PR_FALSE;
m_runTestHarness = PR_TRUE;
m_eventQueue = queue;
InitializeTestDriver(); // prompts user for initialization information...
}
@ -186,6 +190,10 @@ nsresult nsPop3TestDriver::RunDriver()
{
status = ReadAndDispatchCommand();
} // if running url
#ifdef XP_UNIX
printf(".");
PL_ProcessPendingEvents(m_eventQueue);
#endif
#ifdef XP_PC
MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
@ -194,7 +202,6 @@ nsresult nsPop3TestDriver::RunDriver()
DispatchMessage(&msg);
}
#endif
} // until the user has stopped running the url (which is really the test session.....
return status;
@ -460,9 +467,9 @@ nsresult nsPop3TestDriver::OnGet()
int main()
{
PLEventQueue *queue;
nsINetService * pNetService;
nsresult result;
nsIURL * pURL = NULL;
nsComponentManager::RegisterComponent(kNetServiceCID, NULL, NULL, NETLIB_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kEventQueueServiceCID, NULL, NULL, XPCOM_DLL, PR_FALSE, PR_FALSE);
@ -470,7 +477,13 @@ int main()
nsComponentManager::RegisterComponent(kFileLocatorCID, NULL, NULL, APPSHELL_DLL, PR_FALSE, PR_FALSE);
// make sure prefs get initialized and loaded..
// mscott - this is just a bad bad bad hack right now until prefs
// has the ability to take nsnull as a parameter. Once that happens,
// prefs will do the work of figuring out which prefs file to load...
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &result);
if (NS_FAILED(result) || prefs == nsnull) {
exit(result);
}
// Create the Event Queue for this thread...
nsIEventQueueService* pEventQService;
@ -490,8 +503,14 @@ int main()
return 1;
}
result = pEventQService->GetThreadEventQueue(PR_GetCurrentThread(),&queue);
if (NS_FAILED(result) || !queue) {
printf("unable to get event queue.\n");
return 1;
}
// okay, everything is set up, now we just need to create a test driver and run it...
nsPop3TestDriver * driver = new nsPop3TestDriver(pNetService);
nsPop3TestDriver * driver = new nsPop3TestDriver(pNetService, queue);
if (driver)
{
driver->RunDriver();