author | Simon Howkins <simonh@symbian.org> |
Wed, 27 Oct 2010 16:22:14 +0100 | |
changeset 1284 | 0b4a09013baf |
parent 872 | 17498133d9ad |
permissions | -rw-r--r-- |
117
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
2 |
// All rights reserved. |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
3 |
// This component and the accompanying materials are made available |
872 | 4 |
// under the terms of the License "Eclipse Public License v1.0" |
117
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
5 |
// which accompanies this distribution, and is available |
872 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
117
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
7 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
8 |
// Initial Contributors: |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
9 |
// Nokia Corporation - initial contribution. |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
10 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
11 |
// Contributors: |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
12 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
13 |
// Description: |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
14 |
// TestServer - server implementation |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
15 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
16 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
17 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
18 |
#include "e32std.h" |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
19 |
#include "SmokeTestSecureFSserver.h" |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
20 |
#include <f32file.h> |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
21 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
22 |
TRequestStatus aStatus; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
23 |
TRequestStatus* aSt = &aStatus; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
24 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
25 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
26 |
inline CTestSecureFSshutdown::CTestSecureFSshutdown() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
27 |
:CTimer(-1) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
28 |
{CActiveScheduler::Add(this);} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
29 |
inline void CTestSecureFSshutdown::ConstructL() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
30 |
{CTimer::ConstructL();} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
31 |
inline void CTestSecureFSshutdown::Start() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
32 |
{After(KMyShutdownDelay);} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
33 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
34 |
inline CTestSecureFSserver::CTestSecureFSserver() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
35 |
:CServer2(0,ESharableSessions) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
36 |
{} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
37 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
38 |
inline CTestSecureFSSession::CTestSecureFSSession() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
39 |
{} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
40 |
inline CTestSecureFSserver& CTestSecureFSSession::Server() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
41 |
{return *static_cast<CTestSecureFSserver*>(const_cast<CServer2*>(CSession2::Server()));} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
42 |
inline TBool CTestSecureFSSession::ReceivePending() const |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
43 |
{return !iReceive.IsNull();} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
44 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
45 |
/////////////////////// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
46 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
47 |
void CTestSecureFSSession::CreateL() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
48 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
49 |
// 2nd phase construct for sessions - called by the CServer framework |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
50 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
51 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
52 |
//RDebug::Print(_L("Server::CTestSecureFSSession::CreateL - start")); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
53 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
54 |
Server().AddSession(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
55 |
//RDebug::Print(_L("Server::CTestSecureFSSession::CreateL - end")); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
56 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
57 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
58 |
CTestSecureFSSession::~CTestSecureFSSession() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
59 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
60 |
Server().DropSession(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
61 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
62 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
63 |
void CTestSecureFSSession::Send(const TDesC& aMessage) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
64 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
65 |
// Deliver the message to the client, truncating if required |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
66 |
// If the write fails, panic the client, not the sender |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
67 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
68 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
69 |
if (ReceivePending()) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
70 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
71 |
TPtrC m(aMessage); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
72 |
if (iReceive.Int1()<aMessage.Length()) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
73 |
m.Set(m.Left(iReceive.Int1())); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
74 |
TInt r=iReceive.Write(0,m); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
75 |
if (r==KErrNone) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
76 |
iReceive.Complete(KErrNone); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
77 |
else |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
78 |
PanicClient(iReceive,EPanicBadDescriptor); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
79 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
80 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
81 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
82 |
void CTestSecureFSSession::ServiceL(const RMessage2& aMessage) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
83 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
84 |
// Handle a client request. |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
85 |
// Leaving is handled by CMyServer::ServiceError() which reports |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
86 |
// the error code to the client |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
87 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
88 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
89 |
TInt result = KErrNone; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
90 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
91 |
switch (aMessage.Function()) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
92 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
93 |
case ETestIpcSetHomeTime: |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
94 |
DoSetHomeTime(aMessage); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
95 |
break; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
96 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
97 |
case ETestIpcDeleteFile: |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
98 |
result = DoDeleteFileL(aMessage); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
99 |
break; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
100 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
101 |
case ETestIpcKillProcess: |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
102 |
DoKillProcess(aMessage); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
103 |
break; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
104 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
105 |
case ETestIpcChangeLocale: |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
106 |
result = DoChangeLocale(aMessage); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
107 |
break; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
108 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
109 |
case ETestIpcCheckForFile: |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
110 |
result = DoCheckForFile(aMessage); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
111 |
break; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
112 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
113 |
case ETestIpcCopyFile: |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
114 |
result = DoCopyFile(aMessage); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
115 |
break; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
116 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
117 |
case ETestIpcSetUpFbs: |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
118 |
DoSetUpFbs(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
119 |
break; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
120 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
121 |
default: |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
122 |
PanicClient(aMessage,EPanicIllegalFunction); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
123 |
break; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
124 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
125 |
aMessage.Complete(result); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
126 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
127 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
128 |
//////////////////////////////////////// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
129 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
130 |
void CTestSecureFSSession::DoSetHomeTime(const RMessage2& aMessage) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
131 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
132 |
TPckgBuf<TTime> pckg; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
133 |
aMessage.Read(0,pckg); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
134 |
User::SetHomeTime(pckg()); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
135 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
136 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
137 |
TInt CTestSecureFSSession::DoDeleteFileL(const RMessage2& aMessage) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
138 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
139 |
RFs fs; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
140 |
TFileName* const fileName=new(ELeave) TFileName; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
141 |
CleanupStack::PushL(fileName); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
142 |
User::LeaveIfError(fs.Connect()); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
143 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
144 |
CleanupClosePushL(fs); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
145 |
aMessage.ReadL(0,*fileName); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
146 |
TInt err=fs.Delete(*fileName); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
147 |
if (!(err==KErrNone || err==KErrNotFound || err==KErrPathNotFound)) // ignore not found error |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
148 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
149 |
User::Leave(err); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
150 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
151 |
CleanupStack::PopAndDestroy(&fs); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
152 |
CleanupStack::PopAndDestroy(fileName); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
153 |
return err; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
154 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
155 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
156 |
void CTestSecureFSSession::DoKillProcess(const RMessage2& aMessage) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
157 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
158 |
TFullName* name = new(ELeave) TFullName; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
159 |
CleanupStack::PushL(name); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
160 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
161 |
aMessage.ReadL(0,*name); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
162 |
TFindProcess* finder = new (ELeave) TFindProcess(*name); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
163 |
CleanupStack::PushL(finder); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
164 |
RProcess* process = new (ELeave) RProcess; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
165 |
CleanupStack::PushL(process); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
166 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
167 |
if (finder->Next(*name) == KErrNone) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
168 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
169 |
if (process->Open(*name) == KErrNone) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
170 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
171 |
process->Kill(KErrNone); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
172 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
173 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
174 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
175 |
if (process != NULL) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
176 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
177 |
process->Close(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
178 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
179 |
CleanupStack::PopAndDestroy(process); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
180 |
CleanupStack::PopAndDestroy(finder); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
181 |
CleanupStack::PopAndDestroy(name); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
182 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
183 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
184 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
185 |
TInt CTestSecureFSSession::DoChangeLocale(const RMessage2& aMessage) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
186 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
187 |
TBuf<50> locname; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
188 |
TInt result; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
189 |
aMessage.ReadL(0,locname); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
190 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
191 |
result = UserSvr::ChangeLocale(locname); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
192 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
193 |
return result; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
194 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
195 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
196 |
TInt CTestSecureFSSession::DoCheckForFile(const RMessage2& aMessage) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
197 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
198 |
RFs fs; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
199 |
TInt err; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
200 |
TFileName* const fileName=new(ELeave) TFileName; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
201 |
CleanupStack::PushL(fileName); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
202 |
User::LeaveIfError(fs.Connect()); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
203 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
204 |
CleanupClosePushL(fs); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
205 |
aMessage.ReadL(0,*fileName); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
206 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
207 |
TUint attribs; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
208 |
err=fs.Att(*fileName, attribs); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
209 |
fs.Close(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
210 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
211 |
CleanupStack::PopAndDestroy(&fs); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
212 |
CleanupStack::PopAndDestroy(fileName); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
213 |
return err; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
214 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
215 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
216 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
217 |
TInt CTestSecureFSSession::DoCopyFile(const RMessage2& aMessage) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
218 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
219 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
220 |
RFs fs; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
221 |
TInt result; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
222 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
223 |
User::LeaveIfError(fs.Connect()); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
224 |
CleanupClosePushL(fs); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
225 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
226 |
TFileName fileSource; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
227 |
TFileName fileDest; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
228 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
229 |
aMessage.ReadL(0,fileSource); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
230 |
aMessage.ReadL(1,fileDest); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
231 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
232 |
CFileMan* fileMan = NULL; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
233 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
234 |
fileMan = CFileMan::NewL(fs); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
235 |
CleanupStack::PushL( fileMan ); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
236 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
237 |
fs.MkDirAll(fileDest); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
238 |
result = fileMan->Copy( fileSource, fileDest, CFileMan::EOverWrite ); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
239 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
240 |
User::LeaveIfError(fs.Connect()); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
241 |
fs.SetAtt(fileDest,KEntryAttNormal,KEntryAttReadOnly); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
242 |
fs.Close(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
243 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
244 |
CleanupStack::PopAndDestroy(fileMan); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
245 |
CleanupStack::PopAndDestroy(&fs); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
246 |
return result; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
247 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
248 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
249 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
250 |
void CTestSecureFSSession::DoSetUpFbs() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
251 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
252 |
// FbsStartup(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
253 |
// User::LeaveIfError( RFbsSession::Connect() ); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
254 |
// CleanupStack::PushL( TCleanupItem( TCleanupOperation(&RFbsSession::Disconnect ), NULL ) ); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
255 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
256 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
257 |
//////////////////////////////////////// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
258 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
259 |
void CTestSecureFSSession::ServiceError(const RMessage2& aMessage,TInt aError) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
260 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
261 |
// Handle an error from CMySession::ServiceL() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
262 |
// A bad descriptor error implies a badly programmed client, so panic it; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
263 |
// otherwise use the default handling (report the error to the client) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
264 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
265 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
266 |
if (aError==KErrBadDescriptor) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
267 |
PanicClient(aMessage,EPanicBadDescriptor); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
268 |
CSession2::ServiceError(aMessage,aError); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
269 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
270 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
271 |
void CTestSecureFSshutdown::RunL() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
272 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
273 |
// Initiate server exit when the timer expires |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
274 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
275 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
276 |
CActiveScheduler::Stop(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
277 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
278 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
279 |
CServer2* CTestSecureFSserver::NewLC() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
280 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
281 |
CTestSecureFSserver* self=new(ELeave) CTestSecureFSserver; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
282 |
CleanupStack::PushL(self); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
283 |
self->ConstructL(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
284 |
return self; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
285 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
286 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
287 |
void CTestSecureFSserver::ConstructL() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
288 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
289 |
// 2nd phase construction - ensure the timer and server objects are running |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
290 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
291 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
292 |
StartL(KTestServerName); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
293 |
iShutdown.ConstructL(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
294 |
// ensure that the server still exits even if the 1st client fails to connect |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
295 |
iShutdown.Start(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
296 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
297 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
298 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
299 |
CSession2* CTestSecureFSserver::NewSessionL(const TVersion&,const RMessage2&) const |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
300 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
301 |
// Cretae a new client session. This should really check the version number. |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
302 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
303 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
304 |
return new(ELeave) CTestSecureFSSession(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
305 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
306 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
307 |
void CTestSecureFSserver::AddSession() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
308 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
309 |
// A new session is being created |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
310 |
// Cancel the shutdown timer if it was running |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
311 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
312 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
313 |
++iSessionCount; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
314 |
iShutdown.Cancel(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
315 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
316 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
317 |
void CTestSecureFSserver::DropSession() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
318 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
319 |
// A session is being destroyed |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
320 |
// Start the shutdown timer if it is the last session. |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
321 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
322 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
323 |
if (--iSessionCount==0) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
324 |
iShutdown.Start(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
325 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
326 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
327 |
void CTestSecureFSserver::Send(const TDesC& aMessage) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
328 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
329 |
// Pass on the signal to all clients |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
330 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
331 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
332 |
iSessionIter.SetToFirst(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
333 |
CSession2* s; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
334 |
while ((s=iSessionIter++)!=0) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
335 |
static_cast<CTestSecureFSSession*>(s)->Send(aMessage); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
336 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
337 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
338 |
void PanicClient(const RMessage2& aMessage,TTestPanic aPanic) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
339 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
340 |
// RMessage::Panic() also completes the message. This is: |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
341 |
// (a) important for efficient cleanup within the kernel |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
342 |
// (b) a problem if the message is completed a second time |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
343 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
344 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
345 |
_LIT(KPanic,"TestServer"); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
346 |
aMessage.Panic(KPanic,aPanic); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
347 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
348 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
349 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
350 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
351 |
/** |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
352 |
Perform all server initialisation, in particular creation of the |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
353 |
scheduler and server and then run the scheduler |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
354 |
*/ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
355 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
356 |
static void RunServerL() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
357 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
358 |
// naming the server thread after the server helps to debug panics |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
359 |
User::LeaveIfError(RThread::RenameMe(KTestServerName)); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
360 |
// create and install the active scheduler we need |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
361 |
CActiveScheduler* s=new(ELeave) CActiveScheduler; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
362 |
CleanupStack::PushL(s); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
363 |
CActiveScheduler::Install(s); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
364 |
CTestSecureFSserver::NewLC(); // create the server (leave it on the cleanup stack) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
365 |
RProcess::Rendezvous(KErrNone); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
366 |
CActiveScheduler::Start(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
367 |
CleanupStack::PopAndDestroy(2); // Cleanup the server and scheduler |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
368 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
369 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
370 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
371 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
372 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
373 |
TInt E32Main() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
374 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
375 |
// Server process entry-point |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
376 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
377 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
378 |
__UHEAP_MARK; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
379 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
380 |
RDebug::Print(_L("Server::E32Main Version 0.0.0")); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
381 |
CTrapCleanup* cleanup=CTrapCleanup::New(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
382 |
TInt r=KErrNoMemory; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
383 |
if (cleanup) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
384 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
385 |
TRAP(r,RunServerL()); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
386 |
delete cleanup; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
387 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
388 |
// |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
389 |
__UHEAP_MARKEND; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
390 |
return r; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
391 |
} |