|
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 // GetStore |
|
17 // [Action Parameters] |
|
18 // Entry <input>: Reference to the entry. |
|
19 // ReadOnly <optional>: Flag to indicate if read only access to store is required,default is 1. |
|
20 // Store <output>: Reference to store. |
|
21 // [Action Description] |
|
22 // Provides the store. |
|
23 // [APIs Used] |
|
24 // CMsvEntry::ReadStoreL |
|
25 // CMsvEntry::EditStoreL |
|
26 // __ACTION_INFO_END__ |
|
27 // |
|
28 // |
|
29 |
|
30 #include <e32std.h> |
|
31 |
|
32 #include "CMtfTestActionGetStore.h" |
|
33 #include "CMtfTestCase.h" |
|
34 #include "CMtfTestActionParameters.h" |
|
35 #include "MtfTestActionUtilsUser.h" |
|
36 |
|
37 #include <miutset.h> |
|
38 |
|
39 |
|
40 CMtfTestAction* CMtfTestActionGetStore::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
41 { |
|
42 CMtfTestActionGetStore* self = new(ELeave) CMtfTestActionGetStore(aTestCase); |
|
43 CleanupStack::PushL(self); |
|
44 self->ConstructL(aActionParameters); |
|
45 CleanupStack::Pop(); |
|
46 return self; |
|
47 } |
|
48 |
|
49 |
|
50 CMtfTestActionGetStore::CMtfTestActionGetStore(CMtfTestCase& aTestCase) |
|
51 : CMtfSynchronousTestAction(aTestCase) |
|
52 { |
|
53 } |
|
54 |
|
55 |
|
56 CMtfTestActionGetStore::~CMtfTestActionGetStore() |
|
57 { |
|
58 } |
|
59 |
|
60 void CMtfTestActionGetStore::ExecuteActionL() |
|
61 { |
|
62 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionAddGetStore); |
|
63 CMsvEntry* paramEntry = ObtainParameterReferenceL<CMsvEntry>(TestCase(),ActionParameters().Parameter(0)); |
|
64 TInt readOnlyStore = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1), 1); |
|
65 |
|
66 CMsvStore* store = NULL; |
|
67 |
|
68 if ( readOnlyStore == 1 ) |
|
69 { |
|
70 if (paramEntry->HasStoreL()) |
|
71 { |
|
72 store = paramEntry->ReadStoreL(); |
|
73 } |
|
74 else |
|
75 { |
|
76 User::Leave(KErrNotFound); |
|
77 } |
|
78 } |
|
79 else |
|
80 { |
|
81 store = paramEntry->EditStoreL(); |
|
82 } |
|
83 |
|
84 StoreParameterL<CMsvStore>(TestCase(),*store,ActionParameters().Parameter(2)); |
|
85 |
|
86 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionAddGetStore); |
|
87 TestCase().ActionCompletedL(*this); |
|
88 } |
|
89 |
|
90 |
|
91 |