1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/server/t_cp_plugin.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,145 @@
1.4 +// Copyright (c) 2007-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 +//
1.18 +//
1.19 +//
1.20 +
1.21 +
1.22 +#include <f32file.h>
1.23 +#include <e32ldr.h>
1.24 +#include <e32ldr_private.h>
1.25 +#include <e32test.h>
1.26 +#include <hal.h>
1.27 +#include "t_server.h"
1.28 +#include "f32dbg.h"
1.29 +
1.30 +
1.31 +GLDEF_D RTest test(_L("T_CP_PLUGIN"));
1.32 +
1.33 +// function decalarations
1.34 +void DoCodePagePluginTest();
1.35 +void TestUnicodeVolumeLabel();
1.36 +void TestShortNameBoundary();
1.37 +void TestConsistentShortNameGeneration();
1.38 +void TestConsistentShortNameExtGeneration();
1.39 +void TestDuplicateLongFileNames();
1.40 +void TestDuplicateLongDirNames();
1.41 +void TestLeadingE5Handling();
1.42 +void TestDEF130334();
1.43 +void TestINC127905();
1.44 +void DeleteTestDirectory();
1.45 +void TestCompatibility();
1.46 +void TestINC126563();
1.47 +
1.48 +// Codepage dll name
1.49 +_LIT(KCP932Name,"T_CP932");
1.50 +
1.51 +TInt LoadCodePageDll(const TDesC& aCodePageDllName)
1.52 + {
1.53 + RDebug::Printf("++ T_CP_PLUGIN.CPP LoadCodePageDll");
1.54 +
1.55 + TInt err = KErrNone;
1.56 + if(aCodePageDllName.Length())
1.57 + {
1.58 + RDebug::Print(_L("IS: codepageDllName = %S"), &aCodePageDllName);
1.59 + RLoader loader;
1.60 + err = loader.Connect();
1.61 + if (err==KErrNone)
1.62 + {
1.63 + err = loader.SendReceive(ELoadCodePage, TIpcArgs(0, &aCodePageDllName, 0));
1.64 + RDebug::Printf("\n T_CP_PLUGIN.CPP : LoadCodePageDll : loader.SendReceive == %d", err);
1.65 + loader.Close();
1.66 + }
1.67 + }
1.68 + RDebug::Printf("-- T_CP_PLUGIN.CPP LoadCodePageDll");
1.69 + return err;
1.70 + }
1.71 +
1.72 +void DoCodePagePluginTest()
1.73 + {
1.74 + RDebug::Printf("++ T_CP_PLUGIN.CPP DoCodePagePluginTestL");
1.75 +
1.76 + CreateTestDirectory(_L("\\F32-TST\\T_CP_PLUGIN\\"));
1.77 + TestUnicodeVolumeLabel();
1.78 + TestShortNameBoundary();
1.79 + TestConsistentShortNameGeneration();
1.80 + TestConsistentShortNameExtGeneration();
1.81 + TestDuplicateLongFileNames();
1.82 + TestDuplicateLongDirNames();
1.83 + TestLeadingE5Handling();
1.84 + TestDEF130334();
1.85 + TestINC127905();
1.86 + DeleteTestDirectory();
1.87 + TestCompatibility();
1.88 + TestINC126563();
1.89 +
1.90 + RDebug::Printf("-- T_CP_PLUGIN.CPP DoCodePagePluginTestL");
1.91 + }
1.92 +
1.93 +
1.94 +void CallTestsL(void)
1.95 + {
1.96 +
1.97 + test.Title();
1.98 + test.Start(_L("Starting T_CP_PLUGIN tests"));
1.99 +
1.100 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.101 +
1.102 + // Test only runs on Fat file systems
1.103 + TheFs.SessionPath(gSessionPath);
1.104 + TInt driveNum = CurrentDrive();
1.105 + TFSName name;
1.106 + TInt r = TheFs.FileSystemName(name, driveNum);
1.107 + if (KErrNone == r)
1.108 + {
1.109 + if (name.Compare(_L("Fat")) != 0)
1.110 + {
1.111 + test.Printf(_L("Test only runs on 'FAT' drives"));
1.112 + }
1.113 + else
1.114 + {
1.115 + TBuf<16> CodepageDllName(KCP932Name);
1.116 + r = LoadCodePageDll(CodepageDllName);
1.117 + test(r == KErrNone || r == KErrAlreadyExists);
1.118 +
1.119 + if(r == KErrNone)
1.120 + {
1.121 + // should not allow loading again codepage dll.
1.122 + r = LoadCodePageDll(CodepageDllName);
1.123 + test(r == KErrAlreadyExists);
1.124 +
1.125 + }
1.126 +
1.127 + // Enables codepage dll implementation of LocaleUtils functions
1.128 + TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
1.129 + test(KErrNone == r);
1.130 +
1.131 + DoCodePagePluginTest();
1.132 +
1.133 + // Disables codepage dll implementation of LocaleUtils functions for other base tests
1.134 + r = TheFs.ControlIo(driveNum, KControlIoDisableFatUtilityFunctions);
1.135 + test(r == KErrNone);
1.136 + }
1.137 + }
1.138 + else
1.139 + {
1.140 + test.Printf(_L("Drive %C: is not ready!"), 'A'+driveNum);
1.141 + test(EFalse);
1.142 + }
1.143 +#else
1.144 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.145 +#endif // _DEBUG) || _DEBUG_RELEASE
1.146 + test.End();
1.147 + }
1.148 +