sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// DBMS security policy - testing new APIs - utility functions
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#ifndef T_DBPLATSECUTL_H
|
sl@0
|
19 |
#define T_DBPLATSECUTL_H
|
sl@0
|
20 |
|
sl@0
|
21 |
#include <d32dbms.h>
|
sl@0
|
22 |
#include "t_dbsecuritypolicy.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
//Forward declarations
|
sl@0
|
25 |
class RTest;
|
sl@0
|
26 |
|
sl@0
|
27 |
//Table column definition structure.
|
sl@0
|
28 |
struct TColDef
|
sl@0
|
29 |
{
|
sl@0
|
30 |
const TText* iName;
|
sl@0
|
31 |
TDbColType iType;
|
sl@0
|
32 |
TInt iAttributes;
|
sl@0
|
33 |
};
|
sl@0
|
34 |
|
sl@0
|
35 |
typedef void (*TCleanupFunc)();
|
sl@0
|
36 |
|
sl@0
|
37 |
//Test utility class. Define TheDbscUtils instance somewhere in your test code.
|
sl@0
|
38 |
class TDBSCUtils
|
sl@0
|
39 |
{
|
sl@0
|
40 |
public:
|
sl@0
|
41 |
TDBSCUtils(RTest& aTest, TCleanupFunc aFunc);
|
sl@0
|
42 |
|
sl@0
|
43 |
static CDbColSet* CreateColSetLC(const TColDef* aColDef);
|
sl@0
|
44 |
static CDbKey* CreateKeyLC(const TDesC& aColName);
|
sl@0
|
45 |
static void CreateTableL(RDbNamedDatabase& aDb, const TDesC& aTblName, const TColDef* aColDef);
|
sl@0
|
46 |
|
sl@0
|
47 |
static RDbNamedDatabase CreateDatabase(RDbs& aDbs, TUid aPolicyUid, const TDesC& aDbName);
|
sl@0
|
48 |
static TInt DeleteDatabase(RDbs& aDbs, TUid aPolicyUid, const TDesC& aDbName);
|
sl@0
|
49 |
|
sl@0
|
50 |
static TBool IsDatabaseThereL(RDbs& aDbs, TUid aPolicyUid, TDriveNumber aDriveNumber, const TDesC& aDatabaseName);
|
sl@0
|
51 |
static TBool HasCapability(const TCompiledSecurityPolicy& aPolicy, TCapability aCapability);
|
sl@0
|
52 |
|
sl@0
|
53 |
static void Check(TInt aValue, TInt aLine);
|
sl@0
|
54 |
static void Check(TInt aValue, TInt aExpected, TInt aLine);
|
sl@0
|
55 |
|
sl@0
|
56 |
private:
|
sl@0
|
57 |
RTest& iTest;
|
sl@0
|
58 |
TCleanupFunc iFunc;
|
sl@0
|
59 |
};
|
sl@0
|
60 |
|
sl@0
|
61 |
#define TEST(arg) TDBSCUtils::Check((arg), __LINE__)
|
sl@0
|
62 |
#define TEST2(aValue, aExpected) TDBSCUtils::Check(aValue, aExpected, __LINE__)
|
sl@0
|
63 |
|
sl@0
|
64 |
extern TDBSCUtils TheDbscUtils;
|
sl@0
|
65 |
|
sl@0
|
66 |
#endif//T_DBPLATSECUTL_H
|