|
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 "smstestbase.h" |
|
17 |
|
18 #include <msvapi.h> |
|
19 |
|
20 _LIT(KSmsSendRecvTestName, "Send and Receive"); |
|
21 |
|
22 class CEntryObserver : public CBase, public MMsvEntryObserver |
|
23 { |
|
24 public: |
|
25 void HandleEntryEventL(TMsvEntryEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); |
|
26 ~CEntryObserver(); |
|
27 public: |
|
28 |
|
29 static CEntryObserver* NewL(CSmsTestUtils& aTestUtils, const TInt& aCurrentMessageNum); |
|
30 const CMsvEntrySelection& Received() const {return *iReceived;} |
|
31 TMsvId Received(TInt aItem) const {return iReceived->At(aItem);} |
|
32 TInt Count() const {return iReceived->Count();} |
|
33 TMsvId LastReceived() const {return Count() ? Received(Count() - 1) : KErrNotFound;} |
|
34 |
|
35 private: |
|
36 |
|
37 CEntryObserver(CSmsTestUtils& aTestUtils, const TInt& aCurrentMessageNum); |
|
38 CMsvEntrySelection* iReceived; |
|
39 const TInt& iCurrentMessageNum; |
|
40 CSmsTestUtils& iSmsTest; |
|
41 }; |
|
42 |
|
43 const TTimeIntervalMicroSeconds32 KWaitForReceiveIteration = 5000000; |
|
44 const TTimeIntervalMicroSeconds32 KMaxWaitForMsg = 30000000; |
|
45 |
|
46 //Command Line Switches |
|
47 _LIT(KParseAfterReceive, "/p"); |
|
48 _LIT(KSaveAfterReceive, "/s"); |
|
49 _LIT(KWaitForever, "/w"); |
|
50 _LIT(KTestBifs, "/b"); |
|
51 |
|
52 //Test Bifs |
|
53 _LIT(KSendRecvScript, "sendrecv.script"); |
|
54 _LIT(KTestBif1, "Koala.rsc"); |
|
55 _LIT(KTestBif2, "Giraffe.rsc"); |
|
56 _LIT(KBifDir, "c:\\system\\bif\\"); |
|
57 const TTimeIntervalMicroSeconds32 KBifWait = 4000000; |
|
58 |
|
59 //Forward declarations |
|
60 class CSmsSendRecvTest : public CSmsTestBase |
|
61 { |
|
62 public: |
|
63 static CSmsSendRecvTest* NewLC(CSmsTestUtils& aSmsTest, const TDesC& aScriptFile, TInt& aNextTest); |
|
64 ~CSmsSendRecvTest(); |
|
65 |
|
66 private: |
|
67 CSmsSendRecvTest(CSmsTestUtils& aSmsTest, const TDesC& aScriptFile, TInt& aNextTest); |
|
68 |
|
69 void TestSendingL(); |
|
70 TBool SendNextMessageL(); |
|
71 void TestWaitForReceiveL(); |
|
72 void TestParseL(); |
|
73 void DoRunTestParseL(); |
|
74 |
|
75 void TestBifsL(); |
|
76 void TestAddBifL(const TDesC& aBifName); |
|
77 void TestRemoveBifL(const TDesC& aBifName); |
|
78 |
|
79 void ConstructL(); |
|
80 |
|
81 void RunL(); |
|
82 void DoCancel(); |
|
83 |
|
84 TInt RunError(TInt aError); |
|
85 void RunComplete(); |
|
86 |
|
87 void ShowMenuL(); |
|
88 void RunAutoL(); |
|
89 |
|
90 void DoRunSendingL(); |
|
91 void DoRunWaitingToReceiveL(); |
|
92 void DoWaitL(); |
|
93 |
|
94 void WaitForExtraL(); |
|
95 void DoRunWaitForExtraL(); |
|
96 |
|
97 TInt CountRecipientsL(TMsvId aId); |
|
98 |
|
99 CEntryObserver* iEntryObserver; |
|
100 |
|
101 TInt iSent; |
|
102 TInt iTotal; |
|
103 |
|
104 TInt iCountWaits; |
|
105 |
|
106 CMsvEntry* iEntryForObserver; |
|
107 TInt iCurrentMessageNum; |
|
108 TBool iParse; |
|
109 TBool iSaveToFile; |
|
110 TBool iWaitForever; |
|
111 |
|
112 enum TSmsSendTestState |
|
113 { |
|
114 EStateWaiting, |
|
115 EStateSending, |
|
116 EStateWaitingToReceive, |
|
117 EStateParsing, |
|
118 EStateMessageReceived, |
|
119 EStateWaitingToReceiveAnyExtra |
|
120 } iState; |
|
121 |
|
122 TBool iTestBifs; |
|
123 }; |