|
1 // Copyright (c) 2008-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 // functional unit of the Common TSY Dispatcher. |
|
15 // |
|
16 |
|
17 |
|
18 |
|
19 /** |
|
20 @file The TEFUnit header file which tests the Phonebook |
|
21 */ |
|
22 |
|
23 /** |
|
24 @file |
|
25 @internalAll |
|
26 */ |
|
27 |
|
28 #ifndef CCTSYPHONEBOOKFU_H |
|
29 #define CCTSYPHONEBOOKFU_H |
|
30 |
|
31 #include <test/tefunit.h> |
|
32 |
|
33 #include <etelmm.h> |
|
34 #include <etelmmcs.h> |
|
35 |
|
36 #include "cctsycomponenttestbase.h" |
|
37 |
|
38 #include <ctsy/ltsy/cctsydispatchercallback.h> |
|
39 #include <ctsy/ltsy/mltsydispatchphonebookinterface.h> |
|
40 |
|
41 #include <ctsy/rmmcustomapi.h> |
|
42 |
|
43 class CPhoneBookEntry; |
|
44 |
|
45 class CCTsyPhonebookFU : public CCtsyComponentTestBase |
|
46 { |
|
47 public: |
|
48 // Create a suite of all the tests |
|
49 static CTestSuite* CreateSuiteL(const TDesC& aName); |
|
50 |
|
51 public: |
|
52 // use-case tests |
|
53 void TestUseCase0001L(); |
|
54 void TestUseCase0002L(); |
|
55 void TestUseCase0003L(); |
|
56 void TestUseCase0004L(); |
|
57 void TestUseCase0005L(); |
|
58 void TestUseCase0006L(); |
|
59 void TestUseCase0007L(); |
|
60 void TestUseCase0008L(); |
|
61 void TestUseCase0009L(); |
|
62 void TestUseCase0010L(); |
|
63 void TestUseCase0011L(); |
|
64 void TestUseCase0012L(); |
|
65 void TestUseCase0013L(); |
|
66 void TestUseCase0014L(); |
|
67 |
|
68 //other unit tests |
|
69 void TestUnit0001L(); |
|
70 void TestUnit0002L(); |
|
71 void TestUnit0003L(); |
|
72 void TestUnit0004L(); |
|
73 void TestUnit0005L(); |
|
74 void TestUnit0006L(); |
|
75 void TestUnit0007L(); |
|
76 void TestUnit0008L(); |
|
77 void TestUnit0009L(); |
|
78 void TestUnit0010L(); |
|
79 void TestUnit0011L(); |
|
80 void TestUnit0012L(); |
|
81 |
|
82 private: |
|
83 |
|
84 void CreateTlvFromEntryL(const CPhoneBookEntry& aPhoneBookEntry, RBuf8& aBuf); |
|
85 void CreateTlvFromPhonebookL(const RPointerArray<CPhoneBookEntry>& aPhonebook, RBuf8& aBuf); |
|
86 |
|
87 void FillPhonebookEntryArrayFromTlvL(const TDesC8& aEntry, RPointerArray<CPhoneBookEntry>& aPhoneBook); |
|
88 |
|
89 void TestTlvWriteReadL(const CPhoneBookEntry& aPhoneBookEntry); |
|
90 |
|
91 void CreateEntriesAndStoreDataL(); |
|
92 |
|
93 void OpenPhoneBookL(DispatcherPhonebook::TPhonebook aPhonebook, RMobilePhoneBookStore& aPhoneBookStore, RMmCustomAPI& aCustomApi); |
|
94 void OpenPhoneBookWithInitialisationL(DispatcherPhonebook::TPhonebook aPhonebook, RMobilePhoneBookStore& aPhoneBookStore, TInt aError); |
|
95 void OpenCachingPhoneBookL(DispatcherPhonebook::TPhonebook aPhonebook, RMobilePhoneBookStore& aPhoneBookStore, TInt aError); |
|
96 void CompleteCacheL(DispatcherPhonebook::TPhonebook aPhonebook, TInt aError, TBool aIsRefresh); |
|
97 void OpenNonCachingPhoneBookL(DispatcherPhonebook::TPhonebook aPhonebook, RMobilePhoneBookStore& aPhoneBookStore, TInt aError); |
|
98 TBool InitialisationRequired(DispatcherPhonebook::TPhonebook aPhonebook) const; |
|
99 TBool CachingPhonebook(DispatcherPhonebook::TPhonebook aPhonebook) const; |
|
100 |
|
101 void ReadL(DispatcherPhonebook::TPhonebook aPhonebook, TInt aError); |
|
102 void ReadL(DispatcherPhonebook::TPhonebook aPhonebook, const RMobilePhoneBookStore& aPhonebookStore, TInt aError); |
|
103 |
|
104 void CacheReadL(const RMobilePhoneBookStore& aPhoneBookStore, TInt aIndex, TInt aNumberOfSlots); |
|
105 void NonCacheReadL(DispatcherPhonebook::TPhonebook aPhonebook, const RMobilePhoneBookStore& aPhoneBookStore, TInt aIndex, TInt aNumberOfSlots, TInt aError); |
|
106 void ExpectNonCacheReadL(DispatcherPhonebook::TPhonebook aPhonebook, const RMobilePhoneBookStore& aPhoneBookStore, TInt aIndex, TInt aNumberOfSlots, TRequestStatus& aRequestStatus, TDes8& aReadData); |
|
107 void CompleteNonCacheReadL(DispatcherPhonebook::TPhonebook aPhonebook, TInt aIndex, TInt aNumberOfSlots, TRequestStatus& aRequestStatus, const TDesC8& aReadData, TInt aError); |
|
108 |
|
109 void DeleteL(DispatcherPhonebook::TPhonebook aPhonebook, TInt aIndexToDelete, TInt aError); |
|
110 void DeleteAllL(DispatcherPhonebook::TPhonebook aPhonebook, TInt aError); |
|
111 |
|
112 void WriteL(DispatcherPhonebook::TPhonebook aPhonebook, const CPhoneBookEntry& aPhoneBookEntry, TInt aError); |
|
113 void WriteL(DispatcherPhonebook::TPhonebook aPhonebook, const RMobilePhoneBookStore& aPhonebookStore, const CPhoneBookEntry& aPhoneBookEntry, TInt aError); |
|
114 |
|
115 void CheckPhonebookDetailsL(DispatcherPhonebook::TPhonebook aPhonebook,const RMobilePhoneBookStore& aPhonebookStore, TInt aEntries, TInt aError); |
|
116 |
|
117 void GetInfoL(DispatcherPhonebook::TPhonebook aPhonebook, TInt aError); |
|
118 void GetInfoFromCtsy(DispatcherPhonebook::TPhonebook aPhonebook, const RMobilePhoneBookStore& aPhonebookStore, TInt aUsedEntries); |
|
119 void GetInfoFromLtsyL(DispatcherPhonebook::TPhonebook aPhonebook, const RMobilePhoneBookStore& aPhonebookStore, TInt aUsedEntries, TInt aError); |
|
120 |
|
121 void SetFdnInfoL(RMobilePhoneBookStore& aPhoneBookStore, TInt aError); |
|
122 |
|
123 void RefreshL(DispatcherPhonebook::TPhonebook aPhonebook); |
|
124 |
|
125 TName PhonebookName(DispatcherPhonebook::TPhonebook aPhonebook) const; |
|
126 |
|
127 static void PhoneBookEntryArrayCleanup(TAny* aArray); |
|
128 |
|
129 void OpenSmsStoreL(RMobileSmsMessaging& aSmsMessaging, RMobileSmsStore& aSmsStore, const TDesC& aSmsStoreName); |
|
130 |
|
131 virtual void DoCleanup(); |
|
132 |
|
133 private: |
|
134 |
|
135 DispatcherPhonebook::TPhonebookStoreInfoV1 iPhonebookStoreData; |
|
136 |
|
137 RPointerArray<CPhoneBookEntry> iEntries; |
|
138 |
|
139 TBool iInititalised; |
|
140 |
|
141 }; // class CCTsyPhonebookFU |
|
142 |
|
143 #endif // CCTSYPHONEBOOKENFU_H |
|
144 |