xref: /haiku/headers/tools/cppunit/TestApp.h (revision 83b1a68c52ba3e0e8796282759f694b7fdddf06d)
1 // TestApp.h
2 
3 #ifndef _beos_test_app_h_
4 #define _beos_test_app_h_
5 
6 #include <Application.h>
7 #include <List.h>
8 #include <MessageQueue.h>
9 
10 #include <cppunit/Portability.h>
11 
12 // TestHandler
13 
14 class BTestHandler : public BHandler {
15 public:
16 	virtual void MessageReceived(BMessage *message);
17 	BMessageQueue &Queue();
18 
19 private:
20 	BMessageQueue	fQueue;
21 };
22 
23 
24 // TestApp
25 
26 class CPPUNIT_API BTestApp : public BApplication {
27 public:
28 	BTestApp(const char *signature);
29 	virtual ~BTestApp();
30 
31 	status_t Init();
32 	void Terminate();
33 
34 	virtual void ReadyToRun();
35 
36 	BTestHandler *CreateTestHandler();
37 	bool DeleteTestHandler(BTestHandler *handler);
38 
39 	BTestHandler &Handler();
40 	BTestHandler *TestHandlerAt(int32 index);
41 
42 private:
43 	static int32 _AppThreadStart(void *data);
44 
45 private:
46 	thread_id		fAppThread;
47 	BList			fHandlers;
48 };
49 
50 #endif	// _beos_test_app_h_
51