1 // Copyright (c) 2002-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 // This file contains the test steps for Unit Test Suite 21 : ServerConsole.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 // EPOC includes |
|
19 #include <e32base.h> |
|
20 |
|
21 #include <w32std.h> |
|
22 |
|
23 // Test system includes |
|
24 #include <testframework.h> |
|
25 |
|
26 // Specific includes for this test suite |
|
27 #include "TSU_MmTsthStep21.h" |
|
28 #include "TSU_MmTsthSuite21.h" |
|
29 |
|
30 // Specific includes for these test steps |
|
31 #include "TSU_MmTsth21.h" |
|
32 #include "TestFrameworkServer/ServerConsole.h" |
|
33 |
|
34 // -------------------------------------------- |
|
35 |
|
36 // Unit Test Suite 21 : ServerConsole.cpp |
|
37 // Depends on : *** |
|
38 |
|
39 // Requires Active Scheduler in thread |
|
40 |
|
41 // Tests :- |
|
42 // Open Server Console |
|
43 // NB possible changes in code (anticipated : User Input) |
|
44 |
|
45 // -------------------------------------------- |
|
46 // RTestMmTsthU2101 |
|
47 |
|
48 RTestMmTsthU2101* RTestMmTsthU2101::NewL() |
|
49 { |
|
50 RTestMmTsthU2101* self = new(ELeave) RTestMmTsthU2101; |
|
51 return self; |
|
52 } |
|
53 |
|
54 // Each test step initialises its own name. |
|
55 RTestMmTsthU2101::RTestMmTsthU2101() |
|
56 { |
|
57 // store the name of this test case |
|
58 // this is the name that is used by the script file |
|
59 iTestStepName = _L("MM-TSTH-U-2101"); |
|
60 } |
|
61 |
|
62 // Do the test step. |
|
63 TVerdict RTestMmTsthU2101::DoTestStepL() |
|
64 { |
|
65 INFO_PRINTF1(_L("Unit test for ServerConsole")); |
|
66 |
|
67 TVerdict currentVerdict = EPass; |
|
68 |
|
69 CServerConsole* theConsole = NULL; |
|
70 TRAPD(err, theConsole = CServerConsole::NewL(_L("CServerConsole Test"))); |
|
71 if(err != KErrNone) |
|
72 { |
|
73 ERR_PRINTF1(_L("CServerConsole::NewL() left")); |
|
74 return iTestStepResult = EFail; |
|
75 } |
|
76 |
|
77 |
|
78 iConsole = theConsole; |
|
79 // will only work if this test is an MConsoleReader |
|
80 // *** NB! if we are running TestFramework in -F mode (i.e. no console output) this MAY |
|
81 // time out. |
|
82 iConsole->Read(*this); |
|
83 |
|
84 // call RunL() directly - not ideal but we have to test it somehow... |
|
85 // there is no window server so we can't simulate a keyboard event to call iConsoleReader->RunL() |
|
86 // this may have to be rewritten if full async keyboard handling is to be implemented |
|
87 TRAPD(err2, iConsole->RunL()); |
|
88 if(err2) |
|
89 { |
|
90 ERR_PRINTF2(_L("CServerConsole::RunL() left with error %d"), err2); |
|
91 delete iConsole; |
|
92 return iTestStepResult = EFail; |
|
93 }; |
|
94 |
|
95 INFO_PRINTF1(_L("Returned from RunL()")); |
|
96 |
|
97 // cleanup |
|
98 delete iConsole; |
|
99 return iTestStepResult = currentVerdict; // should be EPass if we've got here |
|
100 } |
|