sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/src/tcmd_step_activaterfforemergencycall.cpp
equal
deleted
inserted
replaced
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
20 */ |
20 */ |
21 |
21 |
22 #include "tcmd_step_activaterfforemergencycall.h" |
22 #include "tcmd_step_activaterfforemergencycall.h" |
23 #include "ssmcustomcmdfactory.h" |
23 #include "ssmcustomcmdfactory.h" |
24 #include "cmdactivaterfforemergencycall.h" |
24 #include "cmdactivaterfforemergencycall.h" |
|
25 #include <e32property.h> |
|
26 const TUint32 KEmergencyCallRfAdaptationPluginPropertyKey = 0x2000E657; |
|
27 const TUid KPropertyCategory={0x2000D75B}; |
25 |
28 |
26 CCustomCmdTestActivateRfForEmergencyCall::~CCustomCmdTestActivateRfForEmergencyCall() |
29 CCustomCmdTestActivateRfForEmergencyCall::~CCustomCmdTestActivateRfForEmergencyCall() |
27 { |
30 { |
28 } |
31 } |
29 |
32 |
39 |
42 |
40 void CCustomCmdTestActivateRfForEmergencyCall::TestCustomCmdActivateRfForEmergencyCallL() |
43 void CCustomCmdTestActivateRfForEmergencyCall::TestCustomCmdActivateRfForEmergencyCallL() |
41 { |
44 { |
42 _LIT(KTESTLOG, "TestCustomCmdActivateRfForEmergencyCallL"); |
45 _LIT(KTESTLOG, "TestCustomCmdActivateRfForEmergencyCallL"); |
43 INFO_PRINTF1(KTESTLOG); |
46 INFO_PRINTF1(KTESTLOG); |
|
47 // Setting the P and S key will route the request to the reference plugins instead of the actual plugins |
|
48 TInt err = RProperty::Define(KPropertyCategory, KEmergencyCallRfAdaptationPluginPropertyKey, RProperty::EInt); |
|
49 TEST(KErrNone == err || KErrAlreadyExists == err); |
|
50 err = RProperty::Set(KPropertyCategory, KEmergencyCallRfAdaptationPluginPropertyKey, 1); |
|
51 TEST(KErrNone == err); |
44 |
52 |
45 //Create Deactivate Rf For Emergency Call custom command |
53 //Create Deactivate Rf For Emergency Call custom command |
46 MSsmCustomCommand* customCmdActivateRfForEmergencyCall = SsmCustomCmdFactory::CmdActivateRfForEmergencyCallNewL(); |
54 MSsmCustomCommand* customCmdActivateRfForEmergencyCall = SsmCustomCmdFactory::CmdActivateRfForEmergencyCallNewL(); |
47 CSsmCustomCommandEnv* cmdEnv = NULL; |
55 CSsmCustomCommandEnv* cmdEnv = NULL; |
48 |
56 |
54 TBufC8<1> dummy; |
62 TBufC8<1> dummy; |
55 |
63 |
56 //Command parameter is not used inside the Execute. So passing any dummy data should be fine |
64 //Command parameter is not used inside the Execute. So passing any dummy data should be fine |
57 //Execute the command |
65 //Execute the command |
58 customCmdActivateRfForEmergencyCall->Execute(dummy, status); |
66 customCmdActivateRfForEmergencyCall->Execute(dummy, status); |
59 TEST(KRequestPending == status.Int()); |
|
60 |
67 |
61 //Wait for the request to be completed |
68 //Wait for the request to be completed |
62 User::WaitForRequest(status); |
69 User::WaitForRequest(status); |
63 TEST(KErrNone == status.Int()); |
70 TEST(KErrNone == status.Int()); |
64 |
71 |
65 //Execute the command once again |
72 //Execute the command once again |
66 customCmdActivateRfForEmergencyCall->Execute(dummy, status); |
73 customCmdActivateRfForEmergencyCall->Execute(dummy, status); |
67 |
74 |
68 //Cancel the commmand execution. |
75 //Cancel the commmand execution. |
69 customCmdActivateRfForEmergencyCall->ExecuteCancel(); |
76 customCmdActivateRfForEmergencyCall->ExecuteCancel(); |
71 //Refernce plugins doesnt have Cancel implementation and also by the time ExecuteCancel() |
78 //Refernce plugins doesnt have Cancel implementation and also by the time ExecuteCancel() |
72 //is called it might have completed executing Execute() function. Thats is the reason for |
79 //is called it might have completed executing Execute() function. Thats is the reason for |
73 //checking the status to KErrNone instead of KErrCancel. |
80 //checking the status to KErrNone instead of KErrCancel. |
74 User::WaitForRequest(status); |
81 User::WaitForRequest(status); |
75 TEST(KErrNone == status.Int()); |
82 TEST(KErrNone == status.Int()); |
76 |
83 |
77 //Close the command |
84 //Close the command |
78 customCmdActivateRfForEmergencyCall->Close(); |
85 customCmdActivateRfForEmergencyCall->Close(); |
79 |
86 |
80 //Releasing the comand will delete itself. |
87 //Releasing the comand will delete itself. |
81 customCmdActivateRfForEmergencyCall->Release(); |
88 customCmdActivateRfForEmergencyCall->Release(); |
|
89 err = RProperty::Delete(KPropertyCategory, KEmergencyCallRfAdaptationPluginPropertyKey); |
|
90 TEST(KErrNone == err); |
82 } |
91 } |
83 |
92 |
84 TVerdict CCustomCmdTestActivateRfForEmergencyCall::doTestStepL() |
93 TVerdict CCustomCmdTestActivateRfForEmergencyCall::doTestStepL() |
85 { |
94 { |
86 __UHEAP_MARK; |
95 __UHEAP_MARK; |