|
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 // __ACTION_INFO_BEGIN__ |
|
15 // [Action Name] |
|
16 // SendAsGetAvailableAccounts |
|
17 // [Action Parameters] |
|
18 // RSendAs paramSendAs <input> : Reference to the RSendAs object |
|
19 // TUid paramMessageType <input> : Message type ID |
|
20 // CSendAsAccounts availableAccounts <output>: CSendAsAccounts object |
|
21 // [Action Description] |
|
22 // Gets the list of available accounts for the specified message type. |
|
23 // [APIs Used] |
|
24 // RSendAs::AvailableAccountsL (TUid aMessagType, CSendAsAccounts& Accounts) |
|
25 // __ACTION_INFO_END__ |
|
26 // |
|
27 // |
|
28 |
|
29 /** |
|
30 @file |
|
31 @internalTechnology |
|
32 */ |
|
33 |
|
34 |
|
35 // User include |
|
36 #include "CMtfTestActionSendAsGetAvailableAccounts.h" |
|
37 #include "CMtfTestCase.h" |
|
38 #include "CMtfTestActionParameters.h" |
|
39 |
|
40 |
|
41 /** |
|
42 NewL() |
|
43 Constructs a CMtfTestActionSendAsGetAvailableAccounts object. |
|
44 Uses two phase construction and leaves nothing on the CleanupStack. |
|
45 @internalTechnology |
|
46 @param aTestCase Test Case to which this Test Action belongs |
|
47 @param aActionParameters Action parameters, must not be NULL |
|
48 @return Created object of type CMtfTestActionSendAsGetAvailableAccounts |
|
49 @pre None |
|
50 @post CMtfTestActionSendAsGetAvailableAccounts object is created |
|
51 */ |
|
52 CMtfTestAction* CMtfTestActionSendAsGetAvailableAccounts:: |
|
53 NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
54 { |
|
55 CMtfTestActionSendAsGetAvailableAccounts* self = |
|
56 new (ELeave) CMtfTestActionSendAsGetAvailableAccounts(aTestCase); |
|
57 |
|
58 CleanupStack::PushL(self); |
|
59 self->ConstructL(aActionParameters); |
|
60 CleanupStack::Pop(self); |
|
61 return self; |
|
62 } |
|
63 |
|
64 |
|
65 /** |
|
66 CMtfTestActionSendAsGetAvailableAccounts constructor |
|
67 Calls the base class' constructor |
|
68 @internalTechnology |
|
69 @param aTestCase Test Case to which this Test Action belongs |
|
70 @pre None |
|
71 @post None |
|
72 */ |
|
73 CMtfTestActionSendAsGetAvailableAccounts::CMtfTestActionSendAsGetAvailableAccounts(CMtfTestCase& aTestCase) |
|
74 : CMtfSynchronousTestAction(aTestCase) |
|
75 { |
|
76 } |
|
77 |
|
78 /** |
|
79 Function : ~CMtfTestActionSendAsGetAvailableAccounts |
|
80 Description : Destructor |
|
81 @internalTechnology |
|
82 @param : |
|
83 @return : |
|
84 @pre |
|
85 @post |
|
86 */ |
|
87 CMtfTestActionSendAsGetAvailableAccounts::~CMtfTestActionSendAsGetAvailableAccounts() |
|
88 { |
|
89 } |
|
90 |
|
91 /** |
|
92 ExecuteActionL |
|
93 Gets the list of available accounts for the specified messag type |
|
94 @internalTechnology |
|
95 @pre None |
|
96 @post None |
|
97 @leave System wide errors |
|
98 */ |
|
99 void CMtfTestActionSendAsGetAvailableAccounts::ExecuteActionL() |
|
100 { |
|
101 if((TestCase().TestStepResult()) == EPass) |
|
102 { |
|
103 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendAsGetAvailableAccounts); |
|
104 |
|
105 // Get test action input parameters |
|
106 RSendAs paramSendAs = ObtainValueParameterL<RSendAs>(TestCase(), |
|
107 ActionParameters().Parameter(0)); |
|
108 |
|
109 TUid paramMessageType = ObtainValueParameterL<TUid>(TestCase(), |
|
110 ActionParameters().Parameter(1)); |
|
111 |
|
112 CSendAsAccounts* availableAccounts = CSendAsAccounts::NewL(); |
|
113 |
|
114 // Get available accounts info |
|
115 TRAPD(err, paramSendAs.AvailableAccountsL(paramMessageType,*availableAccounts)); |
|
116 |
|
117 if( err == KErrNone ) |
|
118 { |
|
119 StoreParameterL<CSendAsAccounts>(TestCase(),*availableAccounts, |
|
120 ActionParameters().Parameter(2)); |
|
121 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendAsGetAvailableAccounts); |
|
122 } |
|
123 else |
|
124 { |
|
125 TestCase().ERR_PRINTF2(_L("Getting AvailableAccounts failed with err %d "), err); |
|
126 TestCase().SetTestStepResult(EFail); |
|
127 } |
|
128 } |
|
129 |
|
130 TestCase().ActionCompletedL(*this); |
|
131 } |
|
132 |