10 |
// the Thread class we want to test |
// the Thread class we want to test |
11 |
#include "../common/Thread.h" |
#include "../common/Thread.h" |
12 |
|
|
13 |
|
// we need that to check if our thread is killable even if waiting for a condition |
14 |
|
#include "../common/Condition.h" |
15 |
|
|
16 |
class ThreadTest : public CppUnit::TestFixture { |
class ThreadTest : public CppUnit::TestFixture { |
17 |
|
|
18 |
CPPUNIT_TEST_SUITE(ThreadTest); |
CPPUNIT_TEST_SUITE(ThreadTest); |
20 |
CPPUNIT_TEST(testSignalStopThread); |
CPPUNIT_TEST(testSignalStopThread); |
21 |
CPPUNIT_TEST(testRelaunchThread); |
CPPUNIT_TEST(testRelaunchThread); |
22 |
CPPUNIT_TEST(testStopThread); |
CPPUNIT_TEST(testStopThread); |
23 |
|
CPPUNIT_TEST(testThreadKillableWhenWaiting); |
24 |
CPPUNIT_TEST_SUITE_END(); |
CPPUNIT_TEST_SUITE_END(); |
25 |
|
|
26 |
private: |
private: |
43 |
HelperThread(DummyThread* pDummyThread); |
HelperThread(DummyThread* pDummyThread); |
44 |
int Main(); |
int Main(); |
45 |
}; |
}; |
46 |
|
|
47 |
|
// this simulates a thread that is waiting for a condition (thus sleeping til then) |
48 |
|
class WaitingThread : public Thread { |
49 |
|
public: |
50 |
|
WaitingThread(); |
51 |
|
int Main(); |
52 |
|
private: |
53 |
|
Condition condition; |
54 |
|
}; |
55 |
public: |
public: |
56 |
void setUp() { |
void setUp() { |
57 |
} |
} |
63 |
void testSignalStopThread(); |
void testSignalStopThread(); |
64 |
void testRelaunchThread(); |
void testRelaunchThread(); |
65 |
void testStopThread(); |
void testStopThread(); |
66 |
|
void testThreadKillableWhenWaiting(); |
67 |
}; |
}; |
68 |
|
|
69 |
#endif // __LS_THREADTEST_H__ |
#endif // __LS_THREADTEST_H__ |