|
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 "CMtfTestActionSendEMsvCopyStore.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 "SendProxyClient.h" |
|
26 #include "SendProxyserver.h" |
|
27 |
|
28 #include "CMtfTestCase.h" |
|
29 #include "CMtfTestActionParameters.h" |
|
30 |
|
31 #include "IPCCommandForCapsPermissions.h" |
|
32 |
|
33 |
|
34 |
|
35 /** |
|
36 Function : NewL |
|
37 Description : |
|
38 @internalTechnology |
|
39 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
40 @param : aActionParams - CMtfTestActionParameters |
|
41 @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionSendEMsvCopyStore object |
|
42 @pre none |
|
43 @post none |
|
44 */ |
|
45 CMtfTestAction* CMtfTestActionSendEMsvCopyStore::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
46 { |
|
47 CMtfTestActionSendEMsvCopyStore* self = new (ELeave) CMtfTestActionSendEMsvCopyStore(aTestCase); |
|
48 CleanupStack::PushL(self); |
|
49 self->ConstructL(aActionParameters); |
|
50 CleanupStack::Pop(self); |
|
51 return self; |
|
52 } |
|
53 |
|
54 /** |
|
55 Function : CMtfTestActionSendEMsvCopyStore |
|
56 Description : Constructor |
|
57 @internalTechnology |
|
58 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
59 @return : N/A |
|
60 @pre none |
|
61 @post none |
|
62 */ |
|
63 CMtfTestActionSendEMsvCopyStore::CMtfTestActionSendEMsvCopyStore(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase) |
|
64 { |
|
65 } |
|
66 |
|
67 /** |
|
68 Function : ~CMtfTestActionSendEMsvCopyStore |
|
69 Description : Destructor |
|
70 @internalTechnology |
|
71 @param : |
|
72 @return : |
|
73 @pre |
|
74 @post |
|
75 */ |
|
76 CMtfTestActionSendEMsvCopyStore::~CMtfTestActionSendEMsvCopyStore() |
|
77 { |
|
78 } |
|
79 |
|
80 /** |
|
81 Function : ExecuteActionL |
|
82 Description : Entry point for the this test action in the test framework |
|
83 @internalTechnology |
|
84 @param : none |
|
85 @return : void |
|
86 @pre none |
|
87 @post none |
|
88 */ |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 void CMtfTestActionSendEMsvCopyStore::ExecuteActionL() |
|
94 { |
|
95 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendEMsvCopyStore); |
|
96 // input params |
|
97 TInt drive = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(0) ); |
|
98 TInt pass = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1) ); |
|
99 |
|
100 RProxyServerSession RPSS; |
|
101 |
|
102 // Will auto start the server if not started. |
|
103 TInt error = RPSS.Connect(); |
|
104 CleanupClosePushL(RPSS); |
|
105 |
|
106 if (error!=KErrNone) |
|
107 { |
|
108 TestCase().ERR_PRINTF1(_L("CMtfTestActionSendEMsvCopyStore :: Unable to start proxy server. !")); |
|
109 TestCase().SetTestStepResult(EFail); |
|
110 } |
|
111 else |
|
112 { |
|
113 TInt32 serverCaps; |
|
114 RPSS.GetServerCapabilities(serverCaps); |
|
115 TestCase().INFO_PRINTF2(_L("Proxy Server has capabilities: %x"), serverCaps); |
|
116 |
|
117 error = 0; |
|
118 TDriveUnit driveUnit(drive); |
|
119 TMsvOp operationId=1; |
|
120 |
|
121 // initiate CopyStore |
|
122 error=RPSS.SendReceive(EMsvCopyStore , TIpcArgs(operationId, drive)); |
|
123 |
|
124 IPCCommandReportPassOrFailForCapsPermissions( TestCase(), KMsvServerName, error , pass ); |
|
125 |
|
126 // we're not interested in the result, just the policing check. |
|
127 // if successful we need to cancel the operation so we don't get a panic on exit. |
|
128 if (error == KErrNone) |
|
129 { |
|
130 TBuf8<64> complete; |
|
131 TInt ret =RPSS.SendReceive(EMsvCancelOperation, TIpcArgs(operationId, &complete ) ); |
|
132 if (ret>=0) |
|
133 { |
|
134 TestCase().INFO_PRINTF2(_L("Test Action %S: Cancelling outstanding operation successfully completed."), &KTestActionSendEMsvCopyStore); |
|
135 } |
|
136 else |
|
137 { // do we care if cancelling the operation fails? most likely not since we're only testing the |
|
138 TestCase().ERR_PRINTF3(_L("Test Action %S: Cancelling outstanding operation failed: [%d]!"), &KTestActionSendEMsvCopyStore, ret); |
|
139 } |
|
140 } |
|
141 } |
|
142 |
|
143 CleanupStack::Check(&RPSS); |
|
144 CleanupStack::PopAndDestroy(); |
|
145 |
|
146 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendEMsvCopyStore); |
|
147 TestCase().ActionCompletedL(*this); |
|
148 } |