|
1 // Copyright (c) 2007-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 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 #include <s32mem.h> |
|
25 #include "tsim_adaptationplugin_step.h" |
|
26 |
|
27 // |
|
28 // Run the tests |
|
29 // |
|
30 |
|
31 |
|
32 CTestSimAdaptationPlugin::CTestSimAdaptationPlugin() |
|
33 :CAdaptationTestBase(KTCTestSimAdaptationPlugin) |
|
34 { |
|
35 |
|
36 } |
|
37 |
|
38 CTestSimAdaptationPlugin::~CTestSimAdaptationPlugin() |
|
39 { |
|
40 |
|
41 } |
|
42 |
|
43 |
|
44 void CTestSimAdaptationPlugin::TestGetSimOwned() |
|
45 { |
|
46 INFO_PRINTF1(_L(" >CTestSimAdaptationPlugin::TestGetSimOwned")); |
|
47 |
|
48 TRequestStatus status; |
|
49 TPckgBuf <TInt> ownedPckg; |
|
50 |
|
51 iSsmSimAdaptation.GetSimOwned(ownedPckg, status); |
|
52 User::WaitForRequest(status); |
|
53 if(iSsmSimAdaptation.Handle()) |
|
54 { |
|
55 TEST(KErrNone == status.Int()); |
|
56 INFO_PRINTF3(_L("CTestSimAdaptationPlugin::TestGetSimOwned completed with %d error : expected %d>"),status.Int(),KErrNone); |
|
57 } |
|
58 else |
|
59 { |
|
60 TEST(KErrDisconnected == status.Int()); |
|
61 INFO_PRINTF3(_L("CTestSimAdaptationPlugin::TestGetSimOwned completed with %d error : expected %d>"),status.Int(),KErrDisconnected); |
|
62 } |
|
63 } |
|
64 |
|
65 void CTestSimAdaptationPlugin::TestGetCancel() |
|
66 { |
|
67 INFO_PRINTF1(_L(" >CTestSimAdaptationPlugin::TestGetCancel")); |
|
68 iSsmSimAdaptation.GetCancel(); |
|
69 INFO_PRINTF1(_L(" CTestSimAdaptationPlugin::TestGetCancel>")); |
|
70 } |
|
71 |
|
72 void CTestSimAdaptationPlugin::TestNotifySimEvent() |
|
73 { |
|
74 INFO_PRINTF1(_L(" >CTestSimAdaptationPlugin::TestNotifySimEvent")); |
|
75 |
|
76 TRequestStatus status; |
|
77 TPckgBuf <TInt> typePckg; |
|
78 typePckg = ESsmSimUsable; |
|
79 iSsmSimAdaptation.NotifySimEvent(typePckg, status); |
|
80 User::WaitForRequest(status); |
|
81 |
|
82 if(iSsmSimAdaptation.Handle()) |
|
83 { |
|
84 TEST(KErrNone == status.Int()); |
|
85 INFO_PRINTF3(_L("CTestSimAdaptationPlugin::TestNotifySimEvent completed with %d error : expected %d>"),status.Int(),KErrNone); |
|
86 } |
|
87 else |
|
88 { |
|
89 TEST(KErrDisconnected == status.Int()); |
|
90 INFO_PRINTF3(_L("CTestSimAdaptationPlugin::TestNotifySimEvent completed with %d error : expected %d>"),status.Int(),KErrDisconnected); |
|
91 } |
|
92 } |
|
93 |
|
94 void CTestSimAdaptationPlugin::TestNotifyCancel() |
|
95 { |
|
96 INFO_PRINTF1(_L(" >CTestSimAdaptationPlugin::TestNotifyCancel")); |
|
97 iSsmSimAdaptation.NotifyCancel(); |
|
98 INFO_PRINTF1(_L(" CTestSimAdaptationPlugin::TestNotifyCancel >")); |
|
99 } |
|
100 |
|
101 |
|
102 //from CAdaptationTestBase |
|
103 TVerdict CTestSimAdaptationPlugin::doTestStepL() |
|
104 { |
|
105 TInt err = KErrNone; |
|
106 |
|
107 __UHEAP_MARK; |
|
108 |
|
109 TRAP(err, TestGetSimOwned()); |
|
110 TEST(err == KErrNone); |
|
111 |
|
112 TRAP(err, TestNotifySimEvent()); |
|
113 TEST(err == KErrNone); |
|
114 |
|
115 TestNotifyCancel(); |
|
116 TestGetCancel(); |
|
117 |
|
118 User::LeaveIfError(iSsmSimAdaptation.Connect()); |
|
119 |
|
120 |
|
121 TRAP(err, TestGetSimOwned()); |
|
122 TEST(err == KErrNone); |
|
123 |
|
124 TRAP(err, TestNotifySimEvent()); |
|
125 TEST(err == KErrNone); |
|
126 |
|
127 TestNotifyCancel(); |
|
128 TestGetCancel(); |
|
129 //TestRelease(); // have to test this part too ... |
|
130 |
|
131 __UHEAP_MARKEND; |
|
132 |
|
133 return TestStepResult(); |
|
134 } |