0
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* Example CTestStep derived implementation
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
/**
|
|
22 |
@file checkresultstep.cpp
|
|
23 |
*/
|
|
24 |
#include "checktimestep.h"
|
|
25 |
|
|
26 |
CCheckTimeStep::~CCheckTimeStep()
|
|
27 |
/**
|
|
28 |
* Destructor
|
|
29 |
*/
|
|
30 |
{
|
|
31 |
}
|
|
32 |
|
|
33 |
CCheckTimeStep::CCheckTimeStep(CTe_RegScriptCommandServer* aServer) : iServer(aServer)
|
|
34 |
/**
|
|
35 |
* Constructor
|
|
36 |
*/
|
|
37 |
{
|
|
38 |
// Call base class method to set up the human readable name for logging
|
|
39 |
SetTestStepName(KCheckTimeStep);
|
|
40 |
}
|
|
41 |
|
|
42 |
TVerdict CCheckTimeStep::doTestStepL()
|
|
43 |
/**
|
|
44 |
* @return - TVerdict code
|
|
45 |
* Override of base class pure virtual
|
|
46 |
* Demonstrates opening up a handle to the data saved at RChunk base using template class
|
|
47 |
* Overwrite shared data with values and also demonstrates the locking mechanism
|
|
48 |
*/
|
|
49 |
{
|
|
50 |
SetTestStepResult(EFail);
|
|
51 |
|
|
52 |
INFO_PRINTF1(_L("Check time."));
|
|
53 |
_LIT(KTimeSeconds, "TimeSeconds");
|
|
54 |
TInt timeSeconds;
|
|
55 |
if (!GetIntFromConfig(ConfigSection(), KTimeSeconds(), timeSeconds))
|
|
56 |
{
|
|
57 |
ERR_PRINTF1(_L("Error get time seconds from config file."));
|
|
58 |
SetTestStepResult(EInconclusive);
|
|
59 |
return TestStepResult();
|
|
60 |
}
|
|
61 |
TTime timeNow;
|
|
62 |
timeNow.HomeTime();
|
|
63 |
TDateTime dateTime = timeNow.DateTime();
|
|
64 |
TTimeIntervalSeconds secs;
|
|
65 |
TInt err = timeNow.SecondsFrom(Server()->StartTime(), secs);
|
|
66 |
if (KErrNone != err)
|
|
67 |
{
|
|
68 |
ERR_PRINTF2(_L("Error get seconds interval, error code %d"), err);
|
|
69 |
}
|
|
70 |
else if ((secs.Int()-timeSeconds)<=1 || (timeSeconds-secs.Int())<=1)
|
|
71 |
{
|
|
72 |
SetTestStepResult(EPass);
|
|
73 |
}
|
|
74 |
|
|
75 |
return TestStepResult();
|
|
76 |
}
|