telephonyserverplugins/ctsydispatchlayer/test/dispatchertests/dispatchsrc/cctsyphonebookenfunegative.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 
       
    18 /**
       
    19  @file The TEFUnit test suite for PhonebookEnControl in the Common TSY.
       
    20 */
       
    21 
       
    22 #include "cctsyphonebookenfunegative.h"
       
    23 #include <etel.h>
       
    24 #include <etelmm.h>
       
    25 #include <et_clsvr.h>
       
    26 #include <ctsy/mmtsy_names.h>
       
    27 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    28 #include <test/tmockltsydata.h>
       
    29 #include <ctsy/serviceapi/gsmerror.h>
       
    30 #include <ctsy/ltsy/mltsydispatchphonebookeninterface.h>
       
    31 #include "listretrieverao.h"
       
    32 #include "config.h"
       
    33 
       
    34 
       
    35 CTestSuite* CCTsyPhonebookEnFUNegative::CreateSuiteL(const TDesC& aName)
       
    36 	{
       
    37 	SUB_SUITE;
       
    38   
       
    39 	//add other unit tests
       
    40 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookEnFUNegative, TestUnit0001L);
       
    41 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookEnFUNegative, TestUnit0002L);
       
    42 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookEnFUNegative, TestUnit0003L);
       
    43 	
       
    44 
       
    45 	END_SUITE;
       
    46 	}
       
    47 
       
    48 
       
    49 //
       
    50 // Other unit tests
       
    51 //
       
    52 
       
    53 /**
       
    54 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKEN-NEGATIVE-UN0001
       
    55 @SYMComponent telephony_ctsy
       
    56 @SYMTestCaseDesc Test support in CTSY for RMobileENStore::GetInfo()
       
    57 @SYMTestPriority High
       
    58 @SYMTestActions Invokes RMobileENStore::GetInfo()
       
    59 @SYMTestExpectedResults Pass
       
    60 @SYMTestType UT
       
    61 */
       
    62 void CCTsyPhonebookEnFUNegative::TestUnit0001L()
       
    63 	{
       
    64 	// write into the config file that the IPC is not supported
       
    65 	TConfig config;
       
    66 	config.SetSupportedValue(MLtsyDispatchPhonebookEnStoreGetInfo::KLtsyDispatchPhonebookEnStoreGetInfoApiId, EFalse);
       
    67 	
       
    68 	OpenEtelServerL(EUseExtendedError);
       
    69 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
    70 	OpenPhoneL();
       
    71 	
       
    72 	RMobileENStore enStore;
       
    73 	TInt ret = enStore.Open(iPhone);
       
    74 	ASSERT_EQUALS(ret, KErrNone);
       
    75 	CleanupClosePushL(enStore);
       
    76 	
       
    77 	TRequestStatus reqStatus;
       
    78 	
       
    79 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 enStoreInfoV1;
       
    80 	TPckg<RMobilePhoneStore::TMobilePhoneStoreInfoV1> pckgInfoV1(enStoreInfoV1);
       
    81 	
       
    82   
       
    83     //-------------------------------------------------------------------------
       
    84 	// TEST A: The request is not supported
       
    85  	//-------------------------------------------------------------------------
       
    86     
       
    87 	enStore.GetInfo(reqStatus, pckgInfoV1);		
       
    88     
       
    89     User::WaitForRequest(reqStatus);        
       
    90 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());	
       
    91 	
       
    92 	AssertMockLtsyStatusL();
       
    93 
       
    94 	config.Reset();
       
    95 	
       
    96 	CleanupStack::PopAndDestroy(2, this); // enStore, this
       
    97 	}
       
    98 
       
    99 
       
   100 /**
       
   101 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKEN-NEGATIVE-UN0002
       
   102 @SYMComponent telephony_ctsy
       
   103 @SYMTestCaseDesc Test support in CTSY for RMobileONStore::Read()
       
   104 @SYMTestPriority High
       
   105 @SYMTestActions Invokes RMobileONStore::Read()
       
   106 @SYMTestExpectedResults Pass
       
   107 @SYMTestType UT
       
   108 */
       
   109 void CCTsyPhonebookEnFUNegative::TestUnit0002L()
       
   110 	{
       
   111 	TConfig config;
       
   112 	config.SetSupportedValue(MLtsyDispatchPhonebookEnStoreReadEntry::KLtsyDispatchPhonebookEnStoreReadEntryApiId, EFalse);
       
   113 	
       
   114 	OpenEtelServerL(EUseExtendedError);
       
   115 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   116 	OpenPhoneL();
       
   117 	
       
   118 	RMobileENStore enStore;
       
   119 	TInt ret = enStore.Open(iPhone);
       
   120 	ASSERT_EQUALS(ret, KErrNone);
       
   121 	CleanupClosePushL(enStore);
       
   122 	
       
   123 	TRequestStatus reqStatus;
       
   124 	
       
   125 	TInt index = 10;
       
   126 	
       
   127 	RMobileENStore::TMobileENEntryV1 readEntry;
       
   128 	readEntry.iIndex = index;
       
   129 	TPckg<RMobileENStore::TMobileENEntryV1> pckgReadEntry(readEntry);
       
   130   
       
   131  	//-------------------------------------------------------------------------
       
   132 	// TEST A: The request is not supported
       
   133  	//-------------------------------------------------------------------------
       
   134 
       
   135 	enStore.Read(reqStatus, pckgReadEntry);		
       
   136     User::WaitForRequest(reqStatus);        
       
   137 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());	
       
   138 	
       
   139 	AssertMockLtsyStatusL();
       
   140     
       
   141 	config.Reset();
       
   142 	CleanupStack::PopAndDestroy(2, this); // onStore, this
       
   143 	}
       
   144 	
       
   145 /**
       
   146 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKEN-NEGATIVE-UN0003
       
   147 @SYMComponent telephony_ctsy
       
   148 @SYMTestCaseDesc Test support in CTSY for CRetrieveMobilePhoneENList::Start()
       
   149 @SYMTestPriority High
       
   150 @SYMTestActions Invokes CRetrieveMobilePhoneENList::Start()
       
   151 @SYMTestExpectedResults Pass
       
   152 @SYMTestType UT
       
   153 */
       
   154 void CCTsyPhonebookEnFUNegative::TestUnit0003L()
       
   155 	{
       
   156 	TConfig config;
       
   157 	config.SetSupportedValue(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, EFalse);
       
   158 		
       
   159 	OpenEtelServerL(EUseExtendedError);
       
   160 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   161 	OpenPhoneL();
       
   162 
       
   163 	RMobileENStore enStore;
       
   164 	TInt err = enStore.Open(iPhone);
       
   165 	ASSERT_EQUALS(KErrNone, err);
       
   166 	CleanupClosePushL(enStore);
       
   167 
       
   168 	CGetENListAO* getEnListAO = CGetENListAO::NewLC(enStore);
       
   169 
       
   170     //-------------------------------------------------------------------------
       
   171 	// TEST A: The request is not supported
       
   172  	//-------------------------------------------------------------------------
       
   173   
       
   174     getEnListAO->TestRetrieveL();
       
   175     ASSERT_EQUALS(KErrNotSupported, getEnListAO->RetrieveLastError());
       
   176 
       
   177     AssertMockLtsyStatusL();
       
   178     
       
   179     config.Reset();
       
   180 	CleanupStack::PopAndDestroy(3, this); // getEnListAO, enStore, this	
       
   181 	}	
       
   182 
       
   183