|
1 // Copyright (c) 2007-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 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #include "tcmd_step_coopsysperformshutdownactions.h" |
|
23 #include "ssmcustomcmdfactory.h" |
|
24 #include "cmdcoopsysperformshutdownactions.h" |
|
25 |
|
26 CCustomCmdTestCoopSysPerformShutdownActions::~CCustomCmdTestCoopSysPerformShutdownActions() |
|
27 { |
|
28 } |
|
29 |
|
30 CCustomCmdTestCoopSysPerformShutdownActions::CCustomCmdTestCoopSysPerformShutdownActions() |
|
31 { |
|
32 SetTestStepName(KTCCustomCmdTestCoopSysPerformShutdownActions); |
|
33 } |
|
34 |
|
35 /** |
|
36 Old Test CaseID APPFWK-CUSTCMD-0004 |
|
37 New Test CaseID DEVSRVS-SSREFPLUGINS-CUSTCMD-0004 |
|
38 */ |
|
39 |
|
40 void CCustomCmdTestCoopSysPerformShutdownActions::TestCustomCmdCoopSysPerformShutdownActionsL() |
|
41 { |
|
42 _LIT(KTESTLOG, "TestCustomCmdCoopSysPerformShutdownActionsL"); |
|
43 INFO_PRINTF1(KTESTLOG); |
|
44 |
|
45 MSsmCustomCommand* customCmdCoopSysPerformShutdownActions = SsmCustomCmdFactory::CmdCcoopSysPerformShutdownActionsNewL(); |
|
46 CSsmCustomCommandEnv* cmdEnv = NULL; |
|
47 |
|
48 //Initialise the command. CSsmCustomCommandEnv is not used inside the Initialize so passing |
|
49 //null should be fine. |
|
50 customCmdCoopSysPerformShutdownActions->Initialize(cmdEnv); |
|
51 |
|
52 TRequestStatus status; |
|
53 //Some dummy reason code |
|
54 TInt reason = 1; |
|
55 TPckgC<TInt> pckgReasonCode(reason); |
|
56 |
|
57 //Execute the command |
|
58 customCmdCoopSysPerformShutdownActions->Execute(pckgReasonCode, status); |
|
59 |
|
60 //Wait for the command to be completed |
|
61 User::WaitForRequest(status); |
|
62 |
|
63 TEST(KErrNone == status.Int()); |
|
64 |
|
65 //Execute the command once again |
|
66 customCmdCoopSysPerformShutdownActions->Execute(pckgReasonCode, status); |
|
67 |
|
68 TEST(KRequestPending == status.Int()); |
|
69 |
|
70 //Cancel the commmand execution. |
|
71 customCmdCoopSysPerformShutdownActions->ExecuteCancel(); |
|
72 |
|
73 //Refernce plugins doesnt have Cancel implementation and also by the time ExecuteCancel() |
|
74 // is called it might have completed executing Execute() function. Thats is the reason for |
|
75 //checking the status to KErrNone instead of KErrCancel. |
|
76 User::WaitForRequest(status); |
|
77 TEST(KErrNone == status.Int()); |
|
78 |
|
79 //Close the command |
|
80 customCmdCoopSysPerformShutdownActions->Close(); |
|
81 |
|
82 //Releasing the comand will delete itself. |
|
83 customCmdCoopSysPerformShutdownActions->Release(); |
|
84 } |
|
85 |
|
86 TVerdict CCustomCmdTestCoopSysPerformShutdownActions::doTestStepL() |
|
87 { |
|
88 __UHEAP_MARK; |
|
89 TestCustomCmdCoopSysPerformShutdownActionsL(); |
|
90 __UHEAP_MARKEND; |
|
91 return TestStepResult(); |
|
92 } |