|
1 // Copyright (c) 2000-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 __CONCURRENT_H__ |
|
17 #define __CONCURRENT_H__ |
|
18 |
|
19 // Include Files |
|
20 #include <e32base.h> |
|
21 #include <cntdb.h> |
|
22 #include <e32test.h> |
|
23 |
|
24 // Function Prototypes |
|
25 GLDEF_C TInt E32Main(); |
|
26 |
|
27 // The various test steps. |
|
28 enum TTestSteps { |
|
29 ETestCreate, |
|
30 ETestOpen, |
|
31 ETestReplace, |
|
32 ETestsEnd |
|
33 }; |
|
34 |
|
35 |
|
36 /** |
|
37 * The class is used to encapsulate the main thread. |
|
38 * This thread opens the session to the DB in thread shared mode, |
|
39 * and manipultes it by adding and deleting contacts. |
|
40 * It also controls the child thread. |
|
41 */ |
|
42 class CMainThread : public CBase |
|
43 { |
|
44 public: |
|
45 |
|
46 static CMainThread* NewL(); |
|
47 void ConstructL(); |
|
48 ~CMainThread(); |
|
49 |
|
50 void TestCreateDatabaseL(); |
|
51 void TestOpenDatabaseL(); |
|
52 void TestReplaceDatabaseL(); |
|
53 void CloseDatabaseSessionL(); |
|
54 |
|
55 void TestAddContactL(); |
|
56 void TestDeleteContactL(); |
|
57 |
|
58 void LaunchChildThreadL(); |
|
59 void ResumeChildThreadL(); |
|
60 |
|
61 protected: |
|
62 |
|
63 RTest* iTest; |
|
64 RThread iChildThread; |
|
65 TContactItemId iContactId; |
|
66 }; |
|
67 |
|
68 /** |
|
69 * The child thread class which works with the shared session of the database. |
|
70 * This encapsulated the functionality for accessing the shared db session. |
|
71 */ |
|
72 class CChildThread : public CBase |
|
73 { |
|
74 public: |
|
75 |
|
76 static CChildThread * NewL(); |
|
77 void ConstructL(); |
|
78 ~CChildThread(); |
|
79 |
|
80 void AccessDBTestL(); |
|
81 |
|
82 protected: |
|
83 |
|
84 RTest* iTest; |
|
85 }; |
|
86 |
|
87 #endif // __CONCURRENT_H__ |
|
88 |
|
89 |