common/tools/ats/smoketest/profiles/src/ProfileSmokeTestModuleBlocks.cpp
author brendand
Mon, 02 Nov 2009 11:23:32 +0000
changeset 722 d34d2cabd32d
child 739 552776214487
permissions -rw-r--r--
Adding profiles smoke tests
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
722
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
     1
/*
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
     3
* All rights reserved.
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
     4
* This component and the accompanying materials are made available
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
     5
* under the terms of the License "Symbian Foundation License v1.0"
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
     6
* which accompanies this distribution, and is available
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
     7
* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
     8
*
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
     9
* Initial Contributors:
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    11
*
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    12
* Contributors:
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    13
* 
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    14
* Description: This file contains testclass implementation.
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    15
*
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    16
*/
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    17
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    18
// [INCLUDE FILES] - do not remove
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    19
#include <e32svr.h>
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    20
#include <StifParser.h>
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    21
#include <Stiftestinterface.h>
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    22
#include <MProEngEngine.h>
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    23
#include <MProEngProfile.h>
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    24
#include <ProEngFactory.h>
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    25
#include <Profile.hrh>
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    26
#include "ProfileSmokeTestModule.h"
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    27
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    28
// EXTERNAL DATA STRUCTURES
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    29
//extern  ?external_data;
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    30
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    31
// EXTERNAL FUNCTION PROTOTYPES  
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    32
//extern ?external_function( ?arg_type,?arg_type );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    33
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    34
// CONSTANTS
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    35
//const ?type ?constant_var = ?constant;
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    36
_LIT( KProfileSmokeTestModule, "ProfileSmokeTestModule" );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    37
_LIT( KProfile, "Profile: %S" );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    38
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    39
_LIT(KGeneral, "General");
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    40
_LIT(KSilent,  "Silent");
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    41
_LIT(KMeeting, "Meeting");
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    42
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    43
// MACROS
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    44
//#define ?macro ?macro_def
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    45
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    46
// LOCAL CONSTANTS AND MACROS
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    47
//const ?type ?constant_var = ?constant;
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    48
//#define ?macro_name ?macro_def
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    49
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    50
// MODULE DATA STRUCTURES
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    51
//enum ?declaration
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    52
//typedef ?declaration
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    53
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    54
// LOCAL FUNCTION PROTOTYPES
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    55
//?type ?function_name( ?arg_type, ?arg_type );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    56
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    57
// FORWARD DECLARATIONS
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    58
//class ?FORWARD_CLASSNAME;
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    59
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    60
// ============================= LOCAL FUNCTIONS ===============================
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    61
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    62
// -----------------------------------------------------------------------------
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    63
// ?function_name ?description.
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    64
// ?description
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    65
// Returns: ?value_1: ?description
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    66
//          ?value_n: ?description_line1
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    67
//                    ?description_line2
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    68
// -----------------------------------------------------------------------------
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    69
//
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    70
/*
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    71
?type ?function_name(
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    72
    ?arg_type arg,  // ?description
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    73
    ?arg_type arg)  // ?description
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    74
    {
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    75
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    76
    ?code  // ?comment
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    77
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    78
    // ?comment
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    79
    ?code
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    80
    }
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    81
*/
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    82
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    83
// ============================ MEMBER FUNCTIONS ===============================
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    84
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    85
// -----------------------------------------------------------------------------
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    86
// CProfileSmokeTestModule::Delete
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    87
// Delete here all resources allocated and opened from test methods. 
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    88
// Called from destructor. 
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    89
// -----------------------------------------------------------------------------
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    90
//
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    91
void CProfileSmokeTestModule::Delete() 
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    92
    {
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    93
    }
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    94
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    95
// -----------------------------------------------------------------------------
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    96
// CProfileSmokeTestModule::RunMethodL
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    97
// Run specified method. Contains also table of test mothods and their names.
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    98
// -----------------------------------------------------------------------------
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
    99
//
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   100
TInt CProfileSmokeTestModule::RunMethodL( 
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   101
    CStifItemParser& aItem ) 
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   102
    {
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   103
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   104
    static TStifFunctionInfo const KFunctions[] =
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   105
        {  
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   106
        // Copy this line for every implemented function.
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   107
        // First string is the function name used in TestScripter script file.
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   108
        // Second is the actual implementation member function. 
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   109
        ENTRY( "SetProfile", CProfileSmokeTestModule::SetProfileL ),
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   110
        //ADD NEW ENTRY HERE
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   111
        // [test cases entries] - Do not remove
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   112
        };
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   113
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   114
    const TInt count = sizeof( KFunctions ) / 
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   115
                        sizeof( TStifFunctionInfo );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   116
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   117
    return RunInternalL( KFunctions, count, aItem );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   118
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   119
    }
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   120
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   121
// -----------------------------------------------------------------------------
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   122
// CProfileSmokeTestModule::SetProfileL
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   123
// Changes the current active profile according to the parameter
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   124
// -----------------------------------------------------------------------------
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   125
//
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   126
TInt CProfileSmokeTestModule::SetProfileL( CStifItemParser& aItem )
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   127
    {
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   128
    // Print to UI
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   129
    _LIT( KSetProfile, "In SetProfile" );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   130
    TestModuleIf().Printf( 0, KProfileSmokeTestModule, KSetProfile );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   131
    // Print to log file
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   132
    iLog->Log( KSetProfile );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   133
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   134
    TPtrC profile;
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   135
    if ( aItem.GetNextString( profile ) == KErrNone )
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   136
    	{
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   137
    	MProEngEngine* engine = ProEngFactory::NewEngineLC( iFs );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   138
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   139
    	// create the profile engine and set to the correct profile
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   140
    	if ( profile == KSilent)
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   141
    		{
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   142
    		//set to silent
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   143
    		engine->SetActiveProfileL( EProfileSilentId );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   144
    		}
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   145
    	else if ( profile == KMeeting )
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   146
    		{
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   147
    		// set to meeting
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   148
    		engine->SetActiveProfileL( EProfileMeetingId );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   149
    		}
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   150
    	else if ( profile == KGeneral )
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   151
    		{
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   152
    		// set to general
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   153
    		engine->SetActiveProfileL( EProfileGeneralId );
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   154
    		}
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   155
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   156
    	CleanupStack::PopAndDestroy();
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   157
    	}
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   158
    
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   159
    return KErrNone;
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   160
    }
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   161
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   162
// -----------------------------------------------------------------------------
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   163
// CProfileSmokeTestModule::?member_function
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   164
// ?implementation_description
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   165
// (other items were commented in a header).
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   166
// -----------------------------------------------------------------------------
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   167
//
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   168
/*
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   169
TInt CProfileSmokeTestModule::?member_function(
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   170
   CItemParser& aItem )
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   171
   {
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   172
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   173
   ?code
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   174
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   175
   }
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   176
*/
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   177
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   178
// ========================== OTHER EXPORTED FUNCTIONS =========================
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   179
// None
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   180
d34d2cabd32d Adding profiles smoke tests
brendand
parents:
diff changeset
   181
//  [End of File] - Do not remove