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