blob: d1dd126f34b1617cc35c833b12722d34740e2fb8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
/*
* Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
* Contact: http://www.qt-project.org/legal
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
* This test harness simulates aspects of the phbksync test plugin behaviour which
* starts up the phbksync server if it is not running. The phbksync server configures itself
* and needs to access the contacts DB. Accessing the contacts DB from within the contacts
* server can cause deadlocks. The contacts client will load the test plugin and try to access
* the contacts DB on first use only, this will avoid the problem of the server being deadlocked.
* **This test only works with Contacts the test plugin and not the original phonebooksync plugin.**
*/
#include <e32test.h>
#include "t_utils.h"
#include "./testsyncplugin/cnttestsynchroniser.h"
_LIT(KICCStartupTest, "ICC Test plugin startup test");
_LIT(KPhoneGroupId, "PhoneGroupId test");
_LIT(KICCTemplateId, "ICCTemplateId test");
_LIT(KIccStartupDB, "c:IccStartupDB");
RTest test(KICCStartupTest);
CCntTest* CntTestPtr;
CContactSyncChecker* syncChecker;
void DoPhoneGroupIdTest()
{
/*
get contacts database and get the contacts phone group id.
This should load the test plugin, which should make a call back
into the contacts DB
*/
CntTestPtr->CreateDatabaseL();
CntTestPtr->OpenDatabaseL();
CContactDatabase& Db = *CntTestPtr->Db();
Db.PhonebookGroupIdL();
test (syncChecker->PluginLoadedCountL() == 2); //one for the client & one for server
CntTestPtr->CloseDatabase();
CntTestPtr->DeleteDatabaseL(); //close & delete database at end of test
}
void DoICCTemplateIdTest()
{
/*
get contacts database and get the contacts ICCTemplate id.
This should load the test plugin, which should make a call back
into the contacts DB
*/
CntTestPtr->CreateDatabaseL();
CntTestPtr->OpenDatabaseL();
CContactDatabase& Db = *CntTestPtr->Db();
Db.ICCTemplateIdL();
test (syncChecker->PluginLoadedCountL() == 2); //one for the client & one for server
CntTestPtr->CloseDatabase();
CntTestPtr->DeleteDatabaseL(); //close & delete database at end of test
}
/**
@SYMTestCaseID PIM-T-ICCSTARTUP-0001
*/
void DoTestsL()
{
test.Start(_L("@SYMTESTCaseID:PIM-T-ICCSTARTUP-0001 ICC Test plugin startup test"));
syncChecker = new (ELeave) CContactSyncChecker;
syncChecker->ResetEverythingL(); //set the counters to zero
test.Next(_L("PhoneGroupId test"));
DoPhoneGroupIdTest();
syncChecker->ResetEverythingL(); //set the counters to zero
test.Next(_L("ICCTemplateId test"));
DoICCTemplateIdTest();
delete syncChecker;
syncChecker = NULL;
}
/** Standard E32Main method */
GLDEF_C TInt E32Main()
{
__UHEAP_MARK;
CntTestPtr=new(ELeave) CCntTest;
CntTestPtr->ConstructL(test,KIccStartupDB); //KIccStartupDB defined in cnttestsynchroniser.h
TRAPD(err,DoTestsL());
CntTestPtr->EndTestLib(err); // is responsible for deleting the memory for itself
__UHEAP_MARKEND;
return KErrNone;
}
|