|
1 // Copyright (c) 2001-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 // |
|
15 |
|
16 |
|
17 |
|
18 // INCLUDES |
|
19 #include "ctlbsclientpostp11.h" |
|
20 #include "ctlbsclientobserver.h" |
|
21 #include <eikenv.h> |
|
22 |
|
23 |
|
24 // ================= MEMBER FUNCTIONS ======================= |
|
25 |
|
26 // --------------------------------------------------------- |
|
27 // Constructor. |
|
28 // --------------------------------------------------------- |
|
29 CT_LbsClientPosTp11::CT_LbsClientPosTp11(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) |
|
30 { |
|
31 _LIT(KTestName, "TP11 - EPos start and termination"); |
|
32 SetTestStepName(KTestName); |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------- |
|
36 // Destructor. |
|
37 // --------------------------------------------------------- |
|
38 CT_LbsClientPosTp11::~CT_LbsClientPosTp11() |
|
39 { |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------- |
|
43 // CT_LbsClientPosTp11::CheckEPosActivityL |
|
44 // |
|
45 // (other items were commented in a header). |
|
46 // --------------------------------------------------------- |
|
47 // |
|
48 void CT_LbsClientPosTp11::CheckEPosActivityL(TBool aExpectEPosLiveness) |
|
49 { |
|
50 if (aExpectEPosLiveness && !CT_LbsClientObserver::EPosAliveL()) |
|
51 { |
|
52 _LIT(KError, "Expected EPos server to be alive but it wasn't"); |
|
53 LogErrorAndLeaveL(KError); |
|
54 } |
|
55 if (!aExpectEPosLiveness && CT_LbsClientObserver::EPosAliveL()) |
|
56 { |
|
57 _LIT(KError, "Expected EPos server to be dead but it wasn't"); |
|
58 LogErrorAndLeaveL(KError); |
|
59 } |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------- |
|
63 // CT_LbsClientPosTp11::ServerAliveL |
|
64 // |
|
65 // (other items were commented in a header). |
|
66 // --------------------------------------------------------- |
|
67 // |
|
68 TBool CT_LbsClientPosTp11::ServerAliveL(const TDesC& aServerName) |
|
69 { |
|
70 TFindServer find(aServerName); |
|
71 TFullName name; |
|
72 if (find.Next(name) == KErrNone) // server found |
|
73 { |
|
74 TBuf<100> buf; |
|
75 _LIT(KFoundServer, "Found server: "); |
|
76 buf.Append(KFoundServer); |
|
77 buf.Append(name); |
|
78 INFO_PRINTF1(buf); |
|
79 return ETrue; |
|
80 } |
|
81 else |
|
82 { |
|
83 return EFalse; |
|
84 } |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------- |
|
88 // CT_LbsClientPosTp11::StartL |
|
89 // |
|
90 // (other items were commented in a header). |
|
91 // --------------------------------------------------------- |
|
92 // |
|
93 void CT_LbsClientPosTp11::StartL() |
|
94 { |
|
95 const TInt KTimeEPosIsStillActive = 1000000; |
|
96 const TInt KTimeEPosHasShutDown = 4000000; |
|
97 |
|
98 User::After(2000000); |
|
99 |
|
100 CT_LbsClientObserver::WaitForEPosShutdown(); |
|
101 |
|
102 RPositionServer client1; |
|
103 RPositionServer client2; |
|
104 RPositionServer client3; |
|
105 |
|
106 CheckEPosActivityL(EFalse); |
|
107 |
|
108 User::LeaveIfError(client1.Connect()); |
|
109 CleanupClosePushL(client1); |
|
110 CheckEPosActivityL(ETrue); |
|
111 |
|
112 User::LeaveIfError(client2.Connect()); |
|
113 CleanupClosePushL(client2); |
|
114 CheckEPosActivityL(ETrue); |
|
115 |
|
116 User::LeaveIfError(client3.Connect()); |
|
117 CleanupClosePushL(client3); |
|
118 CheckEPosActivityL(ETrue); |
|
119 |
|
120 client1.Close(); |
|
121 CheckEPosActivityL(ETrue); |
|
122 client2.Close(); |
|
123 CheckEPosActivityL(ETrue); |
|
124 client3.Close(); |
|
125 |
|
126 User::After(TTimeIntervalMicroSeconds32(KTimeEPosIsStillActive)); |
|
127 CheckEPosActivityL(ETrue); |
|
128 User::After(TTimeIntervalMicroSeconds32( |
|
129 KTimeEPosHasShutDown - KTimeEPosIsStillActive)); |
|
130 CheckEPosActivityL(EFalse); |
|
131 |
|
132 CleanupStack::Pop(3); // client1-3 |
|
133 } |