sysstatemgmt/systemstatereferenceplugins/test/tclayer/src/testpropertyobserver.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2008-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 // Contains wrapper helper functions for testing property observer class 
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @test
       
    21  @internalComponent - Internal Symbian test code 
       
    22 */
       
    23 
       
    24 #include "testpropertyobserver.h"
       
    25 
       
    26 /**
       
    27  * Constructs a new CTestPropertyObserver using the current process SID as category
       
    28  * and KTestPropertyKey as key
       
    29  * 
       
    30  * @internalComponent
       
    31  * @test
       
    32  */
       
    33 CTestPropertyObserver::CTestPropertyObserver()
       
    34 : CSsmPropertyObserver(RProcess().SecureId(), KTestPropertyKey)
       
    35 	{
       
    36 	
       
    37 	}
       
    38 
       
    39 /**
       
    40  * Frees any resources allocated to this object
       
    41  * 
       
    42  * @internalComponent
       
    43  * @test
       
    44  */
       
    45 CTestPropertyObserver::~CTestPropertyObserver()
       
    46 	{
       
    47 	// Nothing to do
       
    48 	}
       
    49 
       
    50 /**
       
    51  * Sets the next property changed return value to aReturn.
       
    52  * 
       
    53  * @internalComponent
       
    54  * @test
       
    55  */
       
    56 void CTestPropertyObserver::SetNextPropertyChangedReturn(TBool aReturn)
       
    57 	{
       
    58 	iNextPropertyChangedReturn = aReturn;
       
    59 	}
       
    60 
       
    61 /**
       
    62  * Returns the last property changed value that this object saw
       
    63  * 
       
    64  * @internalComponent
       
    65  * @test
       
    66  */
       
    67 TInt CTestPropertyObserver::GetLastPropertyChangedValue()
       
    68 	{
       
    69 	return iLastPropertyChangedValue;
       
    70 	}
       
    71 
       
    72 /**
       
    73  * Gets the count of number of times property changed has been called on this object
       
    74  * 
       
    75  * @internalComponent
       
    76  * @test
       
    77  */
       
    78 TInt CTestPropertyObserver::GetPropertyChangedCount()
       
    79 	{
       
    80 	return iPropertyChangedCount;
       
    81 	}
       
    82 	
       
    83 /**
       
    84  * Updates the test values for this test observer
       
    85  * 
       
    86  * @internalComponent
       
    87  * @test
       
    88  */
       
    89 TBool CTestPropertyObserver::PropertyChangedL(TInt aValue)
       
    90 	{
       
    91 	++iPropertyChangedCount;
       
    92 	iLastPropertyChangedValue = aValue;
       
    93 	return iNextPropertyChangedReturn;
       
    94 	}
       
    95 	
       
    96 /**
       
    97  * Runs the base class RunL and then stops the active scheduler
       
    98  * 
       
    99  * @internalComponent
       
   100  * @test
       
   101  */
       
   102 void CTestPropertyObserver::RunL()
       
   103 	{
       
   104 	CSsmPropertyObserver::RunL();
       
   105 	CActiveScheduler::Stop();
       
   106 	}
       
   107