genericservices/mimerecognitionfw/tef/T_MstrStep.cpp
author hgs
Tue, 20 Jul 2010 16:35:53 +0530
changeset 44 97b0fb8a2cc2
parent 0 e4d67989cc36
child 57 2efc27d87e1c
permissions -rw-r--r--
201025
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
// All rights reserved.
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
//
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
// Initial Contributors:
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
//
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
// Contributors:
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
//
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
// Description:
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
// Harness for Mstr test code
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
// 
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
//
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
/**
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
 @file 
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
 @internalComponent - Internal Symbian test code 
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
*/
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <ecom/ecom.h>
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include "T_MstrStep.h"
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
/**
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
   Constructor
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
 */
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
CT_MstrStep::CT_MstrStep()
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
	{
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
	// Call base class method to set up the human readable name for logging
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
	SetTestStepName(KT_MstrStep);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
	}
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
	
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
/**
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
   Destructor
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
 */
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
CT_MstrStep::~CT_MstrStep()
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
	{
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
	}
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
TVerdict CT_MstrStep::doTestStepL()
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
	{	
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
	INFO_PRINTF1(_L("Test Started"));
44
hgs
parents: 0
diff changeset
    46
    TInt r = KErrNone;
hgs
parents: 0
diff changeset
    47
    r = iFs.Connect();
hgs
parents: 0
diff changeset
    48
    if (r != KErrNone)
hgs
parents: 0
diff changeset
    49
        {
hgs
parents: 0
diff changeset
    50
            User::Leave(r);
hgs
parents: 0
diff changeset
    51
        }
0
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
	__UHEAP_MARK;
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
	TRAPD(ret,doMenuL());		
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
	TEST(ret==KErrNone);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
	REComSession::FinalClose();
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
	__UHEAP_MARKEND;
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
	iFs.Close();
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
	INFO_PRINTF1(_L("Test Finished"));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
	return TestStepResult();
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
	}
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
	
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
/**
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
   @SYMTestCaseID		T_MstrStep_doMenuL
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
  
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
   @SYMPREQ			
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
  
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
   @SYMTestCaseDesc 	Tests data type storage
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
  
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
   @SYMTestPriority 	High
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
  
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
   @SYMTestStatus 		Implemented
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
   
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
   @SYMTestActions  	The test creates a storage manager object, which is filled with some mapings.
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
   The first thing to verify is the correct insertion of these mappings, checking the type, uid
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
   and priority. Then the mappings are stored in an INI file, and restored from there to a new 
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
   storage manager object. The test checks that this new object is correct and equal to the
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
   previous one. The test also tries to find a non-existing app mapping, which gives a 0 Uid.
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
   API Calls:\n	
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
   CTypeStoreManager::NewL(RFs& aFs) \n
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
   CTypeStoreManager::InsertDataMappingL(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid) \n
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
   CTypeStoreManager::DeleteDataMapping(const TDataType& aDataType) \n
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
   CTypeStoreManager::GetAppByDataType(const TDataType& aDataType, TUid& aUid) const \n
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
   CTypeStoreManager::StoreL() \n
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
   CTypeStoreManager::ReStoreL() \n
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
   
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
   @SYMTestExpectedResults Test should complete without any panic.
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
   
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
 */
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
void CT_MstrStep::doMenuL()
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
	{
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
	INFO_PRINTF1(_L("Testing Data Type storage"));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
	INFO_PRINTF1(_L("Creating CTypeStoreManager object"));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
	CTypeStoreManager* mman = CTypeStoreManager::NewL(iFs);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
	CleanupStack::PushL(mman);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
	INFO_PRINTF1(_L("Adding some mappings to table"));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
	lPopulateMappingTablesL(mman);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
	INFO_PRINTF1(_L("Checking mappings in table"));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
	lCheckMappingsL(mman);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
		
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
	INFO_PRINTF1(_L("Storing to INI file"));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
	mman->StoreL();
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
	INFO_PRINTF1(_L("Restoring from INI file to new object"));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
	CTypeStoreManager* mman2 = CTypeStoreManager::NewL(iFs);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
	CleanupStack::PushL(mman2);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
	mman2->RestoreL();
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
	INFO_PRINTF1(_L("Checking restored correctly"));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
	lCheckMappingsL(mman2);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
	INFO_PRINTF1(_L("Trying to find non-existent app mappings"));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
	TUid scratchUid;
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
	mman->GetAppByDataType(TDataType(_L8("non/existent")),scratchUid);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
	TEST(scratchUid.iUid==0);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
	INFO_PRINTF1(_L("Clearing table to original state"));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
	lClearMappingTablesL(mman2);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
	CleanupStack::PopAndDestroy(2); // managers
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
	}
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
const TUid KTestUidValue1={10101010}; 
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
const TUid KTestUidValue2={20202020}; 
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
const TUid KTestUidValue3={30303030}; 
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
void CT_MstrStep::lPopulateMappingTablesL(CTypeStoreManager* aMan)
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
	{
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
	aMan->InsertDataMappingL(TDataType(_L8("image/gif")),KDataTypePriorityNormal,KTestUidValue1);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
	aMan->InsertDataMappingL(TDataType(_L8("text/plain")),KDataTypePriorityNormal,KTestUidValue2);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
	aMan->InsertDataMappingL(TDataType(_L8("text/plain")),KDataTypePriorityNormal,KTestUidValue1,KTestUidValue3);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
	aMan->InsertDataMappingL(TDataType(_L8("text/word")),KDataTypePriorityNormal,KTestUidValue2);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
	aMan->InsertDataMappingL(TDataType(_L8("something/else")),KDataTypePriorityNormal,KTestUidValue3);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
	}
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
void CT_MstrStep::lClearMappingTablesL(CTypeStoreManager* aMan)
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
	{
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
	aMan->DeleteDataMapping(TDataType(_L8("image/gif")));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
	aMan->DeleteDataMapping(TDataType(_L8("text/plain")));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
	aMan->DeleteDataMapping(TDataType(_L8("text/plain")), KTestUidValue3);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
	aMan->DeleteDataMapping(TDataType(_L8("text/word")));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
	aMan->DeleteDataMapping(TDataType(_L8("something/else")));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
	aMan->StoreL();
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
	}
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
void CT_MstrStep::lCheckMappingsL(CTypeStoreManager* aTypeMan)
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
	{
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
	TUid scratchUid;
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
	aTypeMan->GetAppByDataType(TDataType(_L8("image/gif")),scratchUid);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
	TEST(scratchUid==KTestUidValue1);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
	aTypeMan->GetAppByDataType(TDataType(_L8("text/plain")),scratchUid);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
	TEST(scratchUid==KTestUidValue2);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
	aTypeMan->GetAppByDataType(TDataType(_L8("text/plain")),KTestUidValue3,scratchUid);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
	TEST(scratchUid==KTestUidValue1);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
	aTypeMan->GetAppByDataType(TDataType(_L8("text/word")),scratchUid);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
	TEST(scratchUid==KTestUidValue2);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
	aTypeMan->GetAppByDataType(TDataType(_L8("something/else")),scratchUid);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
	TEST(scratchUid==KTestUidValue3);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
	aTypeMan->GetAppByDataType(TDataType(_L8("image/*")),scratchUid);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
	TEST(scratchUid==KTestUidValue1);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
	
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
	TDataType nativeData(KTestUidValue3);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
	TEST(nativeData.IsNative());
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
	CArrayFixFlat<TDataType>* array=new(ELeave) CArrayFixFlat<TDataType>(1);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
	CleanupStack::PushL(array);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
	aTypeMan->GetDataTypesByAppL(KTestUidValue1,array);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
	TEST(array->Count()==1);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
	TEST((*array)[0]==TDataType(_L8("image/gif")));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
	array->Delete(0);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
	aTypeMan->GetDataTypesByAppL(KTestUidValue2,array);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
	TEST(array->Count()==2);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
	TEST((*array)[0]==TDataType(_L8("text/plain")));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
	TEST((*array)[1]==TDataType(_L8("text/word")));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
	array->Delete(0,2);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
	aTypeMan->GetDataTypesByAppL(KTestUidValue3,array);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
	TEST(array->Count()==1);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
	TEST((*array)[0]==TDataType(_L8("something/else")));
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
	array->Delete(0);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
	TUid uid;
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
	uid.iUid=0;
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
	aTypeMan->GetDataTypesByAppL(uid,array);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
	TEST(array->Count()==4);
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
	CleanupStack::PopAndDestroy(); // array
e4d67989cc36 Revision: 201002
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
	}