|
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 #include "msvtestutils.h" |
|
17 #include "t_schsendshare.h" |
|
18 |
|
19 class CSchSendTestUtils; |
|
20 class CMsvScheduleSettings; |
|
21 class TMsvOffPeakTime; |
|
22 class TMsvSendErrorAction; |
|
23 class CMsvSendErrorActions; |
|
24 class TMsvSchedulePackage; |
|
25 |
|
26 class CScheduleTestActive : public CActive, public MMsvSessionObserver |
|
27 { |
|
28 public: |
|
29 |
|
30 IMPORT_C static CScheduleTestActive* CScheduleTestActive::NewL(CSchSendTestUtils& aTest, TInt aPriority = CActive::EPriorityStandard); |
|
31 IMPORT_C ~CScheduleTestActive(); |
|
32 IMPORT_C const TSchSendTestProgress& TransferCommandSyncL(TSchSendTestOperation aCommand, const CMsvEntrySelection& aSelection, const TDesC8& aParameter, TBool aStopAtRunL); |
|
33 IMPORT_C const TSchSendTestProgress& TransferCommandSyncL(TSchSendTestOperation aCommand, const CMsvEntrySelection& aSelection, TBool aStopAtRunL); |
|
34 const TSchSendTestProgress& Progress() const {return iProgress;} |
|
35 |
|
36 private: |
|
37 |
|
38 CScheduleTestActive::CScheduleTestActive(CSchSendTestUtils& aTest, TInt aPriority); |
|
39 void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*); |
|
40 void RunL(); |
|
41 void DoCancel() {iOperation->Cancel();} |
|
42 TInt RunError(TInt aError); |
|
43 |
|
44 TSchSendTestOperation iCommand; |
|
45 CSchSendTestUtils& iTest; |
|
46 CMsvSession& iSession; |
|
47 CMsvEntrySelection* iSelection; |
|
48 CMsvOperation* iOperation; |
|
49 TBool iStopAtRunL; |
|
50 TSchSendTestProgress iProgress; |
|
51 }; |
|
52 |
|
53 class CSchSendTestTimer : public CTimer |
|
54 { |
|
55 public: |
|
56 IMPORT_C static CSchSendTestTimer* NewL(TInt aPriority = CActive::EPriorityLow); |
|
57 private: |
|
58 CSchSendTestTimer(TInt aPriority); |
|
59 void RunL(); |
|
60 }; |
|
61 |
|
62 const TInt KSchSendTestWaitForStateDefault = 1000000; |
|
63 |
|
64 class CSchSendTestWaitForState : public CActive, public MMsvSessionObserver |
|
65 { |
|
66 public: |
|
67 IMPORT_C static CSchSendTestWaitForState* NewL(CSchSendTestUtils& aTest); |
|
68 IMPORT_C ~CSchSendTestWaitForState(); |
|
69 void AppendL(TInt aSendingState) {User::LeaveIfError(iSendingStates.Append(aSendingState));} |
|
70 IMPORT_C void Reset(); |
|
71 IMPORT_C void StartL(const CMsvEntrySelection& aSelection); |
|
72 IMPORT_C void StartL(const CMsvEntrySelection& aSelection, TTimeIntervalMicroSeconds32 aAfter); |
|
73 |
|
74 private: |
|
75 CSchSendTestWaitForState(CSchSendTestUtils& aTest); |
|
76 void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); |
|
77 void RunL(); |
|
78 void DoCancel(); |
|
79 TInt RunError(TInt aError); |
|
80 TBool CheckStateL(TMsvId aId); |
|
81 void DoStartL(const CMsvEntrySelection& aSelection, TTimeIntervalMicroSeconds32 aAfter, TBool aWaitForever); |
|
82 |
|
83 private: |
|
84 CSchSendTestUtils& iTest; |
|
85 CMsvEntrySelection* iSelection; |
|
86 RArray<TInt> iSendingStates; |
|
87 RTimer iTimer; |
|
88 TTimeIntervalMicroSeconds32 iAfter; |
|
89 TBool iWaitForever; |
|
90 }; |
|
91 |
|
92 class CSchSendTestUtils : public CMsvTestUtils, public MMsvSessionObserver |
|
93 { |
|
94 public: |
|
95 |
|
96 IMPORT_C void StartL(); |
|
97 |
|
98 protected: |
|
99 |
|
100 IMPORT_C CSchSendTestUtils(RTest& aTest); |
|
101 IMPORT_C ~CSchSendTestUtils(); |
|
102 void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*) {}; |
|
103 IMPORT_C void Panic(TInt aPanic); |
|
104 IMPORT_C void ConstructL(); |
|
105 |
|
106 virtual void ShowMenuL() = 0; |
|
107 virtual void RunAutoL() = 0; |
|
108 |
|
109 //From CMsvTestUtils |
|
110 void InstantiateClientMtmsL(){}; |
|
111 void InstantiateServerMtmsL(){}; |
|
112 void DeleteServicesL(){}; |
|
113 void CreateServicesL(){}; |
|
114 void FindExistingServicesL(){}; |
|
115 IMPORT_C void InstallMtmGroupsL(); |
|
116 IMPORT_C void CreateServerMtmRegsL(); |
|
117 |
|
118 IMPORT_C TMsvId CreateMessageLC(TMsvEntry& aEntry, TMsvId aDestFolder, TTime aSendTime, TBool aOffPeak = EFalse); |
|
119 IMPORT_C TInt DiffInMins(TTime d1, TTime d2); |
|
120 IMPORT_C TInt DiffInSecs(TTime d1, TTime d2); |
|
121 |
|
122 IMPORT_C void ChangeMessageTimeL(TMsvId aMessage, TTime aTime); |
|
123 IMPORT_C void AssertL(TBool b); |
|
124 |
|
125 IMPORT_C void CleanScheduleFolderL(); |
|
126 IMPORT_C void DisplayAllSchedulesL(TInt& rSchCount, TInt& rScheduleSize); |
|
127 IMPORT_C TTime RoundUpToMinute(const TTime& aTime) const; |
|
128 IMPORT_C TTime RoundDownToMinute(const TTime& aTime) const; |
|
129 IMPORT_C TBool CompareRoundedTimes(const TTime& aLeft, const TTime& aRight) const; |
|
130 |
|
131 protected: |
|
132 |
|
133 CMsvEntrySelection* iSelection; |
|
134 CScheduleTestActive* iSchTestActive; |
|
135 TInt iCurrentTest; |
|
136 TBool iHeapTest; |
|
137 }; |
|
138 |
|
139 IMPORT_C TBool operator==(const CMsvScheduleSettings& aSettings1, const CMsvScheduleSettings& aSettings2); |
|
140 IMPORT_C TBool StartsAt(const TMsvOffPeakTime& time1, const TTime& time2); |
|
141 IMPORT_C TBool operator==(const TMsvOffPeakTime& time1, const TMsvOffPeakTime& time2); |
|
142 IMPORT_C TBool operator==(const TMsvSendErrorAction& a1, const TMsvSendErrorAction& a2); |
|
143 IMPORT_C TBool operator==(const CMsvSendErrorActions& one, const CMsvSendErrorActions& two); |
|
144 IMPORT_C TBool operator==(const TMsvSchedulePackage& aOne, const TMsvSchedulePackage& aTwo); |
|
145 IMPORT_C RTest& operator<<(RTest& aTest, TTime t); |
|
146 |
|
147 template<class T> |
|
148 TBool operator!=(T a, T b) |
|
149 { |
|
150 return !(a==b); |
|
151 } |