utilities/mpmediacontroller/tsrc/unittest_mpmediakeyhandler/stub/src/remconinterfaceselector.cpp
changeset 48 af3740e3753f
equal deleted inserted replaced
42:79c49924ae23 48:af3740e3753f
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: remconinterfaceselector stub for testing MpMediaKeyHandler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32debug.h>
       
    20 
       
    21 #include "stub/inc/remconinterfaceselector.h"
       
    22 
       
    23 
       
    24 int gCRemConInterfaceSelectorCount = 0;
       
    25 bool gCRemConInterfaceSelectorNewLLeave = false;
       
    26 bool gCRemConInterfaceSelectorOpenTargetLLeave = false;
       
    27 
       
    28 
       
    29 //static functions start
       
    30 
       
    31 int CRemConInterfaceSelector::getCount()
       
    32 {
       
    33     return gCRemConInterfaceSelectorCount;
       
    34 }
       
    35 
       
    36 void CRemConInterfaceSelector::setNewLLeave()
       
    37 {
       
    38     gCRemConInterfaceSelectorNewLLeave = true;
       
    39 }
       
    40 
       
    41 void CRemConInterfaceSelector::NewLLeaveIfDesiredL()
       
    42 {
       
    43     if (gCRemConInterfaceSelectorNewLLeave)
       
    44     {
       
    45         RDebug::Print(_L("CRemConInterfaceSelector::NewLLeaveIfDesiredL Leave"));
       
    46         gCRemConInterfaceSelectorNewLLeave = false;
       
    47         User::Leave(KErrGeneral);
       
    48     }
       
    49 }
       
    50 
       
    51 void CRemConInterfaceSelector::setOpenTargetLLeave()
       
    52 {
       
    53     gCRemConInterfaceSelectorOpenTargetLLeave = true;
       
    54 }
       
    55 
       
    56 void CRemConInterfaceSelector::OpenTargetLLeaveIfDesiredL()
       
    57 {
       
    58     if (gCRemConInterfaceSelectorOpenTargetLLeave)
       
    59     {
       
    60         RDebug::Print(_L("CRemConInterfaceSelector::NewLLeaveIfDesiredL Leave"));
       
    61         gCRemConInterfaceSelectorOpenTargetLLeave = false;
       
    62         User::Leave(KErrGeneral);
       
    63     }
       
    64 }
       
    65 
       
    66 //static functions end
       
    67 
       
    68 CRemConInterfaceSelector::CRemConInterfaceSelector()
       
    69 {
       
    70     gCRemConInterfaceSelectorCount++;
       
    71 }
       
    72 
       
    73 CRemConInterfaceSelector::~CRemConInterfaceSelector()
       
    74 {
       
    75     gCRemConInterfaceSelectorCount--;
       
    76 }
       
    77 
       
    78 CRemConInterfaceSelector* CRemConInterfaceSelector::NewL()
       
    79 {
       
    80     RDebug::Print(_L("stub CRemConInterfaceSelector::NewL"));
       
    81     CRemConInterfaceSelector::NewLLeaveIfDesiredL();
       
    82     CRemConInterfaceSelector* self = new(ELeave) CRemConInterfaceSelector();
       
    83     return self;
       
    84 }
       
    85 
       
    86 void CRemConInterfaceSelector::OpenTargetL()
       
    87 {
       
    88     CRemConInterfaceSelector::OpenTargetLLeaveIfDesiredL();
       
    89 }
       
    90 
       
    91 //end of file