|
1 // Copyright (c) 2004-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <mtmuids.h> |
|
17 #include "sendas2test.h" |
|
18 |
|
19 RTest test(_L("SendAs2 - Server shutdown testing")); |
|
20 |
|
21 const TInt KSendAsServerCloseTime = 2000000; // 2 seconds |
|
22 const TInt KSendAsServerWaitTime = 500000; // half a second |
|
23 _LIT(KSendAsServerName, "!SendAsServer*"); |
|
24 |
|
25 // |
|
26 TBool ServerRunning() |
|
27 { |
|
28 TFindServer findServer(KSendAsServerName); |
|
29 TFullName fullName; |
|
30 return (findServer.Next(fullName) == KErrNone); |
|
31 } |
|
32 |
|
33 void TestServerShutdownL() |
|
34 { |
|
35 RSendAs sendAs; |
|
36 |
|
37 theUtils->WriteComment(_L("\nEstablishing a connection with the server...")); |
|
38 test(sendAs.Connect() == KErrNone); // Establish a connection |
|
39 theUtils->WriteComment(_L("\tsuccess.")); |
|
40 |
|
41 theUtils->WriteComment(_L("\nChecking SendAs Server is running...")); |
|
42 test(ServerRunning()); // Check the server exe exists. |
|
43 theUtils->WriteComment(_L("\tsuccess.")); |
|
44 |
|
45 theUtils->WriteComment(_L("\nClosing session.")); |
|
46 sendAs.Close(); // Close session. |
|
47 |
|
48 theUtils->WriteComment(_L("\nWaiting less that the shutdown period for the server.")); |
|
49 User::After(KSendAsServerWaitTime); // Wait for less than the shut down period. |
|
50 |
|
51 theUtils->WriteComment(_L("\nChecking SendAs Server is running...")); |
|
52 test(ServerRunning()); // Check the server exe exists. |
|
53 theUtils->WriteComment(_L("\tsuccess.")); |
|
54 |
|
55 theUtils->WriteComment(_L("\nWaiting the shutdown period for the server.")); |
|
56 User::After(KSendAsServerCloseTime); // Wait for server shutdown delay. |
|
57 |
|
58 theUtils->WriteComment(_L("\nChecking SendAs Server is not running...")); |
|
59 test(!ServerRunning()); // Check the server exe no longer exists. |
|
60 theUtils->WriteComment(_L("\tsuccess.")); |
|
61 } |
|
62 |
|
63 void doTestsL() |
|
64 { |
|
65 theUtils->Start(_L("Server delayed shutdown test")); |
|
66 TestServerShutdownL(); // Qualified: No leavescan error |
|
67 theUtils->Complete(); |
|
68 } |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |