author | Mike Kinghan <mikek@symbian.org> |
Mon, 19 Jul 2010 08:40:05 +0100 | |
branch | GCC_SURGE |
changeset 209 | 6035754ebf88 |
parent 109 | b3a1d9898418 |
child 257 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 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 the License "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 |
// f32test\server\t_findcapall.cpp |
|
15 |
// PlatSec compatibility test. Application capability is ALLFILES |
|
16 |
// Tests to confirm DEF088224 changes do not affect exisitng functionality |
|
17 |
// TFindFile should NEVER return KErrPermissionDenied for FindByDir requests |
|
18 |
// z:\sys\bin\t_findcaptestfile.txt is used for testing. |
|
19 |
// If the file is not avialable in the location, test will panic. |
|
20 |
// |
|
21 |
// |
|
22 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
23 |
#define __E32TEST_EXTENSION__ |
0 | 24 |
#include <e32test.h> |
25 |
#include <f32file.h> |
|
26 |
||
27 |
_LIT(KTestString,"t_findcapall"); |
|
28 |
||
29 |
LOCAL_C RTest test(KTestString); |
|
30 |
||
31 |
LOCAL_C RFs FileServer; |
|
32 |
||
33 |
LOCAL_C TInt TestFind(const TPtrC16 aTestDesc, const TPtrC16 aFPath, const TPtrC16 aFName) |
|
34 |
{ |
|
35 |
TInt Err; |
|
36 |
test.Next(aTestDesc); |
|
37 |
TFindFile FindFile(FileServer); |
|
38 |
Err=FindFile.FindByDir(aFName,aFPath); |
|
39 |
return Err; |
|
40 |
} |
|
41 |
||
42 |
||
43 |
GLDEF_C TInt E32Main() |
|
44 |
{ |
|
45 |
TInt Err; |
|
46 |
||
47 |
test.Title(); |
|
48 |
||
49 |
Err=FileServer.Connect(); |
|
50 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
51 |
test_KErrNone(Err); |
0 | 52 |
|
53 |
// RTest.Next is called from function "TestFind()". |
|
54 |
// RTest.Start is called here to start the test. |
|
55 |
test.Start(_L("Test Starts : Dummy Test")); |
|
56 |
||
57 |
// Test: Find non existing file in existing /sys folder |
|
58 |
// |
|
59 |
// Drive Name : Z: |
|
60 |
// Path : sys\bin |
|
61 |
// File Name : nonexistingfile.txt |
|
62 |
// |
|
63 |
// Expected return value: KErrNotFound |
|
64 |
Err=TestFind(_L("Drive specified & available Path exists File does not exist"), |
|
65 |
_L("z:\\sys\\bin\\"), |
|
66 |
_L("nonexistingfile.txt")); |
|
67 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
68 |
test_Value(Err, Err == KErrNotFound); |
0 | 69 |
|
70 |
// Test: Find existing file in existing /sys folder |
|
71 |
// |
|
72 |
// Drive Name : Z: |
|
73 |
// Path : sys\bin |
|
74 |
// File Name : t_findcaptestfile.txt |
|
75 |
// |
|
76 |
// Expected return value: KErrNone |
|
77 |
Err=TestFind(_L("Drive specified & available Path exists File exists"), |
|
78 |
_L("z:\\sys\\bin\\"), |
|
79 |
_L("t_findcaptestfile.txt")); |
|
80 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
81 |
test_KErrNone(Err); |
0 | 82 |
|
83 |
// Test: Find non existing file in existing / non existing /sys folder |
|
84 |
// |
|
85 |
// Drive Name : C: |
|
86 |
// Path : sys |
|
87 |
// File Name : nonexisting.txt |
|
88 |
// |
|
89 |
// Expected return value: KErrNotFound |
|
90 |
Err=TestFind(_L("Drive specified & available Path may exist File does not exist"), |
|
91 |
_L("c:\\sys\\"), |
|
92 |
_L("nonexisting.txt")); |
|
93 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
94 |
test_Value(Err, Err == KErrNotFound); |
0 | 95 |
|
96 |
// Test: Find existing file in /sys folder without specifying the path |
|
97 |
// |
|
98 |
// Drive Name : Not specified. |
|
99 |
// Path : sys\bin |
|
100 |
// File Name : t_findcaptestfile.txt |
|
101 |
// |
|
102 |
// Expected return value: KErrNone |
|
103 |
Err=TestFind(_L("Drive not specified Path exists File exists"), |
|
104 |
_L("\\sys\\bin\\"), |
|
105 |
_L("t_findcaptestfile.txt")); |
|
106 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
107 |
test_KErrNone(Err); |
0 | 108 |
|
109 |
// Test: Find non existing file in /sys folder without specifying the path |
|
110 |
// |
|
111 |
// Drive Name : Not specified |
|
112 |
// Path : sys |
|
113 |
// File Name : nonexistingfile.txt |
|
114 |
// |
|
115 |
// Expected return value: KErrNotFound |
|
116 |
Err=TestFind(_L("Drive not specified Path exists File does not exist"), |
|
117 |
_L("\\sys\\"), |
|
118 |
_L("nonexisting.txt")); |
|
119 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
120 |
test_Value(Err, Err == KErrNotFound); |
0 | 121 |
|
122 |
FileServer.Close(); |
|
123 |
||
124 |
test.Printf(_L("Test completed\n")); |
|
125 |
||
126 |
test.End(); |
|
127 |
test.Close(); |
|
128 |
||
129 |
return KErrNone; |
|
130 |
} |