|
1 // Copyright (c) 2005-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 "testutils.h" |
|
17 #include "tunittests.h" |
|
18 |
|
19 _LIT(KTitle, "Bookmark Unit Tests"); |
|
20 |
|
21 LOCAL_D RTest gTest(KTitle()); |
|
22 |
|
23 LOCAL_D CTrapCleanup* gTheTrapCleanup; |
|
24 LOCAL_D CTestWrapper* gTestWrapper; |
|
25 |
|
26 const TInt KTestCleanupStack=0x500; |
|
27 |
|
28 LOCAL_C void DoTestsL() |
|
29 { |
|
30 DoCBookmarkBaseUnitL(gTestWrapper); |
|
31 DoCBookmarkUnitL(gTestWrapper); |
|
32 DoCBookmarkFolderUnitL(gTestWrapper); |
|
33 DoPropertiesUnitL(gTestWrapper); |
|
34 DoAttachmentUnitL(gTestWrapper); |
|
35 DoCBookmarkDbUnitL(gTestWrapper); |
|
36 DoCPropertyRegUnitL(gTestWrapper); |
|
37 |
|
38 } |
|
39 |
|
40 |
|
41 LOCAL_C void TestL() |
|
42 { |
|
43 gTestWrapper = CTestWrapper::NewLC(gTest); |
|
44 gTestWrapper->Start(_L("@SYMTestCaseID IWS-APPPROTOCOLS-BOOKMARKS-TUNITMAIN-0001 test")); |
|
45 |
|
46 TRAPD(ret,DoTestsL()); |
|
47 gTestWrapper->TESTE(ret==KErrNone, ret); |
|
48 |
|
49 gTestWrapper->End(); |
|
50 CleanupStack::PopAndDestroy(gTestWrapper); |
|
51 } |
|
52 |
|
53 LOCAL_C void setupCleanup() |
|
54 // |
|
55 // Initialise the cleanup stack. |
|
56 // |
|
57 { |
|
58 gTheTrapCleanup=CTrapCleanup::New(); |
|
59 gTest(gTheTrapCleanup!=NULL); |
|
60 TRAPD(r,\ |
|
61 {\ |
|
62 for (TInt i=KTestCleanupStack;i>0;i--)\ |
|
63 CleanupStack::PushL((TAny*)0);\ |
|
64 CleanupStack::Pop(KTestCleanupStack);\ |
|
65 }); |
|
66 gTest(r==KErrNone); |
|
67 } |
|
68 |
|
69 |
|
70 GLDEF_C TInt E32Main() |
|
71 { |
|
72 setupCleanup(); |
|
73 __UHEAP_MARK; |
|
74 // |
|
75 |
|
76 TRAPD(ret,TestL()); |
|
77 gTest(ret==KErrNone); |
|
78 // |
|
79 |
|
80 __UHEAP_MARKEND; |
|
81 delete gTheTrapCleanup; |
|
82 return KErrNone; |
|
83 } |
|
84 |