|
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 // mectest055step.cpp |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 #include "mectest055step.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 CMecTest055Step::~CMecTest055Step() |
|
31 { |
|
32 } |
|
33 |
|
34 |
|
35 /** |
|
36 //! @SYMTestCaseID MEC_UNIT_TEST_055 |
|
37 //! @SYMTestCaseDesc Container Merging Test, Open container, append the same container twice |
|
38 //! @SYMFssID COMMS-INFRAS/Esock/MetaExtensionContainer/UnitTest |
|
39 //! @SYMTestActions 1) Open container cont1 |
|
40 // 2) AppendExtension T1.1 to cont1 |
|
41 // 3) AppendExtension T2.1 to cont1 |
|
42 // 4) Open container mergeMec |
|
43 // 5) AppendContainerL cont1 to mergeMec |
|
44 // 6) AppendContainerL cont1 to mergeMec == KErrAlreadyExists |
|
45 // 7) Close |
|
46 //! @SYMTestExpectedResults KErrNone. |
|
47 */ |
|
48 TVerdict CMecTest055Step::RunTestStepL() |
|
49 { |
|
50 TVerdict result = EFail; |
|
51 |
|
52 RMetaExtensionContainer container1; |
|
53 container1.Open(); |
|
54 CleanupClosePushL(container1); |
|
55 CreateAndAppendExtensionL(container1, TTestExtension1::ETypeId, KExtVersion1); |
|
56 CreateAndAppendExtensionL(container1, TTestExtension2::ETypeId, KExtVersion1); |
|
57 |
|
58 |
|
59 RMetaExtensionContainer mergeMec; |
|
60 mergeMec.Open(); |
|
61 CleanupClosePushL(mergeMec); |
|
62 |
|
63 CreateAndAppendExtensionL(mergeMec, TTestExtension2::ETypeId, KExtVersion2); |
|
64 CreateAndAppendExtensionL(mergeMec, TTestExtension3::ETypeId, KExtVersion1); |
|
65 |
|
66 mergeMec.AppendContainerL(container1); |
|
67 |
|
68 ESock::CMetaExtensionContainerArray* mergeMecImpl = TMetaExtensionContainerSpy::AppendableContainerArray(mergeMec); |
|
69 if (mergeMecImpl && TMetaExtensionContainerSpy::ContainerCount(*mergeMecImpl) == 2) |
|
70 { |
|
71 const TTestExtension1* ext1 = static_cast<const TTestExtension1*>(mergeMec.FindExtension(TTestExtension1::TypeId())); |
|
72 const TTestExtension2* ext2 = static_cast<const TTestExtension2*>(mergeMec.FindExtension(TTestExtension2::TypeId())); |
|
73 const TTestExtension3* ext3 = static_cast<const TTestExtension3*>(mergeMec.FindExtension(TTestExtension3::TypeId())); |
|
74 if (ext1 && ext1->GetTypeId() == TTestExtension1::TypeId() && ext1->iVersion == KExtVersion1 |
|
75 && ext2 && ext2->GetTypeId() == TTestExtension2::TypeId() && ext2->iVersion == KExtVersion1 |
|
76 && ext3 && ext3->GetTypeId() == TTestExtension3::TypeId() && ext3->iVersion == KExtVersion1) |
|
77 { |
|
78 result = EPass; |
|
79 } |
|
80 } |
|
81 |
|
82 CleanupStack::PopAndDestroy(&mergeMec); |
|
83 CleanupStack::PopAndDestroy(&container1); |
|
84 return result; |
|
85 } |
|
86 |