|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <swinstdefs.h> |
|
19 #include <swinstapi.h> |
|
20 #include <w32std.h> |
|
21 #include <apgtask.h> |
|
22 |
|
23 // CLASS HEADER |
|
24 #include "T_caUsifScaner.h" |
|
25 |
|
26 // EXTERNAL INCLUDES |
|
27 |
|
28 #include <cadef.h> |
|
29 |
|
30 #include "castoragefactory.h" |
|
31 #include "castorageproxy.h" |
|
32 #include "casrvengutils.h" |
|
33 #include "causifscanner.h" |
|
34 #include "causifscanner.hrh" |
|
35 #include "cainnerentry.h" |
|
36 #include "cainnerquery.h" |
|
37 #include "caarraycleanup.inl" |
|
38 #include "casrvmmchistory.h" |
|
39 #include "cainstallnotifier.h" |
|
40 #include "cammcwatcher.h" |
|
41 #include "cainstallstrategy.h" |
|
42 |
|
43 // INTERNAL INCLUDES |
|
44 #include "casrvtestutils.h" |
|
45 #include "testconsts.h" |
|
46 |
|
47 #ifdef COVERAGE_MEASUREMENT |
|
48 const unsigned int TIMEOUT_FACTOR = 2; |
|
49 #else |
|
50 const unsigned int TIMEOUT_FACTOR = 1; |
|
51 #endif |
|
52 |
|
53 class TTestsListener : public MCaInstallListener, public MMmcWatcherCallback |
|
54 { |
|
55 public: |
|
56 void HandleInstallNotifyL(TInt aEvent) |
|
57 { |
|
58 iStatus = ETrue; |
|
59 } |
|
60 |
|
61 virtual void MmcChangeL() |
|
62 { |
|
63 iStatus = ETrue; |
|
64 } |
|
65 |
|
66 TBool iStatus; |
|
67 }; |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 void T_caUsifScaner::testJavaStrategy() |
|
71 { |
|
72 bool result(false); |
|
73 |
|
74 TTestsListener listener; |
|
75 listener.iStatus = EFalse; |
|
76 |
|
77 TRAPD(err, |
|
78 RProperty property; |
|
79 CCaJavaInstallStrategy *installStrategy = |
|
80 CCaJavaInstallStrategy::NewL( property ); |
|
81 |
|
82 installStrategy->NotifyListenerL( property, listener ); |
|
83 result = installStrategy != NULL; |
|
84 delete installStrategy; |
|
85 property.Close(); |
|
86 ); |
|
87 QCOMPARE(err, KErrNone); |
|
88 QVERIFY(result); |
|
89 QVERIFY(listener.iStatus != EFalse); |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void T_caUsifScaner::testUsifStrategy() |
|
95 { |
|
96 |
|
97 bool result(false); |
|
98 |
|
99 TTestsListener listener; |
|
100 listener.iStatus = EFalse; |
|
101 |
|
102 TRAPD(err, |
|
103 RProperty property; |
|
104 CCaUsifUninstallStrategy *installStrategy = |
|
105 CCaUsifUninstallStrategy::NewL( property ); |
|
106 result = installStrategy != NULL; |
|
107 installStrategy->NotifyListenerL( property, listener ); |
|
108 |
|
109 delete installStrategy; |
|
110 property.Close(); |
|
111 ); |
|
112 QCOMPARE(err, KErrNone); |
|
113 QVERIFY(result); |
|
114 QVERIFY(listener.iStatus == EFalse); |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 void T_caUsifScaner::testSwiStrategy() |
|
120 { |
|
121 |
|
122 bool result(false); |
|
123 |
|
124 TTestsListener listener; |
|
125 listener.iStatus = EFalse; |
|
126 |
|
127 TRAPD(err, |
|
128 RProperty property; |
|
129 CCaSwiInstallStrategy *installStrategy = |
|
130 CCaSwiInstallStrategy::NewL( property ); |
|
131 |
|
132 installStrategy->NotifyListenerL( property, listener ); |
|
133 result = installStrategy != NULL; |
|
134 delete installStrategy; |
|
135 property.Close(); |
|
136 ); |
|
137 QCOMPARE(err, KErrNone); |
|
138 QVERIFY(result); |
|
139 QVERIFY(listener.iStatus != EFalse); |
|
140 } |
|
141 |
|
142 |
|
143 // END OF FILE |