|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // EventLogger - deleting EventLogger test files from C: |
|
15 // Please, ensure that t_logenvdestroy test is executed after the EventLogger component tests |
|
16 // |
|
17 // |
|
18 |
|
19 #include <e32test.h> |
|
20 #include <bautils.h> |
|
21 |
|
22 RTest TheTest(_L("t_logenvdestroy - deleting EventLogger test files from C:")); |
|
23 |
|
24 _LIT(KCFileName1, "c:\\private\\10003a73\\CntModel.ini"); |
|
25 _LIT(KCFileName2, "c:\\private\\10003a73\\SQLite__Contacts.cdb"); |
|
26 |
|
27 /////////////////////////////////////////////////////////////////////////////////////// |
|
28 /////////////////////////////////////////////////////////////////////////////////////// |
|
29 //Test macros and functions |
|
30 static void Check(TInt aValue, TInt aExpected, TInt aLine) |
|
31 { |
|
32 if(aValue != aExpected) |
|
33 { |
|
34 RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
|
35 TheTest(EFalse, aLine); |
|
36 } |
|
37 } |
|
38 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) |
|
39 |
|
40 /////////////////////////////////////////////////////////////////////////////////////// |
|
41 |
|
42 void DoDeleteFile(RFs& aFs, const TDesC& aFilePath) |
|
43 { |
|
44 TInt err = BaflUtils::DeleteFile(aFs, aFilePath); |
|
45 if(err != KErrNone && err != KErrNotFound) |
|
46 { |
|
47 TheTest.Printf(_L("Error %d deleting \"%S\" file.\n"), err, &aFilePath); |
|
48 } |
|
49 } |
|
50 |
|
51 void DoRun() |
|
52 { |
|
53 RFs fs; |
|
54 TInt err = fs.Connect(); |
|
55 TEST2(err, KErrNone); |
|
56 |
|
57 TheTest.Start(_L(" @SYMTestCaseID: PDS-LOGENG-CT-4049 Deleting EventLogger test files from C:")); |
|
58 |
|
59 DoDeleteFile(fs, KCFileName1); |
|
60 DoDeleteFile(fs, KCFileName2); |
|
61 |
|
62 fs.Close(); |
|
63 } |
|
64 |
|
65 TInt E32Main() |
|
66 { |
|
67 TheTest.Title(); |
|
68 |
|
69 CTrapCleanup* tc = CTrapCleanup::New(); |
|
70 |
|
71 __UHEAP_MARK; |
|
72 |
|
73 DoRun(); |
|
74 |
|
75 __UHEAP_MARKEND; |
|
76 |
|
77 TheTest.End(); |
|
78 TheTest.Close(); |
|
79 |
|
80 delete tc; |
|
81 |
|
82 User::Heap().Check(); |
|
83 return KErrNone; |
|
84 } |