|
1 // Copyright (c) 1997-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 // Implementations for the transition validation classes for ECom |
|
15 // |
|
16 // |
|
17 |
|
18 // ______________________________________________________________________________ |
|
19 // |
|
20 inline TExampleInterface_Ctor_TransitionValidator::TExampleInterface_Ctor_TransitionValidator(CUnitTestContext& aUTContext) |
|
21 :TTransitionValidator(aUTContext) |
|
22 { |
|
23 // Do nothing |
|
24 } |
|
25 |
|
26 inline TBool TExampleInterface_Ctor_TransitionValidator::ValidatePreConditions() |
|
27 { |
|
28 return ETrue; |
|
29 } |
|
30 |
|
31 inline TBool TExampleInterface_Ctor_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */) |
|
32 { |
|
33 CExampleInterface_UnitTestContext& context = |
|
34 REINTERPRET_CAST(CExampleInterface_UnitTestContext&,iUTContext); |
|
35 TExampleInterface_StateAccessor& accessor = |
|
36 REINTERPRET_CAST(TExampleInterface_StateAccessor&, iUTContext.StateAccessor()); |
|
37 |
|
38 _LIT(KTUidMessage, "Created an implementation with uid = 0x%x"); |
|
39 TUid implUid = accessor.GetDtorKey(context.iExampleInterface); |
|
40 context.DataLogger().LogInformationWithParameters(KTUidMessage, implUid.iUid); |
|
41 if(accessor.InvariantTest(context.iExampleInterface)) |
|
42 return EFalse; |
|
43 return ETrue; |
|
44 } |
|
45 |
|
46 // ______________________________________________________________________________ |
|
47 // |
|
48 inline TExampleInterface_Dtor_TransitionValidator::TExampleInterface_Dtor_TransitionValidator(CUnitTestContext& aUTContext) |
|
49 :TTransitionValidator(aUTContext) |
|
50 { |
|
51 // Do nothing |
|
52 } |
|
53 |
|
54 inline TBool TExampleInterface_Dtor_TransitionValidator::ValidatePreConditions() |
|
55 { |
|
56 if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CExampleInterface_UnitTestContext&,iUTContext).iExampleInterface)) |
|
57 return EFalse; |
|
58 return ETrue; |
|
59 } |
|
60 |
|
61 inline TBool TExampleInterface_Dtor_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */) |
|
62 { |
|
63 return ETrue; |
|
64 } |
|
65 |
|
66 // ______________________________________________________________________________ |
|
67 // |
|
68 inline TExampleInterface_ListImplementations_TransitionValidator::TExampleInterface_ListImplementations_TransitionValidator(CUnitTestContext& aUTContext) |
|
69 :TTransitionValidator(aUTContext) |
|
70 { |
|
71 // Do nothing |
|
72 } |
|
73 |
|
74 inline TBool TExampleInterface_ListImplementations_TransitionValidator::ValidatePreConditions() |
|
75 { |
|
76 // static function so there are no preconditions |
|
77 return ETrue; |
|
78 } |
|
79 |
|
80 inline TBool TExampleInterface_ListImplementations_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */) |
|
81 { |
|
82 CExampleInterface_UnitTestContext& context = REINTERPRET_CAST(CExampleInterface_UnitTestContext&, |
|
83 iUTContext); |
|
84 const TInt count = context.iImplementations.Count(); |
|
85 _LIT(KImplementationsReturned,"List Implementations transition returned %d implementations"); |
|
86 context.DataLogger().LogInformationWithParameters(KImplementationsReturned,count); |
|
87 for(TInt i = 0; i < count; ++i) |
|
88 { |
|
89 CImplementationInformation* info = (context.iImplementations)[i]; |
|
90 context.DataLogger().LogInformation(info->DisplayName()); |
|
91 context.DataLogger().LogInformation(info->DataType()); |
|
92 _LIT(KVersionLogLine,"Version number = %d"); |
|
93 context.DataLogger().LogInformationWithParameters(KVersionLogLine,info->Version()); |
|
94 } |
|
95 return ETrue; |
|
96 } |
|
97 |
|
98 // ______________________________________________________________________________ |
|
99 // |
|
100 inline TExampleInterface_Default_TransitionValidator::TExampleInterface_Default_TransitionValidator(CUnitTestContext& aUTContext) |
|
101 :TTransitionValidator(aUTContext) |
|
102 { |
|
103 // Do nothing |
|
104 } |
|
105 |
|
106 inline TBool TExampleInterface_Default_TransitionValidator::ValidatePreConditions() |
|
107 { |
|
108 if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CExampleInterface_UnitTestContext&,iUTContext).iExampleInterface)) |
|
109 return EFalse; |
|
110 return ETrue; |
|
111 } |
|
112 |
|
113 inline TBool TExampleInterface_Default_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */) |
|
114 { |
|
115 if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CExampleInterface_UnitTestContext&,iUTContext).iExampleInterface)) |
|
116 return EFalse; |
|
117 return ETrue; |
|
118 } |
|
119 |