|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #if !(defined __NETCONTESTBASES_H__) |
|
17 #define __NETCONTESTBASES_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 #ifdef _DEBUG |
|
22 #include "NetConLog.h" |
|
23 #undef ASSERT |
|
24 /** @todo there must be a better way to output __FILE__ */ |
|
25 #define ASSERT(COND) { TBuf8<KMaxFileName> narrowFileName; narrowFileName.Copy((TText8*)__FILE__); TFileName wideFileName; wideFileName.Copy(narrowFileName); if(!(COND)) { NetConLog::Printf(_L("Assertion failed in %S at line %d"), &wideFileName, __LINE__); User::Invariant(); } } |
|
26 #endif |
|
27 |
|
28 // |
|
29 // The interface for all netcon tests |
|
30 // |
|
31 class MNetConTest |
|
32 { |
|
33 public: |
|
34 enum TResult |
|
35 { |
|
36 EUnknown, |
|
37 EPassed, |
|
38 EFailed |
|
39 }; |
|
40 |
|
41 virtual void Start() = 0; |
|
42 virtual TResult Result() const = 0; |
|
43 virtual const TDesC& Name() const = 0; |
|
44 }; |
|
45 |
|
46 class CNetConTestBase : public CActive, public MNetConTest |
|
47 { |
|
48 public: |
|
49 virtual ~CNetConTestBase(); |
|
50 |
|
51 // MNetConTest |
|
52 virtual void Start(); |
|
53 virtual TResult Result() const; |
|
54 |
|
55 protected: |
|
56 CNetConTestBase(); |
|
57 |
|
58 void CompleteTest(TResult aResult); |
|
59 |
|
60 // pure virtual |
|
61 virtual void StartTestL() = 0; |
|
62 |
|
63 private: |
|
64 virtual void RunL(); |
|
65 virtual TInt RunError(TInt aError); |
|
66 virtual void DoCancel(); |
|
67 |
|
68 void StopTest(); |
|
69 |
|
70 private: |
|
71 enum TNetConTestAction |
|
72 { |
|
73 ENone, |
|
74 EStart, |
|
75 EStop |
|
76 }; |
|
77 |
|
78 enum TNetConTestState |
|
79 { |
|
80 EInitialised, |
|
81 EStarting, |
|
82 EComplete |
|
83 }; |
|
84 |
|
85 private: |
|
86 TResult iResult; |
|
87 TNetConTestAction iAction; |
|
88 TNetConTestState iState; |
|
89 }; |
|
90 |
|
91 |
|
92 #endif // __NETCONTESTBASES_H__ |
|
93 |