adaptationlayer/tsy/nokiatsy_dll/internal/test/nokiatsy_test_tool/core/inc/cisctestcase.h
changeset 4 510c70acdbf6
parent 3 1972d8c2e329
child 5 8ccc39f9d787
equal deleted inserted replaced
3:1972d8c2e329 4:510c70acdbf6
     1 /*
       
     2 * Copyright (c) 2002-2004 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 the License "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:   Activeobject for handling ISC Test Control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CISCTESTCASE_H
       
    22 #define CISCTESTCASE_H
       
    23 
       
    24 
       
    25 //  INCLUDES
       
    26 #include "risctestcontrol.h"
       
    27 
       
    28 // CLASS DECLARATION
       
    29 // Helper class to handle IscTestControl
       
    30 class CIscTestCase : public CActive
       
    31     {
       
    32 public:
       
    33 
       
    34     /**
       
    35     * C++ default constructor.
       
    36     */
       
    37     CIscTestCase()
       
    38     :CActive(EPriorityStandard)
       
    39         {
       
    40         }
       
    41 
       
    42 
       
    43     /**
       
    44     * Destructor.
       
    45     */
       
    46     ~CIscTestCase()
       
    47         {
       
    48         Cancel();
       
    49         // and close isc test control
       
    50         iIscTestControl.Close();
       
    51         }
       
    52 
       
    53 
       
    54     /**
       
    55     * Initialize ISC Test Control
       
    56     * @param aTestCaseFile XML file containing ISC Test Control test cases
       
    57     */
       
    58     void InitializeL(const TDesC& aTestCaseFile)
       
    59         {
       
    60         TInt err;
       
    61 
       
    62         err = iIscTestControl.Connect();
       
    63         User::LeaveIfError(err);
       
    64 
       
    65         err = iIscTestControl.LoadTestCases(aTestCaseFile);
       
    66         User::LeaveIfError(err);
       
    67         
       
    68         CActiveScheduler::Add(this);
       
    69         
       
    70         }
       
    71 
       
    72 
       
    73     /**
       
    74     * Runs ISC Test Control Testcase
       
    75     * @param aTestControlId isc-test-control-id from testcase XML file
       
    76     * @param aTestCaseId    test case id
       
    77     */
       
    78     void RunTestCase(TInt aTestControlId, TInt aTestCaseId)
       
    79         {
       
    80         iIscTestControl.RunTestCase((aTestControlId<<20)|aTestCaseId, iStatus);
       
    81         SetActive();
       
    82         }
       
    83 
       
    84     /**
       
    85     * Syncronize nokiatsy -side with isc test control side
       
    86     */
       
    87     void Sync()
       
    88         {
       
    89         iIscTestControl.SyncTestCase();
       
    90         }
       
    91 
       
    92 
       
    93     /**
       
    94     * ActiveObject RunL, called win ISC Test Control testcase is done
       
    95     */
       
    96     void RunL()
       
    97         {
       
    98         if (iStatus.Int() != KErrNone)        
       
    99             {
       
   100             User::LeaveIfError(iStatus.Int());
       
   101             }
       
   102         }
       
   103 
       
   104     /**
       
   105     * ActiveObject cancel
       
   106     */
       
   107     void DoCancel()
       
   108         {
       
   109         //
       
   110         iIscTestControl.CancelTestCase();
       
   111         }
       
   112 
       
   113 
       
   114 private:
       
   115     RIscTestControl iIscTestControl;
       
   116     };
       
   117 
       
   118 
       
   119 #endif      // CISCTESTCASE_H
       
   120             
       
   121 // End of File