|
1 // Copyright (c) 1999-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 #ifndef SMS_TEST_BASE_H_ |
|
17 #define SMS_TEST_BASE_H_ |
|
18 |
|
19 #include "smstestutils.h" |
|
20 |
|
21 _LIT(KDefaultSmsTestName, "SMS Test Harness"); |
|
22 |
|
23 class CSmsTestBase : public CActive |
|
24 { |
|
25 public: |
|
26 //StartL() calls RunAutoL if iSmsTest.RunAuto() is True, |
|
27 //otherwise calls ShowMenuL(). |
|
28 //Traps any errors. |
|
29 //Calls iSmsTest.TestHarnessFailed() if there is an error, |
|
30 //otherwise calls iSmsTest.TestHarnessComplete(). |
|
31 IMPORT_C virtual void StartL(); |
|
32 IMPORT_C ~CSmsTestBase(); |
|
33 |
|
34 inline TInt Error() {return iError;} |
|
35 inline TBool Complete() {return iComplete;} |
|
36 |
|
37 inline void SetTestNameL(const TDesC& aTestName); |
|
38 inline const TDesC& TestName() const; |
|
39 inline CSmsTestUtils& SmsTest() const {return iSmsTest;} |
|
40 |
|
41 protected: |
|
42 |
|
43 IMPORT_C CSmsTestBase(CSmsTestUtils& aSmsTest, const TDesC& aScriptFile, TInt& aCurrentTest, TInt aPriority = EPriorityStandard); |
|
44 |
|
45 virtual void ShowMenuL() = 0; |
|
46 virtual void RunAutoL() = 0; |
|
47 |
|
48 IMPORT_C void DisplayLogL(); |
|
49 IMPORT_C void ClearLogL(); |
|
50 |
|
51 IMPORT_C TInt RunError(TInt aError); |
|
52 |
|
53 CMsvSession& Session() {return *iSmsTest.iMsvSession;} |
|
54 CMsvEntry& MsvEntry() {return *iSmsTest.iMsvEntry;} |
|
55 CSmsClientMtm& Client() {return *iSmsTest.iSmsClientMtm;} |
|
56 |
|
57 IMPORT_C virtual void DoTestSendMesssageL(TMsvId aMsgId); |
|
58 IMPORT_C virtual void DoTestForwardMsgL(TMsvId aId); |
|
59 IMPORT_C virtual void DoTestSendingL(const TDesC& aScriptFile, TBool aMove = EFalse); |
|
60 IMPORT_C virtual void DoTestSchedulingL(const TDesC& aScriptFile, TBool aMove = EFalse, TTimeIntervalSeconds aFromNow = 5); |
|
61 |
|
62 inline TBool CompareBools(TBool aLeft, TBool aRight) {return (!aLeft && !aRight) || (aLeft && aRight);} |
|
63 |
|
64 protected: |
|
65 |
|
66 CMsvOperation* iOperation; |
|
67 CMsvEntrySelection* iSelection; |
|
68 CTestTimer* iTimer; |
|
69 HBufC* iTestName; |
|
70 |
|
71 TBool iComplete; |
|
72 TInt iError; |
|
73 TFileName iScriptFile; |
|
74 CSmsTestUtils& iSmsTest; |
|
75 TInt& iNextTest; |
|
76 }; |
|
77 |
|
78 #define SMSTEST_PANIC _L("Sms_Test") |
|
79 |
|
80 inline void CSmsTestBase::SetTestNameL(const TDesC& aTestName) |
|
81 { |
|
82 delete iTestName; |
|
83 iTestName = NULL; |
|
84 iTestName = aTestName.AllocL(); |
|
85 } |
|
86 |
|
87 inline const TDesC& CSmsTestBase::TestName() const |
|
88 { |
|
89 if (iTestName) |
|
90 return *iTestName; |
|
91 else |
|
92 return KDefaultSmsTestName; |
|
93 } |
|
94 |
|
95 #endif |