|
1 // Copyright (c) 2006-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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // @file ctlbsclientstepsrvversion.cpp |
|
15 // This is the class implementation for the Server Version Tests |
|
16 // |
|
17 // |
|
18 |
|
19 #include "ctlbsclientstepsrvversion.h" |
|
20 |
|
21 #include <lbs.h> |
|
22 |
|
23 |
|
24 _LIT(Ksrvvermajor, "srv_ver_major"); |
|
25 _LIT(Ksrvverminor, "srv_ver_minor"); |
|
26 _LIT(Ksrvverbuild, "srv_ver_build"); |
|
27 |
|
28 |
|
29 /** |
|
30 * Destructor |
|
31 */ |
|
32 CT_LbsClientStep_SrvVersion::~CT_LbsClientStep_SrvVersion() |
|
33 { |
|
34 } |
|
35 |
|
36 |
|
37 /** |
|
38 * Constructor |
|
39 */ |
|
40 CT_LbsClientStep_SrvVersion::CT_LbsClientStep_SrvVersion(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent) |
|
41 { |
|
42 SetTestStepName(KLbsClientStep_SrvVersion); |
|
43 } |
|
44 |
|
45 |
|
46 /** |
|
47 Static Constructor |
|
48 */ |
|
49 CT_LbsClientStep_SrvVersion* CT_LbsClientStep_SrvVersion::New(CT_LbsClientServer& aParent) |
|
50 { |
|
51 return new CT_LbsClientStep_SrvVersion(aParent); |
|
52 // Note the lack of ELeave. |
|
53 // This means that having insufficient memory will return NULL; |
|
54 } |
|
55 |
|
56 |
|
57 |
|
58 /** |
|
59 * @return - TVerdict code |
|
60 * Override of base class pure virtual |
|
61 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
62 * not leave. That being the case, the current test result value will be EPass. |
|
63 */ |
|
64 TVerdict CT_LbsClientStep_SrvVersion::doTestStepL() |
|
65 { |
|
66 // Generic test step used to test the LBS Client server open and close APIs. |
|
67 INFO_PRINTF1(_L(">>CT_LbsClientStep_SrvVersion::doTestStepL()")); |
|
68 |
|
69 if (TestStepResult() == EPass) |
|
70 { |
|
71 RPositionServer server; |
|
72 TInt err = KErrNone; |
|
73 |
|
74 // Carryout common test action. |
|
75 err = server.Connect(); |
|
76 if (KErrNone == err) |
|
77 { |
|
78 INFO_PRINTF1(_L("server opened")); |
|
79 |
|
80 // Carryout unique test actions. |
|
81 // Test case LBS-APIVersion-0001 |
|
82 |
|
83 TVersion serverversion; |
|
84 serverversion = server.Version(); |
|
85 TInt MajorVersionNumber = 0; |
|
86 TInt MinorVersionNumber = 0; |
|
87 TInt BuildVersionNumber = 0; |
|
88 if(!(GetIntFromConfig(ConfigSection(), Ksrvvermajor, MajorVersionNumber) && |
|
89 GetIntFromConfig(ConfigSection(), Ksrvverminor, MinorVersionNumber) && |
|
90 GetIntFromConfig(ConfigSection(), Ksrvverbuild, BuildVersionNumber))) |
|
91 { |
|
92 INFO_PRINTF1(_L("Bad ini file Build info.")); |
|
93 User::Leave(KErrArgument); |
|
94 } |
|
95 |
|
96 //Check expected Version matches tested version |
|
97 if (MajorVersionNumber == static_cast<TInt>(serverversion.iMajor) && |
|
98 MinorVersionNumber == static_cast<TInt>(serverversion.iMinor) && |
|
99 BuildVersionNumber == static_cast<TInt>(serverversion.iBuild)) |
|
100 { |
|
101 INFO_PRINTF1(_L("Expected Version Matches")); |
|
102 } |
|
103 else |
|
104 { |
|
105 INFO_PRINTF1(_L("Expected Version Differs")); |
|
106 SetTestStepResult(EFail); |
|
107 } |
|
108 |
|
109 } |
|
110 else |
|
111 { |
|
112 INFO_PRINTF1(_L("server failed to open")); |
|
113 SetTestStepResult(EFail); |
|
114 } |
|
115 |
|
116 |
|
117 // Carryout final common test action. |
|
118 if (KErrNone == err) |
|
119 { |
|
120 server.Close(); |
|
121 } |
|
122 } |
|
123 |
|
124 INFO_PRINTF1(_L("<<CT_LbsClientStep_SrvVersion::doTestStepL()")); |
|
125 |
|
126 return TestStepResult(); |
|
127 } |