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