sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <e32base.h>
|
sl@0
|
17 |
#include <bautils.h>
|
sl@0
|
18 |
#include <f32file.h>
|
sl@0
|
19 |
#include "../EcomTestUtils/EcomTestCompTestabilityUtils.h"
|
sl@0
|
20 |
#include "../EcomTestUtils/EcomTestIniFileUtils.h"
|
sl@0
|
21 |
#include "../EcomTestUtils/EcomTestUtils.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
_LIT(KIniEcomTestBehaviourFileNameInit, "z:\\test\\data\\EComTestBehaviour.ini");
|
sl@0
|
24 |
_LIT(KIniEcomTestBehaviourFileNameFinal, "c:\\EComTestBehaviour.ini");
|
sl@0
|
25 |
|
sl@0
|
26 |
//
|
sl@0
|
27 |
//
|
sl@0
|
28 |
//Test macroes and functions
|
sl@0
|
29 |
//
|
sl@0
|
30 |
//
|
sl@0
|
31 |
|
sl@0
|
32 |
static void Check(RTest& aTest, TInt aValue, TInt aExpected, TInt aLine)
|
sl@0
|
33 |
{
|
sl@0
|
34 |
if(aValue != aExpected)
|
sl@0
|
35 |
{
|
sl@0
|
36 |
RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
|
sl@0
|
37 |
aTest(EFalse, aLine);
|
sl@0
|
38 |
}
|
sl@0
|
39 |
}
|
sl@0
|
40 |
#define TEST2(aTest, aValue, aExpected) ::Check(aTest, aValue, aExpected, __LINE__)
|
sl@0
|
41 |
|
sl@0
|
42 |
//
|
sl@0
|
43 |
//
|
sl@0
|
44 |
//Helper functions
|
sl@0
|
45 |
//
|
sl@0
|
46 |
//
|
sl@0
|
47 |
/**
|
sl@0
|
48 |
Enable ECom test behaviour by copying the EComTestBehaviour.ini
|
sl@0
|
49 |
@param aTest the RTest that this method is called from
|
sl@0
|
50 |
@param aFs A reference to an connected file server session.
|
sl@0
|
51 |
*/
|
sl@0
|
52 |
void EnableEcomTestBehaviour(RTest& aTest, RFs& /*aFs*/)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
TInt err = KErrNone;
|
sl@0
|
55 |
TParse initFileName;
|
sl@0
|
56 |
TParse finalFileName;
|
sl@0
|
57 |
|
sl@0
|
58 |
initFileName.Set(KIniEcomTestBehaviourFileNameInit, NULL, NULL);
|
sl@0
|
59 |
finalFileName.Set(KIniEcomTestBehaviourFileNameFinal, NULL, NULL);
|
sl@0
|
60 |
|
sl@0
|
61 |
//copy the file to enable test behaviour
|
sl@0
|
62 |
TRAP(err, EComTestUtils::FileManCopyFileL(
|
sl@0
|
63 |
initFileName.FullName(),
|
sl@0
|
64 |
finalFileName.FullName()));
|
sl@0
|
65 |
TEST2(aTest, err, KErrNone);
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
/**
|
sl@0
|
69 |
Enable ECom test behaviour by deleting the EComTestBehaviour.ini
|
sl@0
|
70 |
@param aTest the RTest that this method is called from
|
sl@0
|
71 |
@param aFs A reference to an connected file server session.
|
sl@0
|
72 |
*/
|
sl@0
|
73 |
void DisableEcomTestBehaviour(RTest& aTest, RFs& /*aFs*/)
|
sl@0
|
74 |
{
|
sl@0
|
75 |
TInt err = KErrNone;
|
sl@0
|
76 |
TParse finalFileName;
|
sl@0
|
77 |
|
sl@0
|
78 |
finalFileName.Set(KIniEcomTestBehaviourFileNameFinal, NULL, NULL);
|
sl@0
|
79 |
|
sl@0
|
80 |
//delete the file to disable test behaviour
|
sl@0
|
81 |
TRAP(err, EComTestUtils::RfsDeleteFileL(finalFileName.FullName()));
|
sl@0
|
82 |
TEST2(aTest, err, KErrNone);
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|