videoplayback/videoplaybackcontrols/tsrc/videoplaybackcontrols_test/src/videoplaybackcontrolstest.cpp
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Test Harness for VideoPlaybackControls
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: ou1cpsw#4 %
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <aknutils.h>
       
    25 #include <aknviewappui.h> 
       
    26 #include <Stiftestinterface.h>
       
    27 #include <SettingServerClient.h>
       
    28 #include <akntoolbar.h>
       
    29 
       
    30 #include "videoplaybackcontrolstest.h"
       
    31 #include "mpxvideoplaybackcontrolscontroller.h"
       
    32 
       
    33 
       
    34 // ============================ MEMBER FUNCTIONS ===============================
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CVideoPlaybackControlsTest::CVideoPlaybackControlsTest
       
    38 // C++ default constructor can NOT contain any code, that
       
    39 // might leave.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CVideoPlaybackControlsTest::CVideoPlaybackControlsTest( 
       
    43     CTestModuleIf& aTestModuleIf ):
       
    44         CScriptBase( aTestModuleIf )
       
    45 {
       
    46 }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CVideoPlaybackControlsTest::ConstructL
       
    50 // Symbian 2nd phase constructor can leave.
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 void CVideoPlaybackControlsTest::ConstructL()
       
    54 {
       
    55     MPX_DEBUG(_L("CVideoPlaybackControlsTest::ConstructL()"));
       
    56 
       
    57     //Read logger settings to check whether test case name is to be
       
    58     //appended to log file name.
       
    59     RSettingServer settingServer;
       
    60     TInt ret = settingServer.Connect();
       
    61     if(ret != KErrNone)
       
    62     {
       
    63         User::Leave(ret);
       
    64     }
       
    65     
       
    66     // Struct to StifLogger settigs.
       
    67     TLoggerSettings loggerSettings; 
       
    68     
       
    69     // Parse StifLogger defaults from STIF initialization file.
       
    70     ret = settingServer.GetLoggerSettings(loggerSettings);
       
    71     if(ret != KErrNone)
       
    72     {
       
    73         User::Leave(ret);
       
    74     } 
       
    75     
       
    76     // Close Setting server session
       
    77     settingServer.Close();
       
    78 
       
    79     TFileName logFileName;
       
    80     
       
    81     if(loggerSettings.iAddTestCaseTitle)
       
    82     {
       
    83         TName title;
       
    84         TestModuleIf().GetTestCaseTitleL(title);
       
    85         logFileName.Format(KVideoPlaybackControlsTestLogFileWithTitle, &title);
       
    86     }
       
    87     else
       
    88     {
       
    89         logFileName.Copy(KVideoPlaybackControlsTestLogFile);
       
    90     }
       
    91 
       
    92     iLog = CStifLogger::NewL( KVideoPlaybackControlsTestLogPath, 
       
    93                           logFileName,
       
    94                           CStifLogger::ETxt,
       
    95                           CStifLogger::EFile,
       
    96                           EFalse );
       
    97     
       
    98     SendTestClassVersion();
       
    99 
       
   100     iAvkonViewAppUi->CurrentFixedToolbar()->SetToolbarVisibility( EFalse );
       
   101 
       
   102     TInt err = iWsSession.Connect();
       
   103 }
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CVideoPlaybackControlsTest::NewL
       
   107 // Two-phased constructor.
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 CVideoPlaybackControlsTest* CVideoPlaybackControlsTest::NewL( 
       
   111     CTestModuleIf& aTestModuleIf )
       
   112 {
       
   113     CVideoPlaybackControlsTest* self = 
       
   114         new (ELeave) CVideoPlaybackControlsTest( aTestModuleIf );
       
   115 
       
   116     CleanupStack::PushL( self );
       
   117     self->ConstructL();
       
   118     CleanupStack::Pop();
       
   119 
       
   120     return self;
       
   121 
       
   122 }
       
   123 
       
   124 // Destructor
       
   125 CVideoPlaybackControlsTest::~CVideoPlaybackControlsTest()
       
   126 {
       
   127     iWsSession.Close();
       
   128 
       
   129     // Delete resources allocated from test methods
       
   130     Delete();
       
   131 
       
   132     // Delete logger
       
   133     delete iLog; 
       
   134 }
       
   135 
       
   136 //-----------------------------------------------------------------------------
       
   137 // CVideoPlaybackControlsTest::SendTestClassVersion
       
   138 // Method used to send version of test class
       
   139 //-----------------------------------------------------------------------------
       
   140 //
       
   141 void CVideoPlaybackControlsTest::SendTestClassVersion()
       
   142 {
       
   143 	TVersion moduleVersion;
       
   144 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   145 	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   146 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   147 	
       
   148 	TFileName moduleName;
       
   149 	moduleName = _L("ui_videoplaybackcontrolstest.dll");
       
   150 
       
   151 	TBool newVersionOfMethod = ETrue;
       
   152 	TestModuleIf().SendTestModuleVersion(
       
   153 	                        moduleVersion, moduleName, newVersionOfMethod);
       
   154 }
       
   155 
       
   156 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // LibEntryL is a polymorphic Dll entry point.
       
   160 // Returns: CScriptBase: New CScriptBase derived object
       
   161 // -----------------------------------------------------------------------------
       
   162 //
       
   163 EXPORT_C CScriptBase* LibEntryL( 
       
   164     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   165 {
       
   166 
       
   167     return ( CScriptBase* ) CVideoPlaybackControlsTest::NewL( aTestModuleIf );
       
   168 
       
   169 }
       
   170 
       
   171 
       
   172 //  End of File