|
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 // CheckSmsService |
|
17 // [Action Parameters] |
|
18 // CMsvSession Session <input>: Reference to the session. |
|
19 // [Action Description] |
|
20 // Checks to see if an SMS service has been created. |
|
21 // __ACTION_INFO_END__ |
|
22 // |
|
23 // |
|
24 |
|
25 /** |
|
26 @file |
|
27 */ |
|
28 |
|
29 |
|
30 #include "CMtfTestActionCheckSmsService.h" |
|
31 #include "CMtfTestCase.h" |
|
32 #include "CMtfTestActionParameters.h" |
|
33 #include "MtfTestActionUtilsUser.h" |
|
34 |
|
35 #include <smut.h> |
|
36 #include <msvstd.h> |
|
37 #include <miutset.h> |
|
38 #include <msvapi.h> |
|
39 |
|
40 |
|
41 _LIT(KDetails, "Short Message"); |
|
42 _LIT(KDescription, ""); |
|
43 const TInt KPriority = 1; |
|
44 const TInt KReadOnlyFlag = EFalse; |
|
45 const TInt KVisibleFlag = EFalse; |
|
46 |
|
47 |
|
48 CMtfTestAction* CMtfTestActionCheckSmsService::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
49 { |
|
50 CMtfTestActionCheckSmsService* self = new (ELeave) CMtfTestActionCheckSmsService(aTestCase); |
|
51 CleanupStack::PushL(self); |
|
52 self->ConstructL(aActionParameters); |
|
53 CleanupStack::Pop(); |
|
54 return self; |
|
55 } |
|
56 |
|
57 CMtfTestActionCheckSmsService::CMtfTestActionCheckSmsService(CMtfTestCase& aTestCase) |
|
58 : CMtfTestAction(aTestCase) |
|
59 { |
|
60 } |
|
61 |
|
62 |
|
63 CMtfTestActionCheckSmsService::~CMtfTestActionCheckSmsService() |
|
64 { |
|
65 Cancel(); |
|
66 delete iOperation; |
|
67 } |
|
68 |
|
69 void CMtfTestActionCheckSmsService::ExecuteActionL() |
|
70 { |
|
71 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCheckSmsService); |
|
72 TInt err; |
|
73 CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0)); |
|
74 TRAP(err, TSmsUtilities::ServiceIdL(*paramSession,iSmsServiceId)); |
|
75 if (err == KErrNone) |
|
76 { |
|
77 CMsvEntry* service = paramSession->GetEntryL(iSmsServiceId); |
|
78 CleanupStack::PushL(service); |
|
79 |
|
80 if (service->Entry().Priority() != KPriority || |
|
81 service->Entry().ReadOnly() != KReadOnlyFlag || |
|
82 service->Entry().Visible() != KVisibleFlag || |
|
83 (service->Entry().iDescription.CompareF(KDescription()) != 0 ) || |
|
84 (service->Entry().iDetails.CompareF(KDetails()) != 0)) |
|
85 { |
|
86 // failed |
|
87 TestCase().ERR_PRINTF1(_L("SMS service fields don't match !")); |
|
88 TestCase().SetTestStepResult(EFail); |
|
89 } |
|
90 |
|
91 CleanupStack::PopAndDestroy(service); |
|
92 } |
|
93 else if (err == KErrNotFound) |
|
94 { |
|
95 // failed |
|
96 TestCase().ERR_PRINTF1(_L("SMS service doeesn't exist !")); |
|
97 TestCase().SetTestStepResult(EFail); |
|
98 } |
|
99 else |
|
100 { |
|
101 User::LeaveIfError(err); |
|
102 } |
|
103 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCheckSmsService); |
|
104 TestCase().ActionCompletedL(*this); |
|
105 } |
|
106 |
|
107 void CMtfTestActionCheckSmsService::DoCancel() |
|
108 { |
|
109 iOperation->Cancel(); |
|
110 } |
|
111 |
|
112 void CMtfTestActionCheckSmsService::RunL() |
|
113 { |
|
114 TInt err = MtfTestActionUtilsUser::FinalProgressStatus(*iOperation, iStatus); |
|
115 User::LeaveIfError(err); |
|
116 |
|
117 TPckgBuf<TMsvLocalOperationProgress> progress; |
|
118 progress.Copy(iOperation->FinalProgress()); |
|
119 |
|
120 TestCase().ActionCompletedL(*this); |
|
121 } |
|
122 |