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