blob: 545cfc9c7573ac65b45540442128c7ec3ee60c43 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/*
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
#include "testcontactspbapexportcontents.h"
CTestContactsPBAPExportContents::~CTestContactsPBAPExportContents()
/**
* Destructor
*/
{
}
CTestContactsPBAPExportContents::CTestContactsPBAPExportContents()
/**
* Constructor
*/
{
// **MUST** call SetTestStepName in the constructor as the controlling
// framework uses the test step name immediately following construction to set
// up the step's unique logging ID.
SetTestStepName(KTestContactsPBAPExportContents);
}
TVerdict CTestContactsPBAPExportContents::doTestStepPreambleL()
/**
* @return - TVerdict code
* Override of base class virtual
*/
{
INFO_PRINTF1(_L("Check if the exported file has any content"));
SetTestStepResult(EPass);
return TestStepResult();
}
TVerdict CTestContactsPBAPExportContents::doTestStepL()
/**
* @return - TVerdict code
* Override of base class pure virtual
*/
{
TestContentsL();
return TestStepResult();
}
// Tests the contents of a file
void CTestContactsPBAPExportContents::TestContentsL()
{
// Tests that when a leave occurs, the exported file doesn't contain any data
RFs fsSession;
TInt returnVal;
RFile file;
TBuf8<20> buf;
User::LeaveIfError(fsSession.Connect());
CleanupClosePushL(fsSession);
TFindFile findFile(fsSession);
fsSession.SetSessionPath(KPath);
returnVal = findFile.FindByDir(KExportLeaveFile, KPath);
if(returnVal == KErrNone)
{
User::LeaveIfError(file.Open(fsSession, KExportLeaveFile, EFileWrite));
file.Read(buf);
// test that the exported file has no content
if(buf.Length() == 0)
{
SetTestStepResult(EPass);
}
else
{
SetTestStepResult(EFail);
}
}
else
{
SetTestStepResult(EFail);
}
file.Close();
CleanupStack::PopAndDestroy(&fsSession);
}
/**
* @return - TVerdict code
* Override of base class virtual
*/
TVerdict CTestContactsPBAPExportContents::doTestStepPostambleL()
{
return TestStepResult();
}
|