common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp93.cpp
changeset 748 e13acd883fbe
child 872 17498133d9ad
equal deleted inserted replaced
747:76f9aaeefbab 748:e13acd883fbe
       
     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 "ctlbsclientpostp93.h"
       
    20 #include "ctlbsclientperiodictester.h"
       
    21 
       
    22 // CONSTANTS
       
    23 _LIT(KServiceName1, " aaaaaaaaaaa");
       
    24 _LIT(KServiceName2, " bbbbbbbbbbb");
       
    25 _LIT(KServiceName3, " ccccccccccc");
       
    26 
       
    27 // ================= MEMBER FUNCTIONS =======================
       
    28 
       
    29 // ---------------------------------------------------------
       
    30 // Constructor.
       
    31 // ---------------------------------------------------------
       
    32 CT_LbsClientPosTp93::CT_LbsClientPosTp93(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent)
       
    33 	{  
       
    34 	_LIT(KTestName,"TP93 - Periodic Updates, Multiple clients");
       
    35 	SetTestStepName(KTestName); 
       
    36 	}
       
    37 
       
    38 // ---------------------------------------------------------
       
    39 // Destructor.
       
    40 // ---------------------------------------------------------
       
    41 CT_LbsClientPosTp93::~CT_LbsClientPosTp93()
       
    42 	{
       
    43 	}
       
    44 
       
    45 // ---------------------------------------------------------
       
    46 // CT_LbsClientPosTp93::CloseTest
       
    47 //
       
    48 // (other items were commented in a header).
       
    49 // ---------------------------------------------------------
       
    50 //
       
    51 void CT_LbsClientPosTp93::CloseTest()
       
    52     {
       
    53 	iRequestArray.Reset();
       
    54 	iNameArray.Reset();
       
    55 	iRequestArray.Close();
       
    56 	iNameArray.Close();
       
    57 
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------
       
    61 // CT_LbsClientPosTp93::StartL
       
    62 //
       
    63 // (other items were commented in a header).
       
    64 // ---------------------------------------------------------
       
    65 //
       
    66 void CT_LbsClientPosTp93::StartL()
       
    67     {
       
    68 	SetupPsyL(iUidMultiPsy);
       
    69 	
       
    70 	TPtrC name1(KServiceName1);
       
    71 	TPtrC name2(KServiceName2);
       
    72 	TPtrC name3(KServiceName3);
       
    73 	
       
    74 	iNameArray.Append(name1);
       
    75 	iNameArray.Append(name2);
       
    76 	iNameArray.Append(name3);
       
    77 
       
    78 	TInt numberOfRuns = 25;
       
    79 	TTimeIntervalMicroSeconds interval1 = TTimeIntervalMicroSeconds(1000000);
       
    80 	TTimeIntervalMicroSeconds interval3 = TTimeIntervalMicroSeconds(3000000);
       
    81 	TTimeIntervalMicroSeconds interval5 = TTimeIntervalMicroSeconds(5000000);
       
    82 	TTimeIntervalMicroSeconds interval11 = TTimeIntervalMicroSeconds(11000000);
       
    83 	TTimeIntervalMicroSeconds interval13 = TTimeIntervalMicroSeconds(13000000);
       
    84 	TTimeIntervalMicroSeconds interval17 = TTimeIntervalMicroSeconds(17000000);
       
    85 
       
    86 	
       
    87 	TUid uid = iUidMultiPsy;
       
    88     TInt errorsFound = KErrNone;
       
    89 	
       
    90 	CT_LbsClientPeriodicTester* periodicTester1 = 
       
    91 					CT_LbsClientPeriodicTester::NewL(interval1, 
       
    92 														KServiceName1, 
       
    93 														iLog, 
       
    94 														uid, 
       
    95 														numberOfRuns);
       
    96 	CleanupStack::PushL(periodicTester1);
       
    97 
       
    98 	CT_LbsClientPeriodicTester* periodicTester2 = 
       
    99 					CT_LbsClientPeriodicTester::NewL(interval3, 
       
   100 														KServiceName2, 
       
   101 														iLog, 
       
   102 														uid, 
       
   103 														numberOfRuns);
       
   104 	CleanupStack::PushL(periodicTester2);
       
   105 
       
   106 	CT_LbsClientPeriodicTester* periodicTester3 = 
       
   107 					CT_LbsClientPeriodicTester::NewL(interval5, 
       
   108 														KServiceName3, 
       
   109 														iLog, 
       
   110 														uid, 
       
   111 														numberOfRuns);
       
   112 	CleanupStack::PushL(periodicTester3);
       
   113 
       
   114 	periodicTester1->RequestNotification();
       
   115 	periodicTester2->RequestNotification();
       
   116 	periodicTester3->RequestNotification();
       
   117 
       
   118 	// Active scheduler is stopped three times.
       
   119 	CActiveScheduler::Start();
       
   120 	CActiveScheduler::Start();
       
   121 	CActiveScheduler::Start();
       
   122 
       
   123     if (!periodicTester1->IsCompletedOK() || 
       
   124     		!periodicTester2->IsCompletedOK() || 
       
   125     		!periodicTester3->IsCompletedOK())
       
   126         {
       
   127         _LIT(KErr, "ERROR: periodicTester1-3 returned error");
       
   128         INFO_PRINTF1(KErr);
       
   129         errorsFound++;
       
   130         }
       
   131 
       
   132 	CleanupStack::PopAndDestroy(3, periodicTester1);
       
   133 	
       
   134 	CT_LbsClientPeriodicTester* periodicTester4 = 
       
   135 						CT_LbsClientPeriodicTester::NewL(interval3, 
       
   136 															KServiceName1, 
       
   137 															iLog, 
       
   138 															uid, 
       
   139 															numberOfRuns);
       
   140 	CleanupStack::PushL(periodicTester4);
       
   141 
       
   142 	CT_LbsClientPeriodicTester* periodicTester5 = 
       
   143 						CT_LbsClientPeriodicTester::NewL(interval3, 
       
   144 															KServiceName2, 
       
   145 															iLog, 
       
   146 															uid, 
       
   147 															numberOfRuns);
       
   148 	CleanupStack::PushL(periodicTester5);
       
   149 
       
   150 	CT_LbsClientPeriodicTester* periodicTester6 = 
       
   151 						CT_LbsClientPeriodicTester::NewL(interval3, 
       
   152 															KServiceName3, 
       
   153 															iLog, 
       
   154 															uid, 
       
   155 															numberOfRuns);
       
   156 	CleanupStack::PushL(periodicTester6);
       
   157 
       
   158 	periodicTester4->RequestNotification();
       
   159 	periodicTester5->RequestNotification();
       
   160 	periodicTester6->RequestNotification();
       
   161 
       
   162 	// Active scheduler is stopped three times.
       
   163 	CActiveScheduler::Start();
       
   164 	CActiveScheduler::Start();
       
   165 	CActiveScheduler::Start();
       
   166 
       
   167     if (!periodicTester4->IsCompletedOK() || 
       
   168     		!periodicTester5->IsCompletedOK() || 
       
   169     		!periodicTester6->IsCompletedOK())
       
   170         {
       
   171         _LIT(KErr, "ERROR: periodicTester4-6 returned error");
       
   172         INFO_PRINTF1(KErr);
       
   173         errorsFound++;
       
   174         }
       
   175 
       
   176 	CleanupStack::PopAndDestroy(3, periodicTester4);
       
   177 	
       
   178 	CT_LbsClientPeriodicTester* periodicTester7 = 
       
   179 						CT_LbsClientPeriodicTester::NewL(interval11, 
       
   180 															KServiceName1, 
       
   181 															iLog, 
       
   182 															uid, 
       
   183 															numberOfRuns);
       
   184 	CleanupStack::PushL(periodicTester7);
       
   185 
       
   186 	CT_LbsClientPeriodicTester* periodicTester8 = 
       
   187 						CT_LbsClientPeriodicTester::NewL(interval13, 
       
   188 															KServiceName2, 
       
   189 															iLog, 
       
   190 															uid, 
       
   191 															numberOfRuns);
       
   192 	CleanupStack::PushL(periodicTester8);
       
   193 
       
   194 	CT_LbsClientPeriodicTester* periodicTester9 = 
       
   195 						CT_LbsClientPeriodicTester::NewL(interval17, 
       
   196 															KServiceName3, 
       
   197 															iLog, 
       
   198 															uid, 
       
   199 															numberOfRuns);
       
   200 	CleanupStack::PushL(periodicTester9);
       
   201 
       
   202 	periodicTester7->RequestNotification();
       
   203 	periodicTester8->RequestNotification();
       
   204 	periodicTester9->RequestNotification();
       
   205 
       
   206 	// Active scheduler is stopped three times.
       
   207 	CActiveScheduler::Start();
       
   208 	CActiveScheduler::Start();
       
   209 	CActiveScheduler::Start();
       
   210 
       
   211     if (!periodicTester7->IsCompletedOK() || 
       
   212     		!periodicTester8->IsCompletedOK() || 
       
   213     		!periodicTester9->IsCompletedOK())
       
   214         {
       
   215         _LIT(KErr, "ERROR : periodicTester7-9 returned error");
       
   216         INFO_PRINTF1(KErr);
       
   217         errorsFound++;
       
   218         }
       
   219 
       
   220 	CleanupStack::PopAndDestroy(3, periodicTester7);
       
   221 
       
   222     if (errorsFound != KErrNone)
       
   223         {
       
   224         _LIT(KErr, "Errors returned from some periodicTester");
       
   225         LogErrorAndLeaveL(KErr);
       
   226         }
       
   227 	}
       
   228 
       
   229 // End of File