|
1 // Copyright (c) 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 // mectest032step.cpp |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 #include "mectest032step.h" |
|
23 #include "testextensions.h" |
|
24 #include "metaextensioncontainerspy.h" |
|
25 #include <comms-infras/ss_rmetaextensioncontainer.h> |
|
26 #include <comms-infras/ss_commsprov.h> |
|
27 |
|
28 using namespace ESock; |
|
29 |
|
30 CMecTest032Step::~CMecTest032Step() |
|
31 { |
|
32 } |
|
33 |
|
34 |
|
35 /** |
|
36 //! @SYMTestCaseID MEC_UNIT_TEST_032 |
|
37 //! @SYMTestCaseDesc Container Branching Test, Override all extensions and test compaction |
|
38 //! @SYMFssID COMMS-INFRAS/Esock/MetaExtensionContainer/UnitTest |
|
39 //! @SYMTestActions 1) Open container rootMec |
|
40 // 2) AppendExtension T1.1 to rootMec |
|
41 // 3) AppendExtension T2.1 to rootMec |
|
42 // 4) Open container branchMec against rootMec |
|
43 // 5) AppendExtension T1.2 to branchMec |
|
44 // 6) AppendExtension T2.2 to branchMec |
|
45 // 7) Open container constMec against branchMec |
|
46 // 8) constMec chain length == 2 |
|
47 // 9) Close branchMec |
|
48 // 10) constMec chain length == 1 |
|
49 // 11) FindExtension T1 == T1.2 |
|
50 // 12) FindExtension T2 == T2.2 |
|
51 // 13) Close containers |
|
52 //! @SYMTestExpectedResults KErrNone. |
|
53 */ |
|
54 TVerdict CMecTest032Step::RunTestStepL() |
|
55 { |
|
56 TVerdict result = EFail; |
|
57 |
|
58 RMetaExtensionContainer rootMec; |
|
59 rootMec.Open(); |
|
60 CleanupClosePushL(rootMec); |
|
61 |
|
62 CreateAndAppendExtensionL(rootMec, TTestExtension1::ETypeId, KExtVersion1); |
|
63 CreateAndAppendExtensionL(rootMec, TTestExtension2::ETypeId, KExtVersion1); |
|
64 |
|
65 RMetaExtensionContainer branchMec; |
|
66 branchMec.Open(rootMec); |
|
67 CleanupClosePushL(branchMec); |
|
68 |
|
69 CreateAndAppendExtensionL(branchMec, TTestExtension1::ETypeId, KExtVersion2); |
|
70 CreateAndAppendExtensionL(branchMec, TTestExtension2::ETypeId, KExtVersion2); |
|
71 |
|
72 RMetaExtensionContainerC constMec; |
|
73 constMec.Open(branchMec); |
|
74 |
|
75 TUint chainLengthBefore = TMetaExtensionContainerSpy::ChainLength(constMec); |
|
76 CleanupStack::PopAndDestroy(&branchMec); |
|
77 |
|
78 if (chainLengthBefore == 2 && TMetaExtensionContainerSpy::ChainLength(constMec) == 1) |
|
79 { |
|
80 const TTestExtension1* ext1 = static_cast<const TTestExtension1*>(constMec.FindExtension(TTestExtension1::TypeId())); |
|
81 const TTestExtension2* ext2 = static_cast<const TTestExtension2*>(constMec.FindExtension(TTestExtension2::TypeId())); |
|
82 if (ext1 && ext1->GetTypeId() == TTestExtension1::TypeId() && ext1->iVersion == KExtVersion2 |
|
83 && ext2 && ext2->GetTypeId() == TTestExtension2::TypeId() && ext2->iVersion == KExtVersion2) |
|
84 { |
|
85 result = EPass; |
|
86 } |
|
87 |
|
88 } |
|
89 |
|
90 constMec.Close(); |
|
91 CleanupStack::PopAndDestroy(&rootMec); |
|
92 |
|
93 return result; |
|
94 } |
|
95 |