1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/server/t_findcapall.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,129 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// f32test\server\t_findcapall.cpp
1.18 +// PlatSec compatibility test. Application capability is ALLFILES
1.19 +// Tests to confirm DEF088224 changes do not affect exisitng functionality
1.20 +// TFindFile should NEVER return KErrPermissionDenied for FindByDir requests
1.21 +// z:\sys\bin\t_findcaptestfile.txt is used for testing.
1.22 +// If the file is not avialable in the location, test will panic.
1.23 +//
1.24 +//
1.25 +
1.26 +#include <e32test.h>
1.27 +#include <f32file.h>
1.28 +
1.29 +_LIT(KTestString,"t_findcapall");
1.30 +
1.31 +LOCAL_C RTest test(KTestString);
1.32 +
1.33 +LOCAL_C RFs FileServer;
1.34 +
1.35 +LOCAL_C TInt TestFind(const TPtrC16 aTestDesc, const TPtrC16 aFPath, const TPtrC16 aFName)
1.36 + {
1.37 + TInt Err;
1.38 + test.Next(aTestDesc);
1.39 + TFindFile FindFile(FileServer);
1.40 + Err=FindFile.FindByDir(aFName,aFPath);
1.41 + return Err;
1.42 + }
1.43 +
1.44 +
1.45 +GLDEF_C TInt E32Main()
1.46 + {
1.47 + TInt Err;
1.48 +
1.49 + test.Title();
1.50 +
1.51 + Err=FileServer.Connect();
1.52 +
1.53 + test(Err==KErrNone);
1.54 +
1.55 + // RTest.Next is called from function "TestFind()".
1.56 + // RTest.Start is called here to start the test.
1.57 + test.Start(_L("Test Starts : Dummy Test"));
1.58 +
1.59 + // Test: Find non existing file in existing /sys folder
1.60 + //
1.61 + // Drive Name : Z:
1.62 + // Path : sys\bin
1.63 + // File Name : nonexistingfile.txt
1.64 + //
1.65 + // Expected return value: KErrNotFound
1.66 + Err=TestFind(_L("Drive specified & available Path exists File does not exist"),
1.67 + _L("z:\\sys\\bin\\"),
1.68 + _L("nonexistingfile.txt"));
1.69 +
1.70 + test(Err==KErrNotFound);
1.71 +
1.72 + // Test: Find existing file in existing /sys folder
1.73 + //
1.74 + // Drive Name : Z:
1.75 + // Path : sys\bin
1.76 + // File Name : t_findcaptestfile.txt
1.77 + //
1.78 + // Expected return value: KErrNone
1.79 + Err=TestFind(_L("Drive specified & available Path exists File exists"),
1.80 + _L("z:\\sys\\bin\\"),
1.81 + _L("t_findcaptestfile.txt"));
1.82 +
1.83 + test(Err==KErrNone);
1.84 +
1.85 + // Test: Find non existing file in existing / non existing /sys folder
1.86 + //
1.87 + // Drive Name : C:
1.88 + // Path : sys
1.89 + // File Name : nonexisting.txt
1.90 + //
1.91 + // Expected return value: KErrNotFound
1.92 + Err=TestFind(_L("Drive specified & available Path may exist File does not exist"),
1.93 + _L("c:\\sys\\"),
1.94 + _L("nonexisting.txt"));
1.95 +
1.96 + test(Err==KErrNotFound);
1.97 +
1.98 + // Test: Find existing file in /sys folder without specifying the path
1.99 + //
1.100 + // Drive Name : Not specified.
1.101 + // Path : sys\bin
1.102 + // File Name : t_findcaptestfile.txt
1.103 + //
1.104 + // Expected return value: KErrNone
1.105 + Err=TestFind(_L("Drive not specified Path exists File exists"),
1.106 + _L("\\sys\\bin\\"),
1.107 + _L("t_findcaptestfile.txt"));
1.108 +
1.109 + test(Err==KErrNone);
1.110 +
1.111 + // Test: Find non existing file in /sys folder without specifying the path
1.112 + //
1.113 + // Drive Name : Not specified
1.114 + // Path : sys
1.115 + // File Name : nonexistingfile.txt
1.116 + //
1.117 + // Expected return value: KErrNotFound
1.118 + Err=TestFind(_L("Drive not specified Path exists File does not exist"),
1.119 + _L("\\sys\\"),
1.120 + _L("nonexisting.txt"));
1.121 +
1.122 + test(Err==KErrNotFound);
1.123 +
1.124 + FileServer.Close();
1.125 +
1.126 + test.Printf(_L("Test completed\n"));
1.127 +
1.128 + test.End();
1.129 + test.Close();
1.130 +
1.131 + return KErrNone;
1.132 + }