Update contrib.
1 // Copyright (c) 2005-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 "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
24 #include "GraphicsTestUtils.h"
26 const TUid KServerUid3={0x10281AD9};
30 static TInt StartServer()
32 // Start the server process. Simultaneous launching
33 // of two such processes should be detected when the second one attempts to
34 // create the server object, failing with KErrAlreadyExists.
37 const TUidType serverUid(KNullUid,KNullUid,KServerUid3);
40 r=server.Create(KTestServerImg,KNullDesC,serverUid);
46 server.Rendezvous(stat);
47 if (stat!=KRequestPending)
48 server.Kill(0); // abort startup
50 server.Resume(); // logon OK - start the server
51 User::WaitForRequest(stat); // wait for start or death
57 EXPORT_C TInt RSmlTestUtils::Connect()
59 // Connect to the server, attempting to start it if necessary
65 TInt r=CreateSession(KTestServerName,TVersion(0,0,0),1);
66 if (r!=KErrNotFound && r!=KErrServerTerminated)
71 if (r!=KErrNone && r!=KErrAlreadyExists)
77 EXPORT_C void RSmlTestUtils::SetDevIdL(const TDesC8& aDevId)
79 TIpcArgs args(&aDevId);
80 User::LeaveIfError(SendReceive(EChangeDevId,args));
83 EXPORT_C void RSmlTestUtils::GetDevIdL(TDes8& aDevId)
85 TIpcArgs args(&aDevId);
86 User::LeaveIfError(SendReceive(EGetDevId, args));
89 EXPORT_C TInt RSmlTestUtils::WipeDataStoreL(TWipeItems aItemsToClean)
91 // Package up the items to clean and send to server
92 TPckgBuf<TWipeItems> temp(aItemsToClean);
94 User::LeaveIfError(SendReceive(EWipeDataStore, args));
98 EXPORT_C TInt RSmlTestUtils::RenameDirectoryL(const TDesC16& aSrc,const TDesC16& aDest)
100 TIpcArgs args(&aSrc,&aDest);
101 TInt ret = SendReceive(ERenameDir, args);
105 EXPORT_C TInt RSmlTestUtils::CreateDirectoryL(const TDesC& aPath)
107 TIpcArgs args(&aPath);
108 TInt ret = SendReceive(ECreateDir, args);
112 EXPORT_C TInt RSmlTestUtils::DeleteDirectoryL(const TDesC& aPath)
114 TIpcArgs args(&aPath);
115 TInt ret = SendReceive(EDeleteDir, args);
119 EXPORT_C TInt RSmlTestUtils::CreateFileL(const TDesC& aPath)
121 TIpcArgs args(&aPath);
122 TInt ret = SendReceive(ECreateFile, args);
126 EXPORT_C TInt RSmlTestUtils::DeleteFileL(const TDesC& aPath)
128 TIpcArgs args(&aPath);
129 TInt ret = SendReceive(EDeleteFile, args);
133 EXPORT_C TInt RSmlTestUtils::DeleteFileUsingWildcardL(const TDesC& aPath)
135 TIpcArgs args(&aPath);
136 TInt ret = SendReceive(EDeleteFileUsingWildcard, args);
140 EXPORT_C TInt RSmlTestUtils::CopyFileL(const TDesC& aSrc,const TDesC& aDest)
142 TIpcArgs args(&aSrc,&aDest);
143 TInt ret = SendReceive(ECopyFile, args);
147 EXPORT_C void RSmlTestUtils::SetHomeTimeL(const TTime aTime)
149 TPckgBuf<TTime> temp(aTime);
150 TIpcArgs args(&temp);
151 User::LeaveIfError(SendReceive(ESetHomeTime, args));
154 EXPORT_C TInt RSmlTestUtils::ReplaceFileL(const TDesC& aName,TUint aFileMode)
156 TPckgBuf<TUint> temp(aFileMode);
157 TIpcArgs args(&aName,&temp);
158 TInt ret = SendReceive(EReplaceFile, args);
162 EXPORT_C TInt RSmlTestUtils::IsFilePresent(const TDesC& aName, TBool &aPresent)
164 TPckgBuf<TBool> present(aPresent);
165 TIpcArgs args(&aName,&present);
166 TInt ret = SendReceive(EIsFilePresent, args);
167 aPresent = present();
171 EXPORT_C TInt RSmlTestUtils::SetReadOnly(const TDesC& aName,TUint aSetAttMask)
173 TPckgBuf<TUint> temp(aSetAttMask);
174 TIpcArgs args(&aName,&temp);
175 TInt ret = SendReceive(ESetReadOnly,args);
180 EXPORT_C TInt RSmlTestUtils::GetAtt( const TDesC& aName, TUint& aAttValue )
182 TPckgBuf<TUint> attPckg( aAttValue );
183 TIpcArgs args( &aName, &attPckg );
184 TInt ret = SendReceive( EGetAttributes, args );
185 aAttValue = attPckg();
189 EXPORT_C TInt RSmlTestUtils::SetAtt( const TDesC &aName, TUint aSetAttMask, TUint aClearAttMask )
191 TIpcArgs args( &aName, &aSetAttMask, &aClearAttMask );
192 TInt ret = SendReceive( ESetAttributes, args );
196 EXPORT_C TInt RSmlTestUtils::CopyDirectoryL(const TDesC& aSource,const TDesC& aTarget)
198 TIpcArgs args(&aSource,&aTarget);
199 TInt ret = SendReceive(ECopyDirectory, args);
204 //clears the read-only attribute of the given filename
205 EXPORT_C TInt RSmlTestUtils::ChangeFilePermissionL(const TDesC& aPath)
207 TIpcArgs args(&aPath);
208 TInt ret = SendReceive(EChangeFilePermission, args);