telephonyserverplugins/common_tsy/test/component/src/cctsysystemstate.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     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 // The TEFUnit test for the access to the System State from the Common TSY.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20 */
       
    21 
       
    22 #include "cctsysystemstate.h"
       
    23 #include <ctsy/mmtsy_names.h>
       
    24 #include "tmockltsydata.h"
       
    25 
       
    26 CTestSuite* CCTsySystemState::CreateSuiteL(const TDesC& aName)
       
    27 	{
       
    28 	SUB_SUITE;
       
    29 	ADD_TEST_STEP_ISO_CPP(CCTsySystemState, TestSystemState0001L);
       
    30 	END_SUITE;
       
    31 	}
       
    32 
       
    33 //
       
    34 // Actual test cases
       
    35 //
       
    36 
       
    37 /**
       
    38 @SYMTestCaseID BA-CTSY-SYSS-SYSSPLG-0001
       
    39 @SYMComponent telephony_ctsy
       
    40 @SYMTestCaseDesc Test that System State plugin is loaded correctly
       
    41 @SYMTestPriority High
       
    42 @SYMTestActions Attempts to dial an emergency call. This will cause the System State plugin to be loaded.
       
    43 @SYMTestExpectedResults Pass
       
    44 @SYMTestType CT
       
    45 */
       
    46 void CCTsySystemState::TestSystemState0001L()
       
    47 	{
       
    48 	OpenEtelServerL(EUseExtendedError);
       
    49 	CleanupStack::PushL(TCleanupItem(Cleanup,this)); // PUSH #1
       
    50 	OpenPhoneL();
       
    51 
       
    52 	RBuf8 data;
       
    53 	CleanupClosePushL(data);   // PUSH #2
       
    54 
       
    55 	RMobileCall mobileCall;
       
    56 	RLine line;
       
    57 
       
    58 	TInt err = line.Open(iPhone, KMmTsyVoice1LineName);
       
    59 	ASSERT_EQUALS(KErrNone, err);
       
    60 	CleanupClosePushL(line);  // PUSH #3
       
    61 	
       
    62 	err = OpenNewCall(line, mobileCall, KMmTsyVoice1LineName);
       
    63 	ASSERT_EQUALS(KErrNone, err);
       
    64 	CleanupClosePushL(mobileCall); // PUSH #4
       
    65 
       
    66 	RMobileENStore::TEmergencyNumber number(_L("911"));
       
    67 	TMockLtsyData1<RMobileENStore::TEmergencyNumber> numberLtsyData(number);
       
    68 	numberLtsyData.SerialiseL(data);
       
    69 	iMockLTSY.ExpectL(EMobileCallDialEmergencyCall, data, KErrNotSupported);
       
    70 
       
    71 	TRequestStatus reqStatus;
       
    72 	mobileCall.DialEmergencyCall(reqStatus, number);
       
    73 
       
    74 	// failure to load system state plugin will result in DialEmergencyCall completing with KErrNotFound
       
    75 	User::WaitForRequest(reqStatus);
       
    76 	INFO_PRINTF2(_L("CCTsyFeatMgr::TestSystemState0001: DialEmergencyCall request completed with error %d"),reqStatus.Int());
       
    77 	ASSERT_FALSE(KErrNotFound == reqStatus.Int());
       
    78 	CleanupStack::PopAndDestroy(2); // mobileCall, line
       
    79 	AssertMockLtsyStatusL();
       
    80 	
       
    81 	CleanupStack::PopAndDestroy(2, this); // data, this
       
    82 	}