linklayercontrol/networkinterfacemgr/ts_nifmanbc/NifmanBCTestSuite.cpp
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2002-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 #include "NifmanBCTestSuite.h"
       
    17 #include "BCTestSection1.h"
       
    18 #include "BCTestSection2.h"
       
    19 #include <c32comm.h>
       
    20 
       
    21 
       
    22 
       
    23 EXPORT_C CNifmanBCTestSuite* NewNifmanBCTestSuiteL()
       
    24 //
       
    25 // NewTestSuiteNifmanL is exported at ordinal 1
       
    26 // this provides the interface to allow schedule test
       
    27 // to create instances of this test suite
       
    28 //
       
    29 	{
       
    30 
       
    31 	return new(ELeave) CNifmanBCTestSuite();
       
    32     }
       
    33 
       
    34 
       
    35 CNifmanBCTestSuite::~CNifmanBCTestSuite()
       
    36 //
       
    37 // D'tor
       
    38 //
       
    39 	{
       
    40 	}
       
    41 
       
    42 
       
    43 TPtrC CNifmanBCTestSuite::GetVersion()
       
    44 //
       
    45 // Make a version string available for test system
       
    46 //	
       
    47 	{
       
    48 	
       
    49 	_LIT(KTxtVersion,"1.0");
       
    50 	return KTxtVersion();
       
    51 	}
       
    52 
       
    53 
       
    54 void CNifmanBCTestSuite::AddTestStepL(CNifmanBCTestStep* aTestStep)
       
    55 //
       
    56 // Add a test step into the suite
       
    57 //
       
    58 	{
       
    59 
       
    60 	// test steps contain a pointer back to the suite which owns them
       
    61 	aTestStep->iTestSuite = this; 
       
    62 
       
    63 	// add the step using tyhe base class method
       
    64 	CTestSuite::AddTestStepL(aTestStep);
       
    65 	}
       
    66 
       
    67 
       
    68 void CNifmanBCTestSuite::InitialiseL()
       
    69 //
       
    70 // Constructor for Nifman BC test suite
       
    71 // this creates the Nifman BC test steps and
       
    72 // stores them inside CNifmanBCTestSuite
       
    73 //
       
    74 	{
       
    75 
       
    76 	TInt err = CommsInit();
       
    77 	if(err!=KErrNone)
       
    78 		{
       
    79 		Log(_L("CommsInit() returned error %d"));
       
    80 		User::Leave(err);
       
    81 		}
       
    82 
       
    83 	// add test steps
       
    84 	AddTestStepL(new(ELeave) CTestStep1_1());
       
    85 	AddTestStepL(new(ELeave) CTestStep1_2());
       
    86 	AddTestStepL(new(ELeave) CTestStep1_3());
       
    87 	AddTestStepL(new(ELeave) CTestStep1_4());
       
    88 	AddTestStepL(new(ELeave) CTestStep1_5());
       
    89 	AddTestStepL(new(ELeave) CTestStep1_6());
       
    90 	AddTestStepL(new(ELeave) CTestStep1_7());
       
    91 	AddTestStepL(new(ELeave) CTestStep2_1());
       
    92 	AddTestStepL(new(ELeave) CTestStep2_2());
       
    93 	AddTestStepL(new(ELeave) CTestStep2_3());
       
    94 	AddTestStepL(new(ELeave) CTestStep2_4());
       
    95 	}
       
    96 
       
    97 TInt CNifmanBCTestSuite::CommsInit()
       
    98 //
       
    99 // Load the serial comms PDD and LDD.
       
   100 //
       
   101 // This would normally be done by the 
       
   102 // TSY, but when we use NT RAS no TSY
       
   103 // is used so it must be done here.
       
   104 //
       
   105 	{
       
   106 
       
   107 	#if defined (__WINS__)
       
   108 	#define PDD_NAME _L("ECDRV")
       
   109 	#else
       
   110 	#define PDD_NAME _L("EUART1")
       
   111 	#endif
       
   112 	#define LDD_NAME _L("ECOMM")
       
   113 
       
   114 	TInt err = User::LoadPhysicalDevice(PDD_NAME);
       
   115 	if (err!=KErrNone && err!=KErrAlreadyExists)
       
   116 		{
       
   117 		return err;
       
   118 		}
       
   119 
       
   120 	err = User::LoadLogicalDevice(LDD_NAME);
       
   121 	if (err!=KErrNone && err!=KErrAlreadyExists)
       
   122 		{
       
   123 		return err;
       
   124 		}
       
   125 
       
   126  	// When bootstrapping C32 we have to avoid the PhBkSyncServer being started, since
       
   127  	// it needs a different CommDB
       
   128  	_LIT(KPhbkSyncCMI, "phbsync.cmi");
       
   129     err = StartC32WithCMISuppressions(KPhbkSyncCMI);
       
   130 	if (err!=KErrNone && err!=KErrAlreadyExists)
       
   131 		{
       
   132 		return err;
       
   133 		}
       
   134 
       
   135 	return KErrNone;
       
   136 	}
       
   137