|
1 // Copyright (c) 2004-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 #include "CMtfTestActionSendEMsvGetMtmRequiredCapabilities.h" |
|
17 |
|
18 #include <e32std.h> |
|
19 #include <e32base.h> |
|
20 |
|
21 #include <msvipc.h> |
|
22 #include "MCLIENT.H" |
|
23 #include "MSERVER.H" |
|
24 |
|
25 #include "CMtfTestCase.h" |
|
26 #include "CMtfTestActionParameters.h" |
|
27 |
|
28 #include "IPCCommandForCapsPermissions.h" |
|
29 #include "SendProxyClient.h" |
|
30 #include "SendProxyserver.h" |
|
31 |
|
32 |
|
33 /** |
|
34 Function : NewL |
|
35 Description : |
|
36 @internalTechnology |
|
37 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
38 @param : aActionParams - CMtfTestActionParameters |
|
39 @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionSendEMsvGetMtmRequiredCapabilities object |
|
40 @pre none |
|
41 @post none |
|
42 */ |
|
43 CMtfTestAction* CMtfTestActionSendEMsvGetMtmRequiredCapabilities::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
44 { |
|
45 CMtfTestActionSendEMsvGetMtmRequiredCapabilities* self = new (ELeave) CMtfTestActionSendEMsvGetMtmRequiredCapabilities(aTestCase); |
|
46 CleanupStack::PushL(self); |
|
47 self->ConstructL(aActionParameters); |
|
48 CleanupStack::Pop(self); |
|
49 return self; |
|
50 } |
|
51 |
|
52 /** |
|
53 Function : CMtfTestActionSendEMsvGetMtmRequiredCapabilities |
|
54 Description : Constructor |
|
55 @internalTechnology |
|
56 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
57 @return : N/A |
|
58 @pre none |
|
59 @post none |
|
60 */ |
|
61 CMtfTestActionSendEMsvGetMtmRequiredCapabilities::CMtfTestActionSendEMsvGetMtmRequiredCapabilities(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase) |
|
62 { |
|
63 } |
|
64 |
|
65 /** |
|
66 Function : ~CMtfTestActionSendEMsvGetMtmRequiredCapabilities |
|
67 Description : Destructor |
|
68 @internalTechnology |
|
69 @param : |
|
70 @return : |
|
71 @pre |
|
72 @post |
|
73 */ |
|
74 CMtfTestActionSendEMsvGetMtmRequiredCapabilities::~CMtfTestActionSendEMsvGetMtmRequiredCapabilities() |
|
75 { |
|
76 } |
|
77 |
|
78 /** |
|
79 Function : ExecuteActionL |
|
80 Description : Entry point for the this test action in the test framework |
|
81 @internalTechnology |
|
82 @param : none |
|
83 @return : void |
|
84 @pre none |
|
85 @post none |
|
86 */ |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 void CMtfTestActionSendEMsvGetMtmRequiredCapabilities::ExecuteActionL() |
|
92 { |
|
93 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendEMsvGetMtmRequiredCapabilities); |
|
94 // input params |
|
95 TUid mtmTypeUid = ObtainValueParameterL<TUid>(TestCase(),ActionParameters().Parameter(0) ); |
|
96 TInt pass = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1) ); |
|
97 |
|
98 RProxyServerSession RPSS; |
|
99 |
|
100 // Will auto start the server if not started. |
|
101 TInt error = RPSS.Connect(); |
|
102 CleanupClosePushL(RPSS); |
|
103 |
|
104 if (error!=KErrNone) |
|
105 { |
|
106 TestCase().ERR_PRINTF1(_L("CMtfTestActionSendEMsvGetMtmRequiredCapabilities :: Unable to start proxy server. !")); |
|
107 TestCase().SetTestStepResult(EFail); |
|
108 } |
|
109 else |
|
110 { |
|
111 TInt32 serverCaps; |
|
112 RPSS.GetServerCapabilities(serverCaps); |
|
113 TestCase().INFO_PRINTF2(_L("Proxy Server has capabilities: %x"), serverCaps); |
|
114 |
|
115 HBufC8* buffer = HBufC8::NewLC(KMsvSessionBufferLength); |
|
116 if (buffer==NULL) |
|
117 { |
|
118 TestCase().ERR_PRINTF1(_L("CMtfTestActionSendEMsvChangeAttributes :: Unable to allocate mem. !")); |
|
119 TestCase().SetTestStepResult(EFail); |
|
120 } |
|
121 else |
|
122 { |
|
123 error = 0; |
|
124 |
|
125 TPtr8 pCapSet = buffer->Des(); |
|
126 |
|
127 error=RPSS.SendReceive(EMsvGetMtmRequiredCapabilities , TIpcArgs(mtmTypeUid.iUid, &pCapSet)); |
|
128 |
|
129 IPCCommandReportPassOrFailForCapsPermissions( TestCase(), KMsvServerName, error , pass ); |
|
130 |
|
131 CleanupStack::PopAndDestroy(buffer); |
|
132 } |
|
133 } |
|
134 |
|
135 CleanupStack::Check(&RPSS); |
|
136 CleanupStack::PopAndDestroy(); // RPSS |
|
137 |
|
138 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendEMsvGetMtmRequiredCapabilities); |
|
139 TestCase().ActionCompletedL(*this); |
|
140 } |