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 GlobalShareStep.cpp
|
|
23 |
*/
|
|
24 |
#include "GlobalShareStep.h"
|
|
25 |
#include "TestSharedData.h"
|
|
26 |
#include <testexecutelog.h>
|
|
27 |
|
|
28 |
CGlobalShareStep1::~CGlobalShareStep1()
|
|
29 |
/**
|
|
30 |
* Destructor
|
|
31 |
*/
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
CGlobalShareStep1::CGlobalShareStep1()
|
|
36 |
/**
|
|
37 |
* Constructor
|
|
38 |
*/
|
|
39 |
{
|
|
40 |
// Call base class method to set up the human readable name for logging
|
|
41 |
SetTestStepName(KGlobalShareStep1);
|
|
42 |
}
|
|
43 |
|
|
44 |
TVerdict CGlobalShareStep1::doTestStepL()
|
|
45 |
/**
|
|
46 |
* @return - TVerdict code
|
|
47 |
* Override of base class pure virtual
|
|
48 |
* Demonstrates opening up a handle to the data saved at RChunk base using template class
|
|
49 |
* Overwrite shared data with values and also demonstrates the locking mechanism
|
|
50 |
*/
|
|
51 |
{
|
|
52 |
INFO_PRINTF1(_L("Global Step1 doTestStepL"));
|
|
53 |
SetTestStepResult(EFail);
|
|
54 |
|
|
55 |
TBuf<256> txtReadData(KNull);
|
|
56 |
TRAPD(err,ReadSharedDataL(_L("SharedData"), txtReadData));
|
|
57 |
if (err == KErrNone)
|
|
58 |
{
|
|
59 |
INFO_PRINTF2(_L("Value of Shared Data in Global Step2 initially is %S"), &txtReadData);
|
|
60 |
_LIT(KDesVal, "Hi Ganesh! How r u?");
|
|
61 |
TPtrC txtPtr;
|
|
62 |
txtPtr.Set(KDesVal);
|
|
63 |
WriteSharedDataL(_L("SharedData"), txtPtr, EAppendText);
|
|
64 |
txtReadData.Zero();
|
|
65 |
ReadSharedDataL(_L("SharedData"), txtReadData);
|
|
66 |
INFO_PRINTF2(_L("Value of Shared Data in Global Step2 updated is %S"), &txtReadData);
|
|
67 |
SetTestStepResult(EPass);
|
|
68 |
}
|
|
69 |
return TestStepResult();
|
|
70 |
}
|
|
71 |
|
|
72 |
CGlobalShareStep2::~CGlobalShareStep2()
|
|
73 |
/**
|
|
74 |
* Destructor
|
|
75 |
*/
|
|
76 |
{
|
|
77 |
}
|
|
78 |
|
|
79 |
CGlobalShareStep2::CGlobalShareStep2()
|
|
80 |
/**
|
|
81 |
* Constructor
|
|
82 |
*/
|
|
83 |
{
|
|
84 |
// Call base class method to set up the human readable name for logging
|
|
85 |
SetTestStepName(KGlobalShareStep2);
|
|
86 |
}
|
|
87 |
|
|
88 |
TVerdict CGlobalShareStep2::doTestStepL()
|
|
89 |
/**
|
|
90 |
* @return - TVerdict code
|
|
91 |
* Override of base class pure virtual
|
|
92 |
* Demonstrates opening up a handle to the data saved at RChunk base using template class
|
|
93 |
* Overwrite shared data with values and also demonstrates the locking mechanism
|
|
94 |
*/
|
|
95 |
{
|
|
96 |
INFO_PRINTF1(_L("Global Step2 doTestStepL"));
|
|
97 |
SetTestStepResult(EFail);
|
|
98 |
TBuf<256> txtReadData(KNull);
|
|
99 |
|
|
100 |
TRAPD(err,ReadSharedDataL(_L("SharedData1"), txtReadData));
|
|
101 |
if (err == KErrNone)
|
|
102 |
{
|
|
103 |
INFO_PRINTF2(_L("Value of Shared Data1 in Global Step2 initially is %S"), &txtReadData);
|
|
104 |
_LIT(KDesVal, "Hi Mahesh! How r u?");
|
|
105 |
TPtrC txtPtr;
|
|
106 |
txtPtr.Set(KDesVal);
|
|
107 |
WriteSharedDataL(_L("SharedData1"), txtPtr, ESetText);
|
|
108 |
txtReadData.Zero();
|
|
109 |
ReadSharedDataL(_L("SharedData1"), txtReadData);
|
|
110 |
INFO_PRINTF2(_L("Value of Shared Data1 in Global Step2 updated is %S"), &txtReadData);
|
|
111 |
SetTestStepResult(EPass);
|
|
112 |
}
|
|
113 |
return TestStepResult();
|
|
114 |
}
|