os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-server/uloggerservertest1step.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-server/uloggerservertest1step.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1008 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Example CTestStep derived implementation
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file UloggerServerTest1Step.cpp
1.23 + @internalTechnology
1.24 +*/
1.25 +#include "uloggerservertest1step.h"
1.26 +#include "te_uloggerservertestsuitedefs.h"
1.27 +#include "uloggerserver.h"
1.28 +#include <e32const.h>
1.29 +using namespace Ulogger;
1.30 +
1.31 +
1.32 +CUloggerServerTest1Step::~CUloggerServerTest1Step()
1.33 +/**
1.34 + * Destructor
1.35 + */
1.36 + {
1.37 + }
1.38 +
1.39 +CUloggerServerTest1Step::CUloggerServerTest1Step()
1.40 +/**
1.41 + * Constructor
1.42 + */
1.43 + {
1.44 + // **MUST** call SetTestStepName in the constructor as the controlling
1.45 + // framework uses the test step name immediately following construction to set
1.46 + // up the step's unique logging ID.
1.47 + SetTestStepName(KUloggerServerTest1Step);
1.48 + }
1.49 +
1.50 +TVerdict CUloggerServerTest1Step::doTestStepPreambleL()
1.51 +/**
1.52 + * @return - TVerdict code
1.53 + * Override of base class virtual
1.54 + */
1.55 + {
1.56 + iScheduler = new (ELeave) CActiveScheduler();
1.57 + CActiveScheduler::Install(iScheduler);
1.58 +
1.59 + SetTestStepResult(EPass);
1.60 + return TestStepResult();
1.61 + }
1.62 +
1.63 +
1.64 +TVerdict CUloggerServerTest1Step::doTestStepL()
1.65 + {
1.66 + iErrors = 0;
1.67 + if (TestStepResult()==EPass)
1.68 + {
1.69 + iErrors += Test1L();//CULoggerServer::NewLC
1.70 + iErrors += Test2L();//CULoggerServer::IncrementSessions
1.71 + iErrors += Test3L();//CULoggerServer::Stop
1.72 + iErrors += Test4L();//CULoggerServer::GetPrimaryFilters
1.73 + iErrors += Test5L();//CULoggerServer::GetSecondaryFilters
1.74 + iErrors += Test6L();//CULoggerServer::RemoveFilterfromConfig
1.75 + iErrors += Test7L();//CULoggerServer::EnablePrimaryFilter
1.76 + iErrors += Test8L();//CULoggerServer::SetSecondaryFilter
1.77 + iErrors += Test9L();//CULoggerServer::Start
1.78 + iErrors += Test12L();//CULoggerServer::SetActiveOutputMedia
1.79 + iErrors += Test13L();//CULoggerServer::SetOutputPluginSettings
1.80 + iErrors += Test14L();//CULoggerServer::GetActiveOutput
1.81 + iErrors += Test15L();//CULoggerServer::GetInstalledPlugins
1.82 + iMediaCount = 0;
1.83 + iErrors += Test16L();//CULoggerServer::GetOutputPluginSettingsL
1.84 + iErrors += Test18L();//CULoggerServer::SetBufferSizeL
1.85 + iErrors += Test19L();//CULoggerServer::SetDataNotificationSizeL
1.86 + iErrors += Test20L();//CULoggerServer::GetBufferSize
1.87 + iErrors += Test21L();// CULoggerServer::GetDataNotificationSize
1.88 + iErrors += Test22L();//CULoggerServer::SetGlobalSecondaryFilters
1.89 + iErrors += Test23L();//CULoggerServer::ReadBufferL
1.90 + iErrors += Test25L();//CULoggerServer::SetBufferMode
1.91 + iErrors += Test26L();//CULoggerServer::UnconfigureCurrentChannel
1.92 + iErrors += Test27L();//CULoggerServer::DoPostProcessing
1.93 + iErrors += Test28L();//CULoggerServer::RemoveOutputPluginSettingsL
1.94 + iErrors += Test29L();//CULoggerServer::GetInstalledControlPlugins
1.95 + iErrors += Test30L();//CULoggerServer::SetActiveControlMedia
1.96 + iErrors += Test31L();//CULoggerServer::ProcessCommandL
1.97 +
1.98 + //display results
1.99 + TBuf<128> res;
1.100 + res.AppendFormat(_L("%d errors"), iErrors);
1.101 + INFO_PRINTF1(_L("****Results****"));
1.102 + INFO_PRINTF1(res);
1.103 + if(iErrors == 0)
1.104 + SetTestStepResult(EPass);
1.105 + else
1.106 + SetTestStepResult(EFail);
1.107 + }
1.108 + return TestStepResult();
1.109 + }
1.110 +
1.111 +
1.112 +
1.113 +TVerdict CUloggerServerTest1Step::doTestStepPostambleL()
1.114 +/**
1.115 + * @return - TVerdict code
1.116 + * Override of base class virtual
1.117 + */
1.118 + {
1.119 + delete iScheduler;
1.120 + iScheduler = NULL;
1.121 + return TestStepResult();
1.122 + }
1.123 +
1.124 +TInt CUloggerServerTest1Step::Test1L()
1.125 +{//CULoggerServer::NewLC
1.126 + TInt errors = 0;
1.127 + INFO_PRINTF1(_L("Testing - CULoggerServer::NewLC method"));
1.128 + CULoggerServer *server = NULL;
1.129 + server = CULoggerServer::NewLC(EPriorityBackground);
1.130 + if(server == NULL)
1.131 + {
1.132 + INFO_PRINTF1(_L("error"));
1.133 + ++errors;
1.134 + }
1.135 + else
1.136 + CleanupStack::PopAndDestroy();
1.137 + return errors;
1.138 +}
1.139 +
1.140 +TInt CUloggerServerTest1Step::Test2L()
1.141 +{//CULoggerServer::IncrementSessions
1.142 + TInt errors = 0;
1.143 + INFO_PRINTF1(_L("Testing - CULoggerServer::IncrementSessions method"));
1.144 + CULoggerServer *server = NULL;
1.145 + server = CULoggerServer::NewLC(EPriorityBackground);
1.146 + if(server == NULL)
1.147 + {
1.148 + INFO_PRINTF1(_L("error"));
1.149 + ++errors;
1.150 + }
1.151 + else
1.152 + {
1.153 + server->IncrementSessions();
1.154 + //note it's not possible to test method DecrementSessions without
1.155 + //previous connection as server always stop CActiveScheduler when last session will dissconnect.
1.156 + //look for CULoggerServer::DecrementSessions() method
1.157 + CleanupStack::PopAndDestroy();
1.158 + }
1.159 + return errors;
1.160 +}
1.161 +
1.162 +TInt CUloggerServerTest1Step::Test3L()
1.163 +{//CULoggerServer::Stop
1.164 + TInt errors = 0;
1.165 + INFO_PRINTF1(_L("Testing - CULoggerServer::Stop method"));
1.166 + CULoggerServer *server = NULL;
1.167 + server = CULoggerServer::NewLC(EPriorityBackground);
1.168 + if(server == NULL)
1.169 + {
1.170 + INFO_PRINTF1(_L("error"));
1.171 + ++errors;
1.172 + }
1.173 + else
1.174 + {
1.175 + TInt e = server->Stop();
1.176 + TBuf<128> buf;
1.177 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.178 + INFO_PRINTF1(buf);
1.179 + CleanupStack::PopAndDestroy();
1.180 + }
1.181 + return errors;
1.182 +}
1.183 +
1.184 +TInt CUloggerServerTest1Step::Test4L()
1.185 +{//CULoggerServer::GetPrimaryFilters
1.186 + TInt errors = 0;
1.187 + INFO_PRINTF1(_L("Testing - CULoggerServer::GetPrimaryFilters method"));
1.188 + CULoggerServer *server = NULL;
1.189 + server = CULoggerServer::NewLC(EPriorityBackground);
1.190 + if(server == NULL)
1.191 + {
1.192 + INFO_PRINTF1(_L("error"));
1.193 + ++errors;
1.194 + }
1.195 + else
1.196 + {
1.197 + RArray<TUint32> array;
1.198 + TInt e = server->GetActiveFilters(array,EPrimaryFilter);
1.199 + if(e!=KErrNone) errors++;
1.200 + TBuf<128> buf;
1.201 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.202 + INFO_PRINTF1(buf);
1.203 + buf.Zero();
1.204 + buf.AppendFormat(_L("Num. of filters - %d"), array.Count());
1.205 + INFO_PRINTF1(buf);
1.206 + CleanupStack::PopAndDestroy(); //server
1.207 + array.Close();
1.208 + }
1.209 + return errors;
1.210 +}
1.211 +
1.212 +TInt CUloggerServerTest1Step::Test5L()
1.213 +{//CULoggerServer::GetSecondaryFilters
1.214 + TInt errors = 0;
1.215 + INFO_PRINTF1(_L("Testing - CULoggerServer::GetSecondaryFilters method"));
1.216 + CULoggerServer *server = NULL;
1.217 + server = CULoggerServer::NewLC(EPriorityBackground);
1.218 + if(server == NULL)
1.219 + {
1.220 + INFO_PRINTF1(_L("error"));
1.221 + ++errors;
1.222 + }
1.223 + else
1.224 + {
1.225 + RArray<TUint32> array;
1.226 + TInt e = server->GetActiveFilters(array,ESecondaryFilter);
1.227 + if(e!=KErrNone) errors++;
1.228 + TBuf<128> buf;
1.229 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.230 + INFO_PRINTF1(buf);
1.231 + buf.Zero();
1.232 + buf.AppendFormat(_L("Num. of filters - %d"), array.Count());
1.233 + INFO_PRINTF1(buf);
1.234 + CleanupStack::PopAndDestroy(); //server
1.235 + array.Close();
1.236 + }
1.237 + return errors;
1.238 +}
1.239 +
1.240 +TInt CUloggerServerTest1Step::Test6L()
1.241 +{//CULoggerServer::RemoveFilterfromConfig
1.242 + TInt errors = 0;
1.243 + INFO_PRINTF1(_L("Testing - CULoggerServer::RemoveFilterfromConfig method"));
1.244 + CULoggerServer *server = NULL;
1.245 + server = CULoggerServer::NewLC(EPriorityBackground);
1.246 + if(server == NULL)
1.247 + {
1.248 + INFO_PRINTF1(_L("error"));
1.249 + ++errors;
1.250 + }
1.251 + else
1.252 + { RArray<TUint32> filters;
1.253 + //CleanupClosePushL(filters);
1.254 + for(TInt i=20;i<40;i++)
1.255 + {
1.256 + filters.AppendL(i);
1.257 + }
1.258 + // filters->AppendL(i);
1.259 + TInt e = server->RemoveActiveFilter(filters,EPrimaryFilter);
1.260 + filters.Close();
1.261 + TBuf<128> buf;
1.262 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.263 + INFO_PRINTF1(buf);
1.264 +
1.265 + //CleanupStack::PopAndDestroy(); //filters
1.266 + CleanupStack::PopAndDestroy(); //server
1.267 + //}
1.268 + }
1.269 + return errors;
1.270 +}
1.271 +
1.272 +TInt CUloggerServerTest1Step::Test6AL()
1.273 +{//CULoggerServer::RemoveFilterfromConfig
1.274 + TInt errors = 0;
1.275 + INFO_PRINTF1(_L("Testing - CULoggerServer::RemoveFilterfromConfig method"));
1.276 + CULoggerServer *server = NULL;
1.277 + server = CULoggerServer::NewLC(EPriorityBackground);
1.278 + if(server == NULL)
1.279 + {
1.280 + INFO_PRINTF1(_L("error"));
1.281 + ++errors;
1.282 + }
1.283 + else
1.284 + {
1.285 + RArray<TUint32> filters;
1.286 + CleanupClosePushL(filters);
1.287 + for(TUint32 i=321;i<400;i++)
1.288 + filters.AppendL(i);
1.289 + TInt e = server->RemoveActiveFilter(filters,ESecondaryFilter);;
1.290 + filters.Close();
1.291 + TBuf<128> buf;
1.292 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.293 + INFO_PRINTF1(buf);
1.294 +
1.295 + CleanupStack::PopAndDestroy(&filters); //server
1.296 + CleanupStack::PopAndDestroy(); //server
1.297 + }
1.298 + return errors;
1.299 +}
1.300 +
1.301 +TInt CUloggerServerTest1Step::Test7L()
1.302 +{//CULoggerServer::EnablePrimaryFilter
1.303 + TInt errors = 0;
1.304 + INFO_PRINTF1(_L("Testing - CULoggerServer::SetPrimaryFilter method"));
1.305 + CULoggerServer *server = NULL;
1.306 + server=CULoggerServer::NewLC(EPriorityBackground);
1.307 + if(server == NULL)
1.308 + {
1.309 + INFO_PRINTF1(_L("error"));
1.310 + ++errors;
1.311 + }
1.312 + else
1.313 + {
1.314 + RArray<TUint32> aCategory;
1.315 +
1.316 + aCategory.Append(3);
1.317 + aCategory.Append(14);
1.318 + aCategory.Append(194);
1.319 +
1.320 + TInt e = KErrNone;
1.321 + e = server->SetActiveFilterL(aCategory,EPrimaryFilter);
1.322 + TBuf<128> buf;
1.323 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.324 + INFO_PRINTF1(buf);
1.325 + CleanupStack::PopAndDestroy(); //server
1.326 + }
1.327 + return errors;
1.328 +}
1.329 +
1.330 +
1.331 +TInt CUloggerServerTest1Step::Test8L()
1.332 +{//CULoggerServer::SetSecondaryFilter
1.333 + TInt errors = 0;
1.334 + INFO_PRINTF1(_L("Testing - CULoggerServer::SetSecondaryFilter method"));
1.335 + CULoggerServer *server = NULL;
1.336 + server=CULoggerServer::NewLC(EPriorityBackground);
1.337 + if(server == NULL)
1.338 + {
1.339 + INFO_PRINTF1(_L("error"));
1.340 + ++errors;
1.341 + }
1.342 + else
1.343 + {
1.344 + RArray<TUint32> array;
1.345 + array.Append(34);
1.346 + TInt e = server->SetActiveFilterL(array,ESecondaryFilter);
1.347 + TBuf<128> buf;
1.348 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.349 + INFO_PRINTF1(buf);
1.350 + CleanupStack::PopAndDestroy(); //server
1.351 + array.Close();
1.352 + }
1.353 + return errors;
1.354 + }
1.355 +
1.356 +TInt CUloggerServerTest1Step::Test9L()
1.357 +{//CULoggerServer::Start
1.358 + TInt errors = 0;
1.359 + CULoggerServer *server = NULL;
1.360 + server = CULoggerServer::NewLC(EPriorityBackground);
1.361 + if(server == NULL)
1.362 + {
1.363 + INFO_PRINTF1(_L("error"));
1.364 + ++errors;
1.365 + }
1.366 + else
1.367 + {
1.368 + /*
1.369 + * here we are going to test sequence off methods
1.370 + * */
1.371 + TBuf<128> buf;
1.372 + INFO_PRINTF1(_L("Testing - CULoggerServer::Start method"));
1.373 + TInt e = server->Start();
1.374 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.375 + INFO_PRINTF1(buf);
1.376 + INFO_PRINTF1(_L("Testing - CULoggerServer::SetGlobalSecondaryFilters method"));
1.377 + e = server->SetSecondaryFiltering(_L8("current"));
1.378 + buf.Zero();
1.379 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.380 + INFO_PRINTF1(buf);
1.381 + INFO_PRINTF1(_L("Testing - CULoggerServer::Stop method"));
1.382 + e = server->Stop();
1.383 + buf.Zero();
1.384 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.385 + INFO_PRINTF1(buf);
1.386 + CleanupStack::PopAndDestroy(); //server
1.387 + }
1.388 + return errors;
1.389 + }
1.390 +
1.391 +
1.392 +
1.393 +TInt CUloggerServerTest1Step::Test12L()
1.394 +{//CULoggerServer::SetActiveOutputPlugin
1.395 + TInt errors = 0;
1.396 + INFO_PRINTF1(_L("Testing - CULoggerServer::SetActiveOutputPlugin method"));
1.397 + CULoggerServer *server = NULL;
1.398 + server = CULoggerServer::NewLC(EPriorityBackground);
1.399 + if(server == NULL)
1.400 + {
1.401 + INFO_PRINTF1(_L("error"));
1.402 + ++errors;
1.403 + }
1.404 + else
1.405 + {
1.406 + TInt e = server->SetActiveOutputPlugin(_L8("media1"));
1.407 + TBuf<128> buf;
1.408 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.409 + INFO_PRINTF1(buf);
1.410 + CleanupStack::PopAndDestroy(); //server
1.411 + }
1.412 + return errors;
1.413 + }
1.414 +
1.415 +TInt CUloggerServerTest1Step::Test13L()
1.416 +{//CULoggerServer::SetOutputPluginSettings
1.417 + TInt errors = 0;
1.418 + INFO_PRINTF1(_L("Testing - CULoggerServer::SetOutputPluginSettings method"));
1.419 + CULoggerServer *server = NULL;
1.420 + server = CULoggerServer::NewLC(EPriorityBackground);
1.421 + if(server == NULL)
1.422 + {
1.423 + INFO_PRINTF1(_L("error"));
1.424 + ++errors;
1.425 + }
1.426 + else
1.427 + {
1.428 + RArray<TPtrC8> value;
1.429 + value.AppendL(_L8("output_path"));
1.430 + value.AppendL(_L8("c:\\logs\\ulogger.log"));
1.431 + TInt e = server->SetPluginSettings(_L8("media1"),value);// _L8("output_path"), _L8("c:\\logs\\ulogger.log"));
1.432 + TBuf<128> buf;
1.433 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.434 + INFO_PRINTF1(buf);
1.435 + CleanupStack::PopAndDestroy(); //server
1.436 + }
1.437 + return errors;
1.438 + }
1.439 +
1.440 +TInt CUloggerServerTest1Step::Test14L()
1.441 +{//CULoggerServer::GetActiveOutput
1.442 + TInt errors = 0;
1.443 + INFO_PRINTF1(_L("Testing - CULoggerServer::GetActiveOutputPlugin method"));
1.444 + CULoggerServer *server = NULL;
1.445 + server = CULoggerServer::NewLC(EPriorityBackground);
1.446 + if(server == NULL)
1.447 + {
1.448 + INFO_PRINTF1(_L("error"));
1.449 + ++errors;
1.450 + }
1.451 + else
1.452 + {
1.453 + RArray<TPtrC8> listBuffer;
1.454 + TInt e = server->GetActiveOutputPlugin(listBuffer);
1.455 + TBuf<128> buf;
1.456 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.457 + INFO_PRINTF1(buf);
1.458 + buf.Zero();
1.459 + if(listBuffer.Count()>0)
1.460 + {
1.461 + INFO_PRINTF1(_L("values:"));
1.462 + buf.Copy(listBuffer[0]);
1.463 + INFO_PRINTF1(buf);
1.464 + }
1.465 + listBuffer.Close();
1.466 + CleanupStack::PopAndDestroy(); //server
1.467 + }
1.468 + return errors;
1.469 + }
1.470 +
1.471 +TInt CUloggerServerTest1Step::Test15L()
1.472 +{//CULoggerServer::GetInstalledPlugins
1.473 + TInt errors = 0;
1.474 + INFO_PRINTF1(_L("Testing - CULoggerServer::GetInstalledOutputPlugins method"));
1.475 + CULoggerServer *server = NULL;
1.476 + server = CULoggerServer::NewLC(EPriorityBackground);
1.477 + if(server == NULL)
1.478 + {
1.479 + INFO_PRINTF1(_L("error"));
1.480 + ++errors;
1.481 + }
1.482 + else
1.483 + {
1.484 + RArray<TPtrC8> listBuffer;
1.485 + TInt e = server->GetInstalledOutputPlugins(listBuffer);
1.486 + TBuf<128> buf;
1.487 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.488 + INFO_PRINTF1(buf);
1.489 + buf.Zero();
1.490 + INFO_PRINTF1(_L("values:"));
1.491 + for(TInt i=0; i<listBuffer.Count(); ++i)
1.492 + {
1.493 + buf.Copy(listBuffer[i]);
1.494 + INFO_PRINTF1(buf);
1.495 + }
1.496 + iMediaCount = listBuffer.Count()/2;
1.497 + listBuffer.Close();
1.498 + CleanupStack::PopAndDestroy(); //server
1.499 + }
1.500 + return errors;
1.501 + }
1.502 +TInt CUloggerServerTest1Step::Test16L()
1.503 +{//CULoggerServer::GetOutputPluginSettingsL
1.504 + TInt errors = 0;
1.505 + INFO_PRINTF1(_L("Testing - CULoggerServer::GetOutputPluginSettingsL method"));
1.506 + CULoggerServer *server = NULL;
1.507 + server = CULoggerServer::NewLC(EPriorityBackground);
1.508 + if(server == NULL)
1.509 + {
1.510 + INFO_PRINTF1(_L("error"));
1.511 + ++errors;
1.512 + }
1.513 + else
1.514 + {
1.515 + for(TInt k=0; k<iMediaCount; k++)
1.516 + {
1.517 + TBuf8<32> mediaBuf;
1.518 + mediaBuf.AppendFormat(_L8("media%d"),k+1);
1.519 + RArray<TPtrC8> mediaList;
1.520 + TInt e = server->GetOptionsSettingsL(mediaBuf, mediaList);
1.521 + TBuf<128> buf;
1.522 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.523 + INFO_PRINTF1(buf);
1.524 + buf.Zero();
1.525 + INFO_PRINTF1(_L("values:"));
1.526 + for(TInt i=0; i<mediaList.Count(); ++i)
1.527 + {
1.528 + buf.Copy(mediaList[i]);
1.529 + INFO_PRINTF1(buf);
1.530 + }
1.531 + mediaList.Close();
1.532 + }
1.533 +
1.534 + CleanupStack::PopAndDestroy(); //server
1.535 + }
1.536 + return errors;
1.537 + }
1.538 +
1.539 +
1.540 +
1.541 +TInt CUloggerServerTest1Step::Test18L()
1.542 +{//CULoggerServer::SetBufferSizeL
1.543 + TInt errors = 0;
1.544 + INFO_PRINTF1(_L("Testing - CULoggerServer::SetBufferSizeL method"));
1.545 + CULoggerServer *server = NULL;
1.546 + server = CULoggerServer::NewLC(EPriorityBackground);
1.547 + if(server == NULL)
1.548 + {
1.549 + INFO_PRINTF1(_L("error"));
1.550 + ++errors;
1.551 + }
1.552 + else
1.553 + {
1.554 + TInt e;
1.555 + INFO_PRINTF1(_L("testing value: -1"));
1.556 + e = server->SetBufferSizeL(-1);
1.557 + TBuf<128> buf;
1.558 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.559 + INFO_PRINTF1(buf);
1.560 + buf.Zero();
1.561 +
1.562 + INFO_PRINTF1(_L("testing value: 0"));
1.563 + e = server->SetBufferSizeL(0);
1.564 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.565 + INFO_PRINTF1(buf);
1.566 + buf.Zero();
1.567 +
1.568 + INFO_PRINTF1(_L("testing value: 100"));
1.569 + e = server->SetBufferSizeL(100);
1.570 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.571 + INFO_PRINTF1(buf);
1.572 + buf.Zero();
1.573 +
1.574 + INFO_PRINTF1(_L("testing value: 65535"));
1.575 + e = server->SetBufferSizeL(65535);
1.576 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.577 + INFO_PRINTF1(buf);
1.578 + buf.Zero();
1.579 +
1.580 + INFO_PRINTF1(_L("testing value: 65536"));
1.581 + e = server->SetBufferSizeL(65536);
1.582 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.583 + INFO_PRINTF1(buf);
1.584 + buf.Zero();
1.585 +
1.586 + INFO_PRINTF1(_L("testing value: 165537"));
1.587 + e = server->SetBufferSizeL(165537);
1.588 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.589 + INFO_PRINTF1(buf);
1.590 + buf.Zero();
1.591 + CleanupStack::PopAndDestroy(); //server
1.592 + }
1.593 + return errors;
1.594 + }
1.595 +
1.596 +
1.597 +TInt CUloggerServerTest1Step::Test19L()
1.598 +{//CULoggerServer::SetDataNotificationSizeL
1.599 + TInt errors = 0;
1.600 + INFO_PRINTF1(_L("Testing - CULoggerServer::SetDataNotificationSizeL method"));
1.601 + CULoggerServer *server = NULL;
1.602 + server = CULoggerServer::NewLC(EPriorityBackground);
1.603 + if(server == NULL)
1.604 + {
1.605 + INFO_PRINTF1(_L("error"));
1.606 + ++errors;
1.607 + }
1.608 + else
1.609 + {
1.610 + TInt e;
1.611 + INFO_PRINTF1(_L("testing value: -1"));
1.612 + e = server->SetDataNotificationSizeL(-1);
1.613 + TBuf<128> buf;
1.614 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.615 + INFO_PRINTF1(buf);
1.616 + buf.Zero();
1.617 +
1.618 + INFO_PRINTF1(_L("testing value: 0"));
1.619 + e = server->SetDataNotificationSizeL(0);
1.620 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.621 + INFO_PRINTF1(buf);
1.622 + buf.Zero();
1.623 +
1.624 + INFO_PRINTF1(_L("testing value: 100"));
1.625 + e = server->SetDataNotificationSizeL(100);
1.626 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.627 + INFO_PRINTF1(buf);
1.628 + buf.Zero();
1.629 +
1.630 + INFO_PRINTF1(_L("testing value: 65535"));
1.631 + e = server->SetDataNotificationSizeL(65535);
1.632 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.633 + INFO_PRINTF1(buf);
1.634 + buf.Zero();
1.635 +
1.636 + INFO_PRINTF1(_L("testing value: 65536"));
1.637 + e = server->SetDataNotificationSizeL(65536);
1.638 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.639 + INFO_PRINTF1(buf);
1.640 + buf.Zero();
1.641 +
1.642 + INFO_PRINTF1(_L("testing value: 85536"));
1.643 + e = server->SetDataNotificationSizeL(85536);
1.644 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.645 + INFO_PRINTF1(buf);
1.646 + buf.Zero();
1.647 +
1.648 + INFO_PRINTF1(_L("testing value: 165538"));
1.649 + e = server->SetDataNotificationSizeL(165538);
1.650 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.651 + INFO_PRINTF1(buf);
1.652 + buf.Zero();
1.653 + CleanupStack::PopAndDestroy(); //server
1.654 + }
1.655 + return errors;
1.656 + }
1.657 +
1.658 +
1.659 +TInt CUloggerServerTest1Step::Test20L()
1.660 +{//CULoggerServer::GetBufferSize
1.661 + TInt errors = 0;
1.662 + INFO_PRINTF1(_L("Testing - CULoggerServer::GetBufferSize method"));
1.663 + CULoggerServer *server = NULL;
1.664 + server = CULoggerServer::NewLC(EPriorityBackground);
1.665 + if(server == NULL)
1.666 + {
1.667 + INFO_PRINTF1(_L("error"));
1.668 + ++errors;
1.669 + }
1.670 + else
1.671 + {
1.672 + TInt e;
1.673 + INFO_PRINTF1(_L("testing value: -1"));
1.674 + server->GetBufandDataNotifyValuesL(KBuffer,e);
1.675 + TBuf<128> buf;
1.676 + buf.AppendFormat(_L("Value - %d"), e);
1.677 + INFO_PRINTF1(buf);
1.678 + buf.Zero();
1.679 + CleanupStack::PopAndDestroy(); //server
1.680 + }
1.681 + return errors;
1.682 + }
1.683 +
1.684 +
1.685 +TInt CUloggerServerTest1Step::Test21L()
1.686 +{// CULoggerServer::GetDataNotificationSize
1.687 + TInt errors = 0;
1.688 + INFO_PRINTF1(_L("Testing - CULoggerServer::GetDataNotificationSize method"));
1.689 + CULoggerServer *server = NULL;
1.690 + server = CULoggerServer::NewLC(EPriorityBackground);
1.691 + if(server == NULL)
1.692 + {
1.693 + INFO_PRINTF1(_L("error"));
1.694 + ++errors;
1.695 + }
1.696 + else
1.697 + {
1.698 + TInt e;
1.699 + INFO_PRINTF1(_L("testing value: -1"));
1.700 + server->GetBufandDataNotifyValuesL(KDataNotification,e);
1.701 + TBuf<128> buf;
1.702 + buf.AppendFormat(_L("Value - %d"), e);
1.703 + INFO_PRINTF1(buf);
1.704 + buf.Zero();
1.705 + CleanupStack::PopAndDestroy(); //server
1.706 + }
1.707 + return errors;
1.708 + }
1.709 +
1.710 +TInt CUloggerServerTest1Step::Test22L()
1.711 +{//CULoggerServer::SetGlobalSecondaryFilters
1.712 + TInt errors = 0;
1.713 + INFO_PRINTF1(_L("Testing - CULoggerServer::SetSecondaryFiltering method"));
1.714 + CULoggerServer *server = NULL;
1.715 + server = CULoggerServer::NewLC(EPriorityBackground);
1.716 + if(server == NULL)
1.717 + {
1.718 + INFO_PRINTF1(_L("error"));
1.719 + ++errors;
1.720 + }
1.721 + else
1.722 + {
1.723 + _LIT8(KEnable,"enable");
1.724 + _LIT8(KDisable,"disable");
1.725 + TInt e;
1.726 + TBuf<128> buf;
1.727 + buf.Copy(KEnable);
1.728 + INFO_PRINTF1(buf);
1.729 + buf.Zero();
1.730 + e = server->SetSecondaryFiltering(KEnable);
1.731 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.732 + INFO_PRINTF1(buf);
1.733 + buf.Zero();
1.734 +
1.735 + buf.Copy(KDisable);
1.736 + INFO_PRINTF1(buf);
1.737 + buf.Zero();
1.738 + e = server->SetSecondaryFiltering(KDisable);
1.739 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.740 + INFO_PRINTF1(buf);
1.741 + buf.Zero();
1.742 + CleanupStack::PopAndDestroy(); //server
1.743 + }
1.744 + return errors;
1.745 + }
1.746 +
1.747 +TInt CUloggerServerTest1Step::Test23L()
1.748 +{//CULoggerServer::ReadBufferL
1.749 + TInt errors = 0;
1.750 + INFO_PRINTF1(_L("Testing - CULoggerServer::ReadBufferL method"));
1.751 + CULoggerServer *server = NULL;
1.752 + server = CULoggerServer::NewLC(EPriorityBackground);
1.753 + if(server == NULL)
1.754 + {
1.755 + INFO_PRINTF1(_L("error"));
1.756 + ++errors;
1.757 + }
1.758 + else
1.759 + {
1.760 + TBuf<128> buf;
1.761 + TRAPD(err, server->ReadBufferL());
1.762 + buf.AppendFormat(_L("Results of calling method - %d"), err);
1.763 + INFO_PRINTF1(buf);
1.764 +
1.765 + CleanupStack::PopAndDestroy(); //server
1.766 + }
1.767 + return errors;
1.768 + }
1.769 +
1.770 +TInt CUloggerServerTest1Step::Test24L()
1.771 +{//CULoggerServer::DataNotification
1.772 + TInt errors = 0;
1.773 + INFO_PRINTF1(_L("Testing - CULoggerServer::DataNotification method"));
1.774 + CULoggerServer *server = NULL;
1.775 + server = CULoggerServer::NewLC(EPriorityBackground);
1.776 + if(server == NULL)
1.777 + {
1.778 + INFO_PRINTF1(_L("error"));
1.779 + ++errors;
1.780 + }
1.781 + else
1.782 + {
1.783 + server->DataNotification();
1.784 + INFO_PRINTF1(_L("OK"));
1.785 + CleanupStack::PopAndDestroy(); //server
1.786 + }
1.787 + return errors;
1.788 + }
1.789 +
1.790 +
1.791 + TInt CUloggerServerTest1Step::Test25L()
1.792 +{//CULoggerServer::SetBufferMode
1.793 + TInt errors = 0;
1.794 + INFO_PRINTF1(_L("Testing - CULoggerServer::SetGlobalSecondaryFilters method"));
1.795 + CULoggerServer *server = NULL;
1.796 + server = CULoggerServer::NewLC(EPriorityBackground);
1.797 + if(server == NULL)
1.798 + {
1.799 + INFO_PRINTF1(_L("error"));
1.800 + ++errors;
1.801 + }
1.802 + else
1.803 + {
1.804 + _LIT8(KCircular,"circular");
1.805 + _LIT8(KStraight,"straight");
1.806 + TInt e;
1.807 + TBuf<128> buf;
1.808 + buf.Copy(KCircular);
1.809 + INFO_PRINTF1(buf);
1.810 + buf.Zero();
1.811 + e = server->SetBufferMode(KCircular);
1.812 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.813 + INFO_PRINTF1(buf);
1.814 + buf.Zero();
1.815 +
1.816 + buf.Copy(KStraight);
1.817 + INFO_PRINTF1(buf);
1.818 + buf.Zero();
1.819 + e = server->SetBufferMode(KStraight);
1.820 + buf.AppendFormat(_L("Code returned from method - %d"), e);
1.821 + INFO_PRINTF1(buf);
1.822 + buf.Zero();
1.823 + CleanupStack::PopAndDestroy(); //server
1.824 + }
1.825 + return errors;
1.826 + }
1.827 +
1.828 +TInt CUloggerServerTest1Step::Test26L() //CULoggerServer::UnconfigureCurrentChannel
1.829 + {
1.830 + TInt errors = 0;
1.831 + INFO_PRINTF1(_L("Testing - CULoggerServer::UnconfigureCurrentChannel method"));
1.832 + /* //removed - method isn't used anywhere
1.833 + CULoggerServer *server = NULL;
1.834 + server = CULoggerServer::NewLC(EPriorityBackground);
1.835 + if(server == NULL)
1.836 + {
1.837 + INFO_PRINTF1(_L("error"));
1.838 + ++errors;
1.839 + }
1.840 + else
1.841 + {
1.842 + server->UnconfigureCurrentChannel();
1.843 + CleanupStack::PopAndDestroy(); //server
1.844 + }
1.845 + */
1.846 + return errors;
1.847 + }
1.848 +
1.849 +
1.850 +TInt CUloggerServerTest1Step::Test27L()//CULoggerServer::DoPostProcessing
1.851 + {
1.852 + TInt errors = 0;
1.853 + INFO_PRINTF1(_L("Testing - CULoggerServer::DoPostProcessing method"));
1.854 + CULoggerServer *server = NULL;
1.855 + server = CULoggerServer::NewLC(EPriorityBackground);
1.856 + if(server == NULL)
1.857 + {
1.858 + INFO_PRINTF1(_L("error"));
1.859 + ++errors;
1.860 + }
1.861 + else
1.862 + {
1.863 + INFO_PRINTF1(_L("DoPostProcessing(EUnknown)"));
1.864 + server->DoPostProcessing(EUnknown);
1.865 + INFO_PRINTF1(_L("DoPostProcessing(ERestart)"));
1.866 + server->DoPostProcessing(ERestart);
1.867 + INFO_PRINTF1(_L("DoPostProcessing(EStop)"));
1.868 + server->DoPostProcessing(EStop);
1.869 +
1.870 + CleanupStack::PopAndDestroy(); //server
1.871 + }
1.872 + return errors;
1.873 + }
1.874 +
1.875 +
1.876 +TInt CUloggerServerTest1Step::Test28L()//CULoggerServer::RemoveOutputPluginSettingsL
1.877 + {
1.878 + TInt errors = 0;
1.879 + INFO_PRINTF1(_L("Testing - CULoggerServer::RemoveOutputPluginSettingsL method"));
1.880 + CULoggerServer *server = NULL;
1.881 + server = CULoggerServer::NewLC(EPriorityBackground);
1.882 + if(server == NULL)
1.883 + {
1.884 + INFO_PRINTF1(_L("error"));
1.885 + ++errors;
1.886 + }
1.887 + else
1.888 + {
1.889 + TInt errCode = KErrNone;
1.890 + RArray<TPtrC8> set;
1.891 + set.AppendL(_L8("testKey"));
1.892 + set.AppendL(_L8("testVal"));
1.893 + errCode = server->SetPluginSettings(_L8("uloggerserialplugin"), set);
1.894 + set.Close();
1.895 + if(errCode != KErrNone)
1.896 + {
1.897 + INFO_PRINTF1(_L("error"));
1.898 + CleanupStack::PopAndDestroy(); //server
1.899 + return ++errors;
1.900 + }
1.901 +
1.902 + INFO_PRINTF1(_L("RemoveOutputPluginSettingsL - uloggerserialplugin)"));
1.903 + errCode = server->RemovePluginSettingsL(_L8("uloggerserialplugin"));
1.904 + if(errCode != KErrNone)
1.905 + {
1.906 + INFO_PRINTF1(_L("error"));
1.907 + CleanupStack::PopAndDestroy(); //server
1.908 + return ++errors;
1.909 + }
1.910 +
1.911 + INFO_PRINTF1(_L("RemoveOutputPluginSettingsL - dummyname)"));
1.912 + server->RemovePluginSettingsL(_L8("dummyname"));
1.913 +
1.914 + CleanupStack::PopAndDestroy(); //server
1.915 + }
1.916 + return errors;
1.917 + }
1.918 +
1.919 +
1.920 +TInt CUloggerServerTest1Step::Test29L()//CULoggerServer::GetInstalledInputPluginsL
1.921 + {
1.922 + TInt errors = 0;
1.923 + INFO_PRINTF1(_L("Testing - CULoggerServer::GetInstalledInputPluginsL method"));
1.924 + CULoggerServer *server = NULL;
1.925 + server = CULoggerServer::NewLC(EPriorityBackground);
1.926 + if(server == NULL)
1.927 + {
1.928 + INFO_PRINTF1(_L("error"));
1.929 + ++errors;
1.930 + }
1.931 + else
1.932 + {
1.933 + RArray<TPtrC8> list;
1.934 + server->GetInstalledInputPluginsL(list);
1.935 + list.Close();
1.936 + CleanupStack::PopAndDestroy(); //server
1.937 + }
1.938 + return errors;
1.939 + }
1.940 +
1.941 +
1.942 +TInt CUloggerServerTest1Step::Test30L()//CULoggerServer::SetActiveInputPlugin + DeActivateInputPlugin
1.943 + {
1.944 + TInt errors = 0;
1.945 + INFO_PRINTF1(_L("Testing - CULoggerServer::SetActiveInputPlugin + DeActivateInputPlugin methods"));
1.946 + CULoggerServer *server = NULL;
1.947 + server = CULoggerServer::NewLC(EPriorityBackground);
1.948 +
1.949 + _LIT8(KUsbPlugin,"uloggerusbplugin");
1.950 + server->DeActivateInputPlugin(KUsbPlugin);
1.951 + TInt errCode = server->SetActiveInputPlugin(KUsbPlugin);
1.952 + if(errCode != KErrNone && errCode != KErrNotFound)
1.953 + {
1.954 + INFO_PRINTF1(_L("error"));
1.955 + return ++errors;
1.956 + }
1.957 + errCode = server->SetActiveInputPlugin(KUsbPlugin);
1.958 +
1.959 + errCode = server->DeActivateInputPlugin(KUsbPlugin);
1.960 + TBuf<128> b;
1.961 + b.AppendFormat(_L("err1 %d"), errCode);
1.962 + INFO_PRINTF1(b);
1.963 + if(errCode != KErrNone && errCode != KErrNotFound)
1.964 + {
1.965 + INFO_PRINTF1(_L("error"));
1.966 + return ++errors;
1.967 + }
1.968 + errCode = server->DeActivateInputPlugin(KUsbPlugin);
1.969 + b.Zero();
1.970 + b.AppendFormat(_L("err2 %d"), errCode);
1.971 + INFO_PRINTF1(b);
1.972 + if(errCode != KErrNone && errCode != KErrNotFound && errCode != KErrAlreadyExists)
1.973 + {
1.974 + INFO_PRINTF1(_L("error"));
1.975 + return ++errors;
1.976 + }
1.977 +
1.978 + server->Stop();
1.979 + CleanupStack::PopAndDestroy(); //server
1.980 + User::After(1*1000*1000);
1.981 + return errors;
1.982 + }
1.983 +
1.984 +
1.985 +TInt CUloggerServerTest1Step::Test31L()//CULoggerServer::ProcessCommandL ver1
1.986 + {
1.987 + TInt errors = 0;
1.988 + INFO_PRINTF1(_L("Testing - CULoggerServer::ProcessCommandL method"));
1.989 + CULoggerServer *server = NULL;
1.990 + server = CULoggerServer::NewLC(EPriorityBackground);
1.991 +
1.992 + RArray<TPtrC8> arguments;
1.993 + //test all commands with empty array of arguments
1.994 + for(TInt i=0; i<=EVersion; i++)
1.995 + {
1.996 + TBuf<32> buf;
1.997 + buf.AppendFormat(_L("command number: %d"), i);
1.998 + INFO_PRINTF1(buf);
1.999 + ControlData *cd = server->ProcessCommandL((TCommand)i, arguments);
1.1000 + if(!cd)
1.1001 + {
1.1002 + ++errors;
1.1003 + break;
1.1004 + }
1.1005 + delete cd;
1.1006 + cd = NULL;
1.1007 + }
1.1008 + server->Stop();
1.1009 + CleanupStack::PopAndDestroy(); //server
1.1010 + return errors;
1.1011 + }