telephonyserverplugins/ctsydispatchlayer/test/dispatchertests/dispatchsrc/cctsycellbroadcastfunegative.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-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 #include "cctsycellbroadcastfunegative.h"
       
    18 
       
    19 #include <etelmm.h>
       
    20 #include "config.h"
       
    21 #include <ctsy/ltsy/mltsydispatchcellbroadcastinterface.h>
       
    22 #include <test/tmockltsydata.h>
       
    23 #include "mockltsyindicatorids.h"
       
    24 
       
    25 /* static */
       
    26 CTestSuite* CCTsyCellBroadcastFUNegative::CreateSuiteL(const TDesC& aName)
       
    27 	{
       
    28 	SUB_SUITE;
       
    29   
       
    30 	ADD_TEST_STEP_ISO_CPP(CCTsyCellBroadcastFUNegative, TestMessagingReceiveMessageL);
       
    31 	ADD_TEST_STEP_ISO_CPP(CCTsyCellBroadcastFUNegative, TestMessagingReceiveMessageCancelL);
       
    32 	ADD_TEST_STEP_ISO_CPP(CCTsyCellBroadcastFUNegative, TestSetBroadcastFilterSettingL);
       
    33 	ADD_TEST_STEP_ISO_CPP(CCTsyCellBroadcastFUNegative, TestStartSimCbTopicBrowsingL);
       
    34 	ADD_TEST_STEP_ISO_CPP(CCTsyCellBroadcastFUNegative, TestDeleteSimCbTopicL);
       
    35 	END_SUITE;
       
    36 	}
       
    37 
       
    38 
       
    39 /**
       
    40  * @SYMTestCaseID BA-CTSYD-DIS-CELLBROADCAST-NEGATIVE-UC0001
       
    41  * @SYMComponent telephony_ctsy
       
    42  * @SYMTestCaseDesc Test handing in SIM CTSY dispatch when the ActivateBroadcastReceiveMessage API is disabled 
       
    43  * @SYMTestPriority High
       
    44  * @SYMTestActions Disable API, call API, check correct error returned
       
    45  * @SYMTestExpectedResults Pass
       
    46  * @SYMTestType CT
       
    47  */
       
    48 void CCTsyCellBroadcastFUNegative::TestMessagingReceiveMessageL()
       
    49 	{
       
    50 	TConfig config;
       
    51 	config.SetSupportedValue(MLtsyDispatchCellBroadcastActivateBroadcastReceiveMessage::KLtsyDispatchCellBroadcastActivateBroadcastReceiveMessageApiId, EFalse);
       
    52 	config.PushL();
       
    53 	
       
    54 	OpenEtelServerL(EUseExtendedError);
       
    55 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
    56 	OpenPhoneL();
       
    57 	
       
    58 	RMobileBroadcastMessaging messaging;
       
    59 	TInt err = messaging.Open(iPhone);
       
    60 	ASSERT_EQUALS(KErrNone, err);
       
    61 	CleanupClosePushL(messaging);
       
    62 	
       
    63 	TRequestStatus reqStatus;
       
    64 	RMobileBroadcastMessaging::TBroadcastPageData msgData;
       
    65 	RMobileBroadcastMessaging::TMobileBroadcastAttributesV1 attributes;
       
    66 	RMobileBroadcastMessaging::TMobileBroadcastAttributesV1Pckg msgAttributes(attributes);
       
    67 	messaging.ReceiveMessage(reqStatus, msgData, msgAttributes);
       
    68 				
       
    69 	User::WaitForRequest(reqStatus);
       
    70 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
    71 	
       
    72 	AssertMockLtsyStatusL();
       
    73 
       
    74 	CleanupStack::PopAndDestroy(3, &config); // messaging, this, config
       
    75 	}
       
    76 
       
    77 
       
    78 /**
       
    79  * @SYMTestCaseID BA-CTSYD-DIS-CELLBROADCAST-NEGATIVE-UC0002
       
    80  * @SYMComponent telephony_ctsy
       
    81  * @SYMTestCaseDesc Test handing in SIM CTSY dispatch when the ReceiveMessageCancel API is disabled 
       
    82  * @SYMTestPriority High
       
    83  * @SYMTestActions Disable API, call API, check correct error returned
       
    84  * @SYMTestExpectedResults Pass
       
    85  * @SYMTestType CT
       
    86  */
       
    87 void CCTsyCellBroadcastFUNegative::TestMessagingReceiveMessageCancelL()
       
    88 	{
       
    89 	TConfig config;
       
    90 	//config.SetSupportedValue(MLtsyDispatchCellBroadcastActivateBroadcastReceiveMessage::KLtsyDispatchCellBroadcastActivateBroadcastReceiveMessageApiId, EFalse);
       
    91 	config.SetSupportedValue(MLtsyDispatchCellBroadcastReceiveMessageCancel::KLtsyDispatchCellBroadcastReceiveMessageCancelApiId, EFalse);
       
    92 	config.PushL();
       
    93 	
       
    94 	OpenEtelServerL(EUseExtendedError);
       
    95 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
    96 	OpenPhoneL();
       
    97 	
       
    98 	RMobileBroadcastMessaging messaging;
       
    99 	TInt err = messaging.Open(iPhone);
       
   100 	ASSERT_EQUALS(KErrNone, err);
       
   101 	CleanupClosePushL(messaging);
       
   102 	
       
   103 	// setting environment ( CMmBroadcastTsy::iCbRoutingActivated to ETrue)
       
   104 	TRequestStatus reqStatus;
       
   105 	iMockLTSY.NotifyTerminated(reqStatus);	
       
   106     iMockLTSY.CompleteL(MLtsyDispatchCellBroadcastActivateBroadcastReceiveMessage::KLtsyDispatchCellBroadcastActivateBroadcastReceiveMessageApiId, KErrNone);
       
   107 	User::WaitForRequest(reqStatus);
       
   108 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   109 	AssertMockLtsyStatusL();
       
   110 	
       
   111 	TRequestStatus status;
       
   112 	RMobileBroadcastMessaging::TBroadcastPageData msgData;
       
   113 	RMobileBroadcastMessaging::TMobileBroadcastAttributesV1 attributes;
       
   114 	RMobileBroadcastMessaging::TMobileBroadcastAttributesV1Pckg msgAttributes(attributes);
       
   115 	messaging.ReceiveMessage(status, msgData, msgAttributes);
       
   116 	messaging.CancelAsyncRequest(EMobileBroadcastMessagingReceiveMessage);
       
   117 				
       
   118 	User::WaitForRequest(status);
       
   119 	ASSERT_EQUALS(KErrNotSupported, status.Int());
       
   120 	
       
   121 	AssertMockLtsyStatusL();
       
   122 
       
   123 	config.Reset();
       
   124 	CleanupStack::PopAndDestroy(3, &config); // messaging, this, config
       
   125 	}
       
   126 
       
   127 
       
   128 /**
       
   129  * @SYMTestCaseID BA-CTSYD-DIS-CELLBROADCAST-NEGATIVE-UC0003
       
   130  * @SYMComponent telephony_ctsy
       
   131  * @SYMTestCaseDesc Test handing in SIM CTSY dispatch when the SetBroadcastFilterSetting API is disabled 
       
   132  * @SYMTestPriority High
       
   133  * @SYMTestActions Disable API, call API, check correct error returned
       
   134  * @SYMTestExpectedResults Pass
       
   135  * @SYMTestType CT
       
   136  */
       
   137 void CCTsyCellBroadcastFUNegative::TestSetBroadcastFilterSettingL()
       
   138 	{
       
   139 	TConfig config;
       
   140 	config.SetSupportedValue(MLtsyDispatchCellBroadcastSetBroadcastFilterSetting::KLtsyDispatchCellBroadcastSetBroadcastFilterSettingApiId, EFalse);
       
   141 	config.PushL();
       
   142 	
       
   143 	OpenEtelServerL(EUseExtendedError);
       
   144 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   145 	OpenPhoneL();
       
   146 	
       
   147 	RMobileBroadcastMessaging messaging;
       
   148 	TInt err = messaging.Open(iPhone);
       
   149 	ASSERT_EQUALS(KErrNone, err);
       
   150 	CleanupClosePushL(messaging);
       
   151 	
       
   152 	// set CMmBroadcastTsy::iCbRoutingActivated to ETrue
       
   153 	TRequestStatus reqStatus;
       
   154 	iMockLTSY.NotifyTerminated(reqStatus);	
       
   155 	iMockLTSY.CompleteL(MLtsyDispatchCellBroadcastActivateBroadcastReceiveMessage::KLtsyDispatchCellBroadcastActivateBroadcastReceiveMessageApiId, KErrNone);
       
   156 	User::WaitForRequest(reqStatus);
       
   157 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   158 	AssertMockLtsyStatusL();
       
   159 	
       
   160 	TRequestStatus status;
       
   161 	messaging.SetFilterSetting(status, RMobileBroadcastMessaging::EBroadcastAcceptNone);
       
   162 	ASSERT_EQUALS(KErrNotSupported, status.Int());
       
   163 	
       
   164 	AssertMockLtsyStatusL();
       
   165 	
       
   166 	config.Reset();	
       
   167 	CleanupStack::PopAndDestroy(3, &config); // messaging, this, config
       
   168 	}
       
   169 
       
   170 
       
   171 /**
       
   172  * @SYMTestCaseID BA-CTSYD-DIS-CELLBROADCAST-NEGATIVE-UC0004
       
   173  * @SYMComponent telephony_ctsy
       
   174  * @SYMTestCaseDesc Test handing in SIM CTSY dispatch when the StartSimCbTopicBrowsing API is disabled 
       
   175  * @SYMTestPriority High
       
   176  * @SYMTestActions Disable API, call API, check correct error returned
       
   177  * @SYMTestExpectedResults Pass
       
   178  * @SYMTestType CT
       
   179  */
       
   180 void CCTsyCellBroadcastFUNegative::TestStartSimCbTopicBrowsingL()
       
   181 	{
       
   182 	TConfig config;
       
   183 	config.SetSupportedValue(MLtsyDispatchCellBroadcastStartSimCbTopicBrowsing::KLtsyDispatchCellBroadcastStartSimCbTopicBrowsingApiId, EFalse);
       
   184 	config.PushL();
       
   185 	
       
   186 	OpenEtelServerL(EUseExtendedError);
       
   187 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   188 	OpenPhoneL();
       
   189 	
       
   190 	RMmCustomAPI customAPI;
       
   191 	// If you call customAPI.Open(iPhone) directly AssertMockLtsyStatusL will fail
       
   192 	OpenCustomApiLC(customAPI);
       
   193 		
       
   194 	TRequestStatus status;
       
   195 
       
   196 	TInt ret = customAPI.StartSimCbTopicBrowsing();
       
   197 	ASSERT_EQUALS(KErrNotSupported, ret);
       
   198 	
       
   199 	AssertMockLtsyStatusL();
       
   200 	
       
   201 	config.Reset();	
       
   202 	CleanupStack::PopAndDestroy(3, &config); // customAPI, this, config
       
   203 	}
       
   204 
       
   205 
       
   206 /**
       
   207  * @SYMTestCaseID BA-CTSYD-DIS-CELLBROADCAST-NEGATIVE-UC0005
       
   208  * @SYMComponent telephony_ctsy
       
   209  * @SYMTestCaseDesc Test handing in SIM CTSY dispatch when the DeleteSimCbTopic API is disabled 
       
   210  * @SYMTestPriority High
       
   211  * @SYMTestActions Disable API, call API, check correct error returned
       
   212  * @SYMTestExpectedResults Pass
       
   213  * @SYMTestType CT
       
   214  */
       
   215 void CCTsyCellBroadcastFUNegative::TestDeleteSimCbTopicL()
       
   216 	{
       
   217 	TConfig config;
       
   218 	config.SetSupportedValue(MLtsyDispatchCellBroadcastDeleteSimCbTopic::KLtsyDispatchCellBroadcastDeleteSimCbTopicApiId, EFalse);
       
   219 	config.PushL();
       
   220 	
       
   221 	OpenEtelServerL(EUseExtendedError);
       
   222 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   223 	OpenPhoneL();
       
   224 	
       
   225 	RMmCustomAPI customAPI;
       
   226 	OpenCustomApiLC(customAPI);
       
   227 	
       
   228 	TUint index(0);
       
   229 	TRequestStatus status;
       
   230 
       
   231 	customAPI.DeleteSimCbTopic(status, index);;
       
   232 	User::WaitForRequest(status);
       
   233 	ASSERT_EQUALS(KErrNotSupported, status.Int());
       
   234 
       
   235 	AssertMockLtsyStatusL();
       
   236 	
       
   237 	config.Reset();	
       
   238 	CleanupStack::PopAndDestroy(3, &config); // customAPI, this, config
       
   239 	}