messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionIsUsingHardcodedDefaultSettings.cpp
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2004-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 // __ACTION_INFO_BEGIN__ 
       
    15 // [Action Name]
       
    16 // IsUsingHardcodedDefaultSettings
       
    17 // [Action Parameters]
       
    18 // Session        <input>: Reference to the session.
       
    19 // DefaultUsed    <input>: 1 if settings should be default settings, 0 otherwise.
       
    20 // ErrorCode	  <output>: (Optional) Returned error code, if not requested then code will
       
    21 // leave if not KErrNone
       
    22 // [Action Description]
       
    23 // Compares the default messaging settings to the current settings (i.e. those stored in msgs.ini).
       
    24 // [APIs Used]
       
    25 // MessageServer::CurrentDriveL()
       
    26 // __ACTION_INFO_END__
       
    27 // 
       
    28 //
       
    29 
       
    30 
       
    31 #include "CMtfTestActionIsUsingHardcodedDefaultSettings.h"
       
    32 #include "CMtfTestCase.h"
       
    33 #include "CMtfTestActionParameters.h"
       
    34 #include "MtfTestActionUtilsUser.h"
       
    35 
       
    36 
       
    37 CMtfTestAction* CMtfTestActionIsUsingHardcodedDefaultSettings::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    38 	{
       
    39 	CMtfTestActionIsUsingHardcodedDefaultSettings* self = new(ELeave) CMtfTestActionIsUsingHardcodedDefaultSettings(aTestCase);
       
    40 	CleanupStack::PushL(self);
       
    41 	self->ConstructL(aActionParameters);
       
    42 	CleanupStack::Pop(self);
       
    43 	return self;
       
    44 	}
       
    45 	
       
    46 
       
    47 CMtfTestActionIsUsingHardcodedDefaultSettings::CMtfTestActionIsUsingHardcodedDefaultSettings(CMtfTestCase& aTestCase)
       
    48 	: CMtfSynchronousTestAction(aTestCase)
       
    49 	{
       
    50 	}
       
    51 
       
    52 
       
    53 CMtfTestActionIsUsingHardcodedDefaultSettings::~CMtfTestActionIsUsingHardcodedDefaultSettings()
       
    54 	{
       
    55 	}
       
    56 
       
    57 void CMtfTestActionIsUsingHardcodedDefaultSettings::ExecuteActionL()
       
    58 	{
       
    59 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionIsUsingHardcodedDefaultSettings);
       
    60 
       
    61 	CMsvSession* paramSession	= ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
       
    62 
       
    63 	TInt defaultUsed			= ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1));
       
    64 
       
    65 	TDriveUnit currentDrive = MessageServer::CurrentDriveL(paramSession->FileSession());
       
    66 	TInt intCurrentDrive = currentDrive;
       
    67 	TDriveUnit defaultDrive = 2;	// The C: drive
       
    68 	TInt intDefaultDrive = defaultDrive;
       
    69 
       
    70 	TestCase().INFO_PRINTF1(_L("Current drive:"));
       
    71 	TestCase().INFO_PRINTF1(currentDrive.Name());
       
    72 
       
    73 	TestCase().INFO_PRINTF1(_L("Default drive:"));
       
    74 	TestCase().INFO_PRINTF1(defaultDrive.Name());
       
    75 
       
    76 	if (intCurrentDrive == intDefaultDrive)
       
    77 		{
       
    78 		TestCase().INFO_PRINTF1(_L("Current drive is the default drive."));
       
    79 		if (!defaultUsed)
       
    80 			{
       
    81 			TestCase().SetTestStepResult(EFail);
       
    82 			}
       
    83 		}
       
    84 	else
       
    85 		{
       
    86 		TestCase().INFO_PRINTF1(_L("Current drive is NOT the default drive."));
       
    87 		if (defaultUsed)
       
    88 			{
       
    89 			TestCase().SetTestStepResult(EFail);
       
    90 			}
       
    91 		}
       
    92 	
       
    93 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionIsUsingHardcodedDefaultSettings);
       
    94 
       
    95 	TestCase().ActionCompletedL(*this);
       
    96 	}