summaryrefslogtreecommitdiff
path: root/src/msvc6/testrunner/ActiveTest.h
blob: 809d6e6b3a2791dbbf06655558043e25a4b249cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef CPPUNIT_ACTIVETEST_H
#define CPPUNIT_ACTIVETEST_H

#include <afxmt.h>

#ifndef CPPUNIT_TESTDECORATOR_H
#include <cppunit/extensions/TestDecorator.h>
#endif


/* A Microsoft-specific active test
 *
 * An active test manages its own
 * thread of execution.  This one 
 * is very simple and only sufficient
 * for the limited use we put it through
 * in the TestRunner.  It spawns a thread
 * on run (TestResult *) and signals
 * completion of the test.
 *
 * We assume that only one thread 
 * will be active at once for each
 * instance.
 *
 */

class ActiveTest : public CPPUNIT_NS::TestDecorator
{
public:
  ActiveTest( CPPUNIT_NS::Test *test );
  ~ActiveTest();

  void run( CPPUNIT_NS::TestResult *result );

protected:
  HANDLE m_threadHandle;
  CEvent m_runCompleted;
  CPPUNIT_NS::TestResult *m_currentTestResult;

  void run();
  void setTestResult( CPPUNIT_NS::TestResult *result );
  static UINT threadFunction( LPVOID thisInstance );
};

#endif