1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/Ctlfrm/TSI_MmfCtlfrmNeg.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1200 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// TSIMmfCtlfrmNeg.cpp
1.18 +// Negative integration testing for MMF CTLFRM
1.19 +//
1.20 +//
1.21 +
1.22 +// EPOC includes
1.23 +#include <e32base.h>
1.24 +
1.25 +// Test system includes
1.26 +#include <testframework.h>
1.27 +#include "TSI_MmfCtlfrmNeg.h"
1.28 +#include "TSI_MmfCtlfrmStep.h"
1.29 +#include "TSI_MmfCtlfrmSuite.h"
1.30 +#include "TSI_MmfCodes.h"
1.31 +#include "TSI_MmfEventIds.h"
1.32 +#include "ActrlTestUids.h"
1.33 +
1.34 +#include <mmf/common/mmfcontroller.h>
1.35 +#include <mmf/plugin/mmfcontrollerimplementationuids.hrh>
1.36 +
1.37 +//const TUid KTestControllerUid = {KTSIMmfControllerUid}; // EABI warning removal
1.38 +//const TUid KTestController2Uid = {KTSIMmfController2Uid}; // EABI warning removal
1.39 +const TUid KTestDataSourceUid = {KTSIMmfDataSourceUid};
1.40 +//const TUid KTestDataSinkUid = {KTSIMmfDataSinkUid}; // EABI warning removal
1.41 +
1.42 +// audio controller, from mmfControllerImplementationUIDs.hrh
1.43 +//const TUid KTestAudioControllerUid = {KMmfUidControllerAudio}; // EABI warning removal
1.44 +// ---------------------------
1.45 +// RTestMmfCtlfrmI0502
1.46 +//
1.47 +// Load controller plugin for unsupported file format
1.48 +//
1.49 +// REQ172.5.3
1.50 +
1.51 +RTestMmfCtlfrmI0502* RTestMmfCtlfrmI0502::NewL()
1.52 + {
1.53 + RTestMmfCtlfrmI0502* self = new(ELeave) RTestMmfCtlfrmI0502;
1.54 + return self;
1.55 + }
1.56 +
1.57 +RTestMmfCtlfrmI0502::RTestMmfCtlfrmI0502()
1.58 + {
1.59 + iTestStepName = _L("MM-MMF-CTLFRM-I-0502");
1.60 + }
1.61 +
1.62 +
1.63 +TVerdict RTestMmfCtlfrmI0502::DoTestStepL()
1.64 + {
1.65 + INFO_PRINTF1(_L("open controller by unsupported extension"));
1.66 +
1.67 +// TO DO
1.68 +// This test needs to be looked at to clarify if we need TMMFPrioritySettings
1.69 +//
1.70 +// TMMFPrioritySettings settings;
1.71 +
1.72 +// settings.iPriority = ETSIMmfPriorityLow;
1.73 +// settings.iPref = EMdaPriorityPreferenceTime;
1.74 +// settings.iState = EMMFStateIdle;
1.75 +
1.76 + CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC();
1.77 + CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC();
1.78 +
1.79 + // Set the format match data
1.80 + fSelect->SetMatchToFileNameL(_L("test.xls"));
1.81 + // Set the controller plugin play format match data
1.82 + cSelect->SetRequiredPlayFormatSupportL(*fSelect);
1.83 +
1.84 + RMMFControllerImplInfoArray controllers; // Array to hold all the controllers support the match data
1.85 + CleanupResetAndDestroyPushL(controllers);
1.86 + cSelect->ListImplementationsL(controllers); // Populates the array with all the suitable controllers
1.87 + TInt numControllers = controllers.Count();
1.88 + if(numControllers)
1.89 + {
1.90 + ERR_PRINTF1(_L("Error : found a suitable controller"));
1.91 + CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
1.92 + return iTestStepResult = EFail;
1.93 + }
1.94 +
1.95 + INFO_PRINTF1(_L("Success : found no suitable controllers"));
1.96 + CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
1.97 + return iTestStepResult = EPass;
1.98 + }
1.99 +
1.100 +// ---------------------------
1.101 +// RTestMmfCtlfrmI0504
1.102 +//
1.103 +// Load a controller by preferred supplier where only compatible controller
1.104 +// available is from a rival
1.105 +//
1.106 +// REQ172.5.5.1
1.107 +
1.108 +RTestMmfCtlfrmI0504* RTestMmfCtlfrmI0504::NewL()
1.109 + {
1.110 + RTestMmfCtlfrmI0504* self = new(ELeave) RTestMmfCtlfrmI0504;
1.111 + return self;
1.112 + }
1.113 +
1.114 +RTestMmfCtlfrmI0504::RTestMmfCtlfrmI0504()
1.115 + {
1.116 + iTestStepName = _L("MM-MMF-CTLFRM-I-0504");
1.117 + }
1.118 +
1.119 +
1.120 +TVerdict RTestMmfCtlfrmI0504::DoTestStepL()
1.121 + {
1.122 + // try to open a controller by preferred supplier
1.123 + // where only a rival's is available
1.124 +
1.125 + INFO_PRINTF1(_L("open controller by preferred supplier"));
1.126 +
1.127 + CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC();
1.128 + CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC();
1.129 +
1.130 + // Set the format match data
1.131 + fSelect->SetMatchToFileNameL(_L("test.wav"));
1.132 + // Set the controller plugin play format match data
1.133 + cSelect->SetRequiredPlayFormatSupportL(*fSelect);
1.134 +
1.135 + // Set for only those plugins supplied by "ACME Industries"
1.136 + _LIT(KPrefSupplierAcme, "ACME Industries");
1.137 + cSelect->SetPreferredSupplierL(KPrefSupplierAcme, CMMFPluginSelectionParameters::EOnlyPreferredSupplierPluginsReturned);
1.138 +
1.139 + RMMFControllerImplInfoArray controllers; // Array to hold all the controllers support the match data
1.140 + CleanupResetAndDestroyPushL(controllers);
1.141 + cSelect->ListImplementationsL(controllers); // Populates the array with all the suitable controllers
1.142 + TInt numControllers = controllers.Count();
1.143 + if(numControllers)
1.144 + {
1.145 + ERR_PRINTF1(_L("Error : found a suitable controller"));
1.146 + CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
1.147 + return iTestStepResult = EFail;
1.148 + }
1.149 +
1.150 + INFO_PRINTF1(_L("Success : found no suitable controllers"));
1.151 + CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
1.152 + return iTestStepResult = EPass;
1.153 + }
1.154 +
1.155 +// ---------------------------
1.156 +// RTestMmfCtlfrmI0511
1.157 +//
1.158 +// Add a data source to a controller which does not support dynamic addition of sources / sinks
1.159 +//
1.160 +// REQ172.5.5.1
1.161 +
1.162 +RTestMmfCtlfrmI0511* RTestMmfCtlfrmI0511::NewL()
1.163 + {
1.164 + RTestMmfCtlfrmI0511* self = new(ELeave) RTestMmfCtlfrmI0511;
1.165 + return self;
1.166 + }
1.167 +
1.168 +RTestMmfCtlfrmI0511::RTestMmfCtlfrmI0511()
1.169 + {
1.170 + iTestStepName = _L("MM-MMF-CTLFRM-I-0511");
1.171 + }
1.172 +
1.173 +
1.174 +TVerdict RTestMmfCtlfrmI0511::DoTestStepL()
1.175 + {
1.176 + INFO_PRINTF1(_L("add data source where not supported"));
1.177 +
1.178 + // TSI_MmfController2 does not support adding source / sink
1.179 +
1.180 +
1.181 + // first : add a data source without a handle
1.182 + _LIT8(KInitData,"TEST");
1.183 +
1.184 + TInt error = KErrNone;
1.185 + error = iController.AddDataSource(KTestDataSourceUid, KInitData);
1.186 + if (!error)
1.187 + {
1.188 + ERR_PRINTF1(_L("Error : AddDataSource succeeded"));
1.189 + return iTestStepResult = EFail;
1.190 + }
1.191 + else if (error != KErrNotSupported)
1.192 + {
1.193 + ERR_PRINTF2(_L("AddDataSource failed with unexpected error %d"), error);
1.194 + return iTestStepResult = EFail;
1.195 + }
1.196 +
1.197 + INFO_PRINTF1(_L("AddDataSource failed, error KErrNotSupported"));
1.198 +
1.199 + // next : add a data source with a handle
1.200 + TMMFMessageDestination* sourceHandlePtr = new (ELeave) TMMFMessageDestination();
1.201 + TMMFMessageDestination& sourceHandle = *sourceHandlePtr;
1.202 + error = iController.AddDataSource(KTestDataSourceUid, KInitData, sourceHandle);
1.203 + if (!error)
1.204 + {
1.205 + ERR_PRINTF1(_L("Error : AddDataSource (with handle) succeeded"));
1.206 + delete sourceHandlePtr;
1.207 + return iTestStepResult = EFail;
1.208 + }
1.209 + else if (error != KErrNotSupported)
1.210 + {
1.211 + ERR_PRINTF2(_L("AddDataSource (with handle) failed with unexpected error %d"), error);
1.212 + delete sourceHandlePtr;
1.213 + return iTestStepResult = EFail;
1.214 + }
1.215 +
1.216 + INFO_PRINTF1(_L("AddDataSource (with handle) failed, error KErrNotSupported"));
1.217 + delete sourceHandlePtr;
1.218 + return iTestStepResult = EPass;
1.219 + }
1.220 +
1.221 +// ---------------------------
1.222 +// RTestMmfCtlfrmI0512
1.223 +//
1.224 +// Add a data source which has already been added to a controller
1.225 +//
1.226 +// REQ172.5.5.1
1.227 +
1.228 +RTestMmfCtlfrmI0512* RTestMmfCtlfrmI0512::NewL()
1.229 + {
1.230 + RTestMmfCtlfrmI0512* self = new(ELeave) RTestMmfCtlfrmI0512;
1.231 + return self;
1.232 + }
1.233 +
1.234 +RTestMmfCtlfrmI0512::RTestMmfCtlfrmI0512()
1.235 + {
1.236 + iTestStepName = _L("MM-MMF-CTLFRM-I-0512");
1.237 + }
1.238 +
1.239 +
1.240 +TVerdict RTestMmfCtlfrmI0512::DoTestStepL()
1.241 + {
1.242 + INFO_PRINTF1(_L("add data source where already added"));
1.243 + TInt error = KErrNone;
1.244 +
1.245 + // this source already exists in the controller
1.246 + _LIT(KTestWavFile, "c:\\TsiMmfCtlfrmData\\test.wav");
1.247 + iFileConfig().iPath = KTestWavFile;
1.248 + error = iController.AddDataSource(KUidMmfFileSource, iFileConfig);
1.249 + if (!error)
1.250 + {
1.251 + ERR_PRINTF1(_L("Error : AddDataSource succeeded"));
1.252 + return iTestStepResult = EFail;
1.253 + }
1.254 + else if (error != KErrAlreadyExists)
1.255 + {
1.256 + ERR_PRINTF2(_L("AddDataSource failed with unexpected error %d"), error);
1.257 + return iTestStepResult = EFail;
1.258 + }
1.259 +
1.260 + INFO_PRINTF1(_L("AddDataSource failed, error KErrAlreadyExists"));
1.261 + return iTestStepResult = EPass;
1.262 + }
1.263 +
1.264 +// ---------------------------
1.265 +// RTestMmfCtlfrmI0513
1.266 +//
1.267 +// Remove a source or sink which is currently in use (track playing)
1.268 +//
1.269 +// REQ172.5.5.1
1.270 +
1.271 +RTestMmfCtlfrmI0513* RTestMmfCtlfrmI0513::NewL()
1.272 + {
1.273 + RTestMmfCtlfrmI0513* self = new(ELeave) RTestMmfCtlfrmI0513;
1.274 + return self;
1.275 + }
1.276 +
1.277 +RTestMmfCtlfrmI0513::RTestMmfCtlfrmI0513()
1.278 + {
1.279 + iTestStepName = _L("MM-MMF-CTLFRM-I-0513");
1.280 + }
1.281 +
1.282 +TVerdict RTestMmfCtlfrmI0513::DoTestStepL()
1.283 + {
1.284 + //XXX : we may have problems here. the only controller we have is the
1.285 + // Audio Controller and this does not yet support removal of sources/sinks,
1.286 + // whether it's playing or not...
1.287 +
1.288 + INFO_PRINTF1(_L("remove a source / sink when track playing"));
1.289 +
1.290 + TInt error = KErrNone;
1.291 +
1.292 + // set it playing
1.293 + error = iController.Play();
1.294 + if(error)
1.295 + {
1.296 + ERR_PRINTF2(_L("Play failed, error %d"), error);
1.297 + return iTestStepResult = EInconclusive;
1.298 + }
1.299 +
1.300 + // wait a little
1.301 + const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
1.302 + INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
1.303 + User::After(KPlayPosition32);
1.304 +
1.305 + // try and remove the data source
1.306 + TMMFMessageDestination& sourceHandle = *iSourceHandlePtr;
1.307 + error = iController.RemoveDataSource(sourceHandle);
1.308 + if (error != KErrNotReady)
1.309 + {
1.310 + ERR_PRINTF2(_L("Error : RemoveDataSource returned error %d"), error);
1.311 + return iTestStepResult = EFail;
1.312 + }
1.313 +
1.314 + INFO_PRINTF1(_L("RemoveDataSource returned KErrNotReady"));
1.315 + return iTestStepResult = EPass;
1.316 + }
1.317 +
1.318 +// ---------------------------
1.319 +// RTestMmfCtlfrmI0514
1.320 +//
1.321 +// Remove a source or sink which is not present in controller
1.322 +//
1.323 +// REQ172.5.5.2
1.324 +
1.325 +RTestMmfCtlfrmI0514* RTestMmfCtlfrmI0514::NewL()
1.326 + {
1.327 + RTestMmfCtlfrmI0514* self = new(ELeave) RTestMmfCtlfrmI0514;
1.328 + return self;
1.329 + }
1.330 +
1.331 +RTestMmfCtlfrmI0514::RTestMmfCtlfrmI0514()
1.332 + {
1.333 + iTestStepName = _L("MM-MMF-CTLFRM-I-0514");
1.334 + }
1.335 +
1.336 +
1.337 +TVerdict RTestMmfCtlfrmI0514::DoTestStepL()
1.338 + {
1.339 + INFO_PRINTF1(_L("remove a nonexistent source / sink"));
1.340 +
1.341 + TInt error = KErrNone;
1.342 +
1.343 + // reset will remove the sources/sinks we added in the preamble
1.344 + error = iController.Reset();
1.345 + if(error)
1.346 + {
1.347 + ERR_PRINTF2(_L("Error : Reset failed, error %d"), error);
1.348 + return iTestStepResult = EFail;
1.349 + }
1.350 +
1.351 + // try and remove the data source
1.352 + TMMFMessageDestination& sourceHandle = *iSourceHandlePtr;
1.353 + error = iController.RemoveDataSource(sourceHandle);
1.354 + if (!error)
1.355 + {
1.356 + ERR_PRINTF1(_L("Error : RemoveDataSource succeeded"));
1.357 + return iTestStepResult = EInconclusive;
1.358 + }
1.359 + else if (error != KErrNotFound)
1.360 + {
1.361 + ERR_PRINTF2(_L("RemoveDataSource failed with unexpected error %d"), error);
1.362 + return iTestStepResult = EInconclusive;
1.363 + }
1.364 +
1.365 + INFO_PRINTF1(_L("RemoveDataSource failed with error KErrNotFound"));
1.366 + return iTestStepResult = EPass;
1.367 + }
1.368 +
1.369 +// ---------------------------
1.370 +// RTestMmfCtlfrmI0515
1.371 +//
1.372 +// Add a data source by UID, but with source info incompatible with the plugin
1.373 +//
1.374 +// REQ172.5.5.2
1.375 +
1.376 +RTestMmfCtlfrmI0515* RTestMmfCtlfrmI0515::NewL()
1.377 + {
1.378 + RTestMmfCtlfrmI0515* self = new(ELeave) RTestMmfCtlfrmI0515;
1.379 + return self;
1.380 + }
1.381 +
1.382 +RTestMmfCtlfrmI0515::RTestMmfCtlfrmI0515()
1.383 + {
1.384 + iTestStepName = _L("MM-MMF-CTLFRM-I-0515");
1.385 + }
1.386 +
1.387 +TVerdict RTestMmfCtlfrmI0515::OpenL()
1.388 + {
1.389 + return iTestStepResult = EPass;
1.390 + // so we don't run the parent preamble
1.391 + }
1.392 +
1.393 +void RTestMmfCtlfrmI0515::Close()
1.394 + {
1.395 + // so we don't run the parent postamble
1.396 + }
1.397 +
1.398 +TVerdict RTestMmfCtlfrmI0515::DoTestStepL()
1.399 + {
1.400 + // NB : this test is no longer valid - see DEF001550 in TeamTrack.
1.401 +
1.402 + // Reject Report :
1.403 + // This is 'as designed' behaviour. The CMMFAudioController::AddDataSourceL function traps
1.404 + // the call to CMMFFormatDecode::NewL, which leaves in this instance with error KErrNotSupported.
1.405 + // However it completes silently if KErrNotSupported is the error (see the comment on line 182
1.406 + // of MmfAudioController.cpp)
1.407 +
1.408 + INFO_PRINTF1(_L("add incompatible data source by UID"));
1.409 + INFO_PRINTF1(_L("test no longer valid - see DEF001550 in TeamTrack"));
1.410 +/*
1.411 + TInt error = KErrNone;
1.412 +
1.413 + iSettings.iPriority = ETSIMmfPriorityHigh;
1.414 + iSettings.iPref = EMdaPriorityPreferenceQuality;
1.415 + iSettings.iState = EMMFStateIdle;
1.416 +
1.417 + // Open a controller
1.418 + error = iController.Open(KTestAudioControllerUid, iSettings);
1.419 + if (error)
1.420 + {
1.421 + ERR_PRINTF2(_L("controller failed to open, error %d"), error);
1.422 + return iTestStepResult = EInconclusive;
1.423 + }
1.424 +
1.425 + // Attempt to add an incompatible source and sink
1.426 + _LIT(KTestXlsFile, "c:\\TsiMmfCtlfrmData\\test.xls");
1.427 + iFileConfig().iPath = KTestXlsFile;
1.428 + error = iController.AddDataSource(KUidMmfFileSource, iFileConfig);
1.429 + if (!error)
1.430 + {
1.431 + ERR_PRINTF1(_L("Error : AddDataSource succeeded"));
1.432 + return iTestStepResult = EFail;
1.433 + }
1.434 + else if (error != KErrNotSupported)
1.435 + {
1.436 + ERR_PRINTF2(_L("AddDataSource failed with unexpected error %d"), error);
1.437 + return iTestStepResult = EFail;
1.438 + }
1.439 +
1.440 + INFO_PRINTF1(_L("AddDataSource failed, error KErrNotSupported"));
1.441 +
1.442 + error = iController.AddDataSink(KUidMmfFileSource, iFileConfig);
1.443 + if (!error)
1.444 + {
1.445 + ERR_PRINTF1(_L("Error : AddDataSink succeeded"));
1.446 + return iTestStepResult = EFail;
1.447 + }
1.448 + else if (error != KErrNotSupported)
1.449 + {
1.450 + ERR_PRINTF2(_L("AddDataSink failed with unexpected error %d"), error);
1.451 + return iTestStepResult = EFail;
1.452 + }
1.453 +
1.454 + INFO_PRINTF1(_L("AddDataSink failed, error KErrNotSupported"));
1.455 +*/
1.456 + return iTestStepResult = EPass;
1.457 + }
1.458 +
1.459 +// ---------------------------
1.460 +// RTestMmfCtlfrmI0521
1.461 +//
1.462 +// Play an unprimed controller
1.463 +//
1.464 +// REQ172.5.5.6
1.465 +
1.466 +RTestMmfCtlfrmI0521* RTestMmfCtlfrmI0521::NewL()
1.467 + {
1.468 + RTestMmfCtlfrmI0521* self = new(ELeave) RTestMmfCtlfrmI0521;
1.469 + return self;
1.470 + }
1.471 +
1.472 +RTestMmfCtlfrmI0521::RTestMmfCtlfrmI0521()
1.473 + {
1.474 + iTestStepName = _L("MM-MMF-CTLFRM-I-0521");
1.475 + }
1.476 +
1.477 +
1.478 +TVerdict RTestMmfCtlfrmI0521::DoTestStepL()
1.479 + {
1.480 + INFO_PRINTF1(_L("play an unprimed controller"));
1.481 + TInt error = KErrNone;
1.482 +
1.483 + // controller is fully setup in the preamble, but not primed
1.484 + // try to set it playing
1.485 + error = iController.Play();
1.486 + if(error != KErrNotReady)
1.487 + {
1.488 + ERR_PRINTF2(_L("Error : play returned error %d"), error);
1.489 + return iTestStepResult = EFail;
1.490 + }
1.491 + INFO_PRINTF1(_L("Play failed with error KErrNotReady"));
1.492 + return iTestStepResult = EPass;
1.493 + }
1.494 +
1.495 +// ---------------------------
1.496 +// RTestMmfCtlfrmI0522
1.497 +//
1.498 +// Prime a controller which is already primed
1.499 +//
1.500 +// REQ172.5.5.6
1.501 +
1.502 +RTestMmfCtlfrmI0522* RTestMmfCtlfrmI0522::NewL()
1.503 + {
1.504 + RTestMmfCtlfrmI0522* self = new(ELeave) RTestMmfCtlfrmI0522;
1.505 + return self;
1.506 + }
1.507 +
1.508 +RTestMmfCtlfrmI0522::RTestMmfCtlfrmI0522()
1.509 + {
1.510 + iTestStepName = _L("MM-MMF-CTLFRM-I-0522");
1.511 + }
1.512 +
1.513 +
1.514 +TVerdict RTestMmfCtlfrmI0522::DoTestStepL()
1.515 + {
1.516 + INFO_PRINTF1(_L("prime an already primed controller"));
1.517 + TInt error = KErrNone;
1.518 +
1.519 + // controller is fully setup in the preamble, but not primed
1.520 + // prime it, then prime it again
1.521 + error = iController.Prime();
1.522 + if(error)
1.523 + {
1.524 + ERR_PRINTF2(_L("Error : first prime returned error %d"), error);
1.525 + return iTestStepResult = EInconclusive;
1.526 + }
1.527 +
1.528 + // wait a while, to give it chance to prime
1.529 + const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
1.530 + INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
1.531 + User::After(KPlayPosition32);
1.532 +
1.533 + // prime a second time. this should succeed (KErrNone)
1.534 + // (defined in Audio Controller)
1.535 + error = iController.Prime();
1.536 + if(error)
1.537 + {
1.538 + ERR_PRINTF2(_L("Error : second prime returned error %d"), error);
1.539 + return iTestStepResult = EFail;
1.540 + }
1.541 + INFO_PRINTF1(_L("Second prime returned success"));
1.542 +
1.543 + return iTestStepResult = EPass;
1.544 + }
1.545 +
1.546 +// ---------------------------
1.547 +// RTestMmfCtlfrmI0523
1.548 +//
1.549 +// Play a controller where there is no defined source
1.550 +//
1.551 +// REQ172.5.5.6
1.552 +
1.553 +RTestMmfCtlfrmI0523* RTestMmfCtlfrmI0523::NewL()
1.554 + {
1.555 + RTestMmfCtlfrmI0523* self = new(ELeave) RTestMmfCtlfrmI0523;
1.556 + return self;
1.557 + }
1.558 +
1.559 +RTestMmfCtlfrmI0523::RTestMmfCtlfrmI0523()
1.560 + {
1.561 + iTestStepName = _L("MM-MMF-CTLFRM-I-0523");
1.562 + }
1.563 +
1.564 +TVerdict RTestMmfCtlfrmI0523::DoTestStepL()
1.565 + {
1.566 + INFO_PRINTF1(_L("play a controller with no defined source"));
1.567 + TInt error = KErrNone;
1.568 +
1.569 + // controller is setup in the preamble, but has no source
1.570 + // try to set it playing
1.571 + error = iController.Play();
1.572 + if(error != KErrNotReady)
1.573 + {
1.574 + ERR_PRINTF2(_L("Error : play returned error %d"), error);
1.575 + return iTestStepResult = EFail;
1.576 + }
1.577 + INFO_PRINTF1(_L("Play failed with error KErrNotReady"));
1.578 + return iTestStepResult = EPass;
1.579 + }
1.580 +
1.581 +// ---------------------------
1.582 +// RTestMmfCtlfrmI0524
1.583 +//
1.584 +// Play a controller which is already playing
1.585 +//
1.586 +// REQ172.5.5.6
1.587 +
1.588 +RTestMmfCtlfrmI0524* RTestMmfCtlfrmI0524::NewL()
1.589 + {
1.590 + RTestMmfCtlfrmI0524* self = new(ELeave) RTestMmfCtlfrmI0524;
1.591 + return self;
1.592 + }
1.593 +
1.594 +RTestMmfCtlfrmI0524::RTestMmfCtlfrmI0524()
1.595 + {
1.596 + iTestStepName = _L("MM-MMF-CTLFRM-I-0524");
1.597 + }
1.598 +
1.599 +
1.600 +TVerdict RTestMmfCtlfrmI0524::DoTestStepL()
1.601 + {
1.602 + INFO_PRINTF1(_L("play a controller which is already playing"));
1.603 + TInt error = KErrNone;
1.604 +
1.605 + // controller is fully setup in the preamble, and primed
1.606 + // set it playing
1.607 + error = iController.Play();
1.608 + if(error)
1.609 + {
1.610 + ERR_PRINTF2(_L("Error : play returned error %d"), error);
1.611 + return iTestStepResult = EInconclusive;
1.612 + }
1.613 +
1.614 + // wait a while, to give it chance to start playing
1.615 + const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
1.616 + INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
1.617 + User::After(KPlayPosition32);
1.618 +
1.619 + // do it again :- should return KErrNotReady (this is defined in the
1.620 + // Audio Controller)
1.621 + error = iController.Play();
1.622 + if(error != KErrNotReady)
1.623 + {
1.624 + ERR_PRINTF2(_L("Error : second play returned error %d"), error);
1.625 + return iTestStepResult = EFail;
1.626 + }
1.627 +
1.628 + INFO_PRINTF1(_L("Second play returned KErrNotReady"));
1.629 + return iTestStepResult = EPass;
1.630 + }
1.631 +
1.632 +// ---------------------------
1.633 +// RTestMmfCtlfrmI0525
1.634 +//
1.635 +// Stop a controller which is not playing
1.636 +//
1.637 +// REQ172.5.5.7
1.638 +
1.639 +RTestMmfCtlfrmI0525* RTestMmfCtlfrmI0525::NewL()
1.640 + {
1.641 + RTestMmfCtlfrmI0525* self = new(ELeave) RTestMmfCtlfrmI0525;
1.642 + return self;
1.643 + }
1.644 +
1.645 +RTestMmfCtlfrmI0525::RTestMmfCtlfrmI0525()
1.646 + {
1.647 + iTestStepName = _L("MM-MMF-CTLFRM-I-0525");
1.648 + }
1.649 +
1.650 +
1.651 +TVerdict RTestMmfCtlfrmI0525::DoTestStepL()
1.652 + {
1.653 + INFO_PRINTF1(_L("stop a controller which is not playing"));
1.654 + TInt error = KErrNone;
1.655 +
1.656 + // controller is fully setup in the preamble, and primed
1.657 + // play it, stop, try and stop again
1.658 + error = iController.Play();
1.659 + if(error)
1.660 + {
1.661 + ERR_PRINTF2(_L("Error : play returned error %d"), error);
1.662 + return iTestStepResult = EInconclusive;
1.663 + }
1.664 + // wait a while, to give it chance to start playing
1.665 + const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
1.666 + INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
1.667 + User::After(KPlayPosition32);
1.668 + // stop it
1.669 + error = iController.Stop();
1.670 + if(error)
1.671 + {
1.672 + ERR_PRINTF2(_L("Error : stop returned error %d"), error);
1.673 + return iTestStepResult = EInconclusive;
1.674 + }
1.675 +
1.676 + // wait a while, to give it chance to stop
1.677 + INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
1.678 + User::After(KPlayPosition32);
1.679 +
1.680 + // now try and stop it a second time - should return KErrNone
1.681 + // (this is defined in Audio Controller)
1.682 + error = iController.Stop();
1.683 + if(error)
1.684 + {
1.685 + ERR_PRINTF2(_L("Error : stop returned error %d"), error);
1.686 + return iTestStepResult = EFail;
1.687 + }
1.688 + INFO_PRINTF1(_L("Stop returned KErrNone"));
1.689 +
1.690 + return iTestStepResult = EPass;
1.691 + }
1.692 +
1.693 +// ---------------------------
1.694 +// RTestMmfCtlfrmI0526
1.695 +//
1.696 +// Stop a controller where there is no defined source
1.697 +//
1.698 +// REQ172.5.5.7
1.699 +
1.700 +RTestMmfCtlfrmI0526* RTestMmfCtlfrmI0526::NewL()
1.701 + {
1.702 + RTestMmfCtlfrmI0526* self = new(ELeave) RTestMmfCtlfrmI0526;
1.703 + return self;
1.704 + }
1.705 +
1.706 +RTestMmfCtlfrmI0526::RTestMmfCtlfrmI0526()
1.707 + {
1.708 + iTestStepName = _L("MM-MMF-CTLFRM-I-0526");
1.709 + }
1.710 +
1.711 +
1.712 +TVerdict RTestMmfCtlfrmI0526::DoTestStepL()
1.713 + {
1.714 + INFO_PRINTF1(_L("stop a controller with no defined source"));
1.715 + TInt error = KErrNone;
1.716 +
1.717 + // controller is setup in the preamble, but has no source
1.718 + // try to stop it
1.719 + error = iController.Stop();
1.720 + if(error)
1.721 + {
1.722 + ERR_PRINTF2(_L("Error : stop returned error %d"), error);
1.723 + return iTestStepResult = EFail;
1.724 + }
1.725 + INFO_PRINTF1(_L("Stop returned KErrNone"));
1.726 + return iTestStepResult = EPass;
1.727 + }
1.728 +
1.729 +// ---------------------------
1.730 +// RTestMmfCtlfrmI0527
1.731 +//
1.732 +// Pause a controller which is stopped
1.733 +//
1.734 +// REQ172.5.5.8
1.735 +
1.736 +RTestMmfCtlfrmI0527* RTestMmfCtlfrmI0527::NewL()
1.737 + {
1.738 + RTestMmfCtlfrmI0527* self = new(ELeave) RTestMmfCtlfrmI0527;
1.739 + return self;
1.740 + }
1.741 +
1.742 +RTestMmfCtlfrmI0527::RTestMmfCtlfrmI0527()
1.743 + {
1.744 + iTestStepName = _L("MM-MMF-CTLFRM-I-0527");
1.745 + }
1.746 +
1.747 +
1.748 +TVerdict RTestMmfCtlfrmI0527::DoTestStepL()
1.749 + {
1.750 + INFO_PRINTF1(_L("pause a controller which is stopped"));
1.751 + TInt error = KErrNone;
1.752 +
1.753 + // controller is fully setup in the preamble, and primed
1.754 + // play it, stop, try and pause
1.755 + error = iController.Play();
1.756 + if(error)
1.757 + {
1.758 + ERR_PRINTF2(_L("Error : play returned error %d"), error);
1.759 + return iTestStepResult = EInconclusive;
1.760 + }
1.761 + // wait a while, to give it chance to start playing
1.762 + const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
1.763 + INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
1.764 + User::After(KPlayPosition32);
1.765 + // stop it
1.766 + error = iController.Stop();
1.767 + if(error)
1.768 + {
1.769 + ERR_PRINTF2(_L("Error : stop returned error %d"), error);
1.770 + return iTestStepResult = EInconclusive;
1.771 + }
1.772 + // wait a while, to give it chance to stop
1.773 + INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
1.774 + User::After(KPlayPosition32);
1.775 +
1.776 + // now try and pause. this should return KErrNotReady
1.777 + error = iController.Pause();
1.778 + if(error != KErrNotReady)
1.779 + {
1.780 + ERR_PRINTF2(_L("Error : pause returned error %d"), error);
1.781 + return iTestStepResult = EFail;
1.782 + }
1.783 + INFO_PRINTF1(_L("Pause returned KErrNotReady"));
1.784 +
1.785 + return iTestStepResult = EPass;
1.786 + }
1.787 +
1.788 +// ---------------------------
1.789 +// RTestMmfCtlfrmI0531
1.790 +//
1.791 +// Assign a priority to a controller where it is the only controller loaded
1.792 +//
1.793 +// REQ172.5.5.9
1.794 +
1.795 +RTestMmfCtlfrmI0531* RTestMmfCtlfrmI0531::NewL()
1.796 + {
1.797 + RTestMmfCtlfrmI0531* self = new(ELeave) RTestMmfCtlfrmI0531;
1.798 + return self;
1.799 + }
1.800 +
1.801 +RTestMmfCtlfrmI0531::RTestMmfCtlfrmI0531()
1.802 + {
1.803 + iTestStepName = _L("MM-MMF-CTLFRM-I-0531");
1.804 + }
1.805 +
1.806 +TVerdict RTestMmfCtlfrmI0531::DoTestStepL()
1.807 + {
1.808 + INFO_PRINTF1(_L("Assign priority to lone controller"));
1.809 + TInt error = KErrNone;
1.810 +
1.811 + // this will succeed - priorities are relative, not absolute
1.812 + iSettings.iPriority = ETSIMmfPriorityLow;
1.813 + iSettings.iPref = EMdaPriorityPreferenceTime;
1.814 + iSettings.iState = EMMFStateIdle;
1.815 +
1.816 + // NB controller should be Stopped (not Primed) to do this)
1.817 + error = iController.SetPrioritySettings(iSettings);
1.818 + if(error)
1.819 + {
1.820 + ERR_PRINTF2(_L("Error : SetPrioritySettings returned %d"), error);
1.821 + return iTestStepResult = EFail;
1.822 + }
1.823 +
1.824 + INFO_PRINTF1(_L("SetPrioritySettings succeeded"));
1.825 +
1.826 + return iTestStepResult = EPass;
1.827 + }
1.828 +
1.829 +// ---------------------------
1.830 +// RTestMmfCtlfrmI0532
1.831 +//
1.832 +// Assign identical or conflicting priorities to two controllers
1.833 +//
1.834 +// REQ172.5.5.9
1.835 +
1.836 +RTestMmfCtlfrmI0532* RTestMmfCtlfrmI0532::NewL()
1.837 + {
1.838 + RTestMmfCtlfrmI0532* self = new(ELeave) RTestMmfCtlfrmI0532;
1.839 + return self;
1.840 + }
1.841 +
1.842 +RTestMmfCtlfrmI0532::RTestMmfCtlfrmI0532()
1.843 + {
1.844 + iTestStepName = _L("MM-MMF-CTLFRM-I-0532");
1.845 + }
1.846 +
1.847 +TVerdict RTestMmfCtlfrmI0532::DoTestStepL()
1.848 + {
1.849 + INFO_PRINTF1(_L("Assign identical priority to two controllers"));
1.850 + TInt error = KErrNone;
1.851 +
1.852 + // NB : the preamble for this class sets the controllers with identical settings
1.853 + // including priority
1.854 +
1.855 + // prime them
1.856 + error = iController1.Prime();
1.857 + if(error)
1.858 + {
1.859 + ERR_PRINTF2(_L("controller1 prime failed, error %d"), error);
1.860 + return iTestStepResult = EInconclusive;
1.861 + }
1.862 + error = iController2.Prime();
1.863 + if(error)
1.864 + {
1.865 + ERR_PRINTF2(_L("controller2 prime failed, error %d"), error);
1.866 + return iTestStepResult = EInconclusive;
1.867 + }
1.868 +
1.869 + // at last we are ready to do the test...
1.870 + // play both controllers. give the first time to start before playing the second.
1.871 + // we should get an error.
1.872 + error = iController1.Play();
1.873 + if(error)
1.874 + {
1.875 + ERR_PRINTF2(_L("iController1 play failed, error %d"), error);
1.876 + return iTestStepResult = EInconclusive;
1.877 + }
1.878 + // wait a while, to give it chance to play
1.879 + const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
1.880 + INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
1.881 + User::After(KPlayPosition32);
1.882 + error = iController2.Play();
1.883 + if(error)
1.884 + {
1.885 + ERR_PRINTF2(_L("iController2 play failed, error %d"), error);
1.886 + return iTestStepResult = EInconclusive;
1.887 + }
1.888 +
1.889 + // search for a KErrInUse event from the MMF controller framework on controller 2
1.890 + TMMFEvent inUseEvent( KMMFEventCategoryPlaybackComplete, KErrInUse );
1.891 + TVerdict result;
1.892 + result = SearchForEvent( inUseEvent, 2 );
1.893 + if( result == EFail )
1.894 + {
1.895 + ERR_PRINTF1(_L("MMF controller framework did not return a KErrInUse event"));
1.896 + return iTestStepResult = EFail;
1.897 + }
1.898 +
1.899 + ERR_PRINTF1(_L("MMF controller framework returned a KErrInUse event"));
1.900 + return iTestStepResult = EPass;
1.901 + }
1.902 +
1.903 +// ---------------------------
1.904 +// RTestMmfCtlfrmI0541
1.905 +//
1.906 +// Get position of a source where there is no defined source
1.907 +//
1.908 +// REQ172.5.5.10
1.909 +
1.910 +RTestMmfCtlfrmI0541* RTestMmfCtlfrmI0541::NewL()
1.911 + {
1.912 + RTestMmfCtlfrmI0541* self = new(ELeave) RTestMmfCtlfrmI0541;
1.913 + return self;
1.914 + }
1.915 +
1.916 +RTestMmfCtlfrmI0541::RTestMmfCtlfrmI0541()
1.917 + {
1.918 + iTestStepName = _L("MM-MMF-CTLFRM-I-0541");
1.919 + }
1.920 +
1.921 +TVerdict RTestMmfCtlfrmI0541::DoTestStepL()
1.922 + {
1.923 + INFO_PRINTF1(_L("Get position of undefined source"));
1.924 + TInt error = KErrNone;
1.925 +
1.926 + // controller is setup in the preamble, but has no source
1.927 + // try to get a clip position
1.928 + TTimeIntervalMicroSeconds clipPos;
1.929 + error = iController.GetPosition(clipPos);
1.930 + if(error != KErrNotReady)
1.931 + {
1.932 + ERR_PRINTF2(_L("Error : GetPosition returned error %d"), error);
1.933 + return iTestStepResult = EFail;
1.934 + }
1.935 +
1.936 + INFO_PRINTF1(_L("GetPosition returned KErrNotReady"));
1.937 + return iTestStepResult = EPass;
1.938 + }
1.939 +
1.940 +// ---------------------------
1.941 +// RTestMmfCtlfrmI0542
1.942 +//
1.943 +// Set position of a source to beyond the end of the data
1.944 +//
1.945 +// REQ172.5.5.11
1.946 +
1.947 +RTestMmfCtlfrmI0542* RTestMmfCtlfrmI0542::NewL()
1.948 + {
1.949 + RTestMmfCtlfrmI0542* self = new(ELeave) RTestMmfCtlfrmI0542;
1.950 + return self;
1.951 + }
1.952 +
1.953 +RTestMmfCtlfrmI0542::RTestMmfCtlfrmI0542()
1.954 + {
1.955 + iTestStepName = _L("MM-MMF-CTLFRM-I-0542");
1.956 + }
1.957 +
1.958 +TVerdict RTestMmfCtlfrmI0542::DoTestStepL()
1.959 + {
1.960 + // NB this test has changed
1.961 + // originally we expected the position to set to the end of the clip.
1.962 + // the Audio Controller is now in fact returning KErrArgument
1.963 + INFO_PRINTF1(_L("Set position to beyond end of source data"));
1.964 + TInt error = KErrNone;
1.965 +
1.966 + // we know our clip is 5.33 sec :- set to way past the end
1.967 + const TTimeIntervalMicroSeconds KPastEndPosition(20000000); // 20 sec
1.968 + const TTimeIntervalMicroSeconds KPlayPosition(5330000);
1.969 + // NB allow for resolution of the controller itself
1.970 + const TTimeIntervalMicroSeconds KPlayPositionPlusError(5830000);
1.971 + const TTimeIntervalMicroSeconds KPlayPositionMinusError(4830000); // allow +/-0.5 sec
1.972 + error = iController.SetPosition(KPastEndPosition);
1.973 + if(error != KErrArgument)
1.974 + {
1.975 + ERR_PRINTF3(_L("SetPosition returned error %d (expected %d)"), error, KErrArgument);
1.976 + return iTestStepResult = EFail;
1.977 + }
1.978 +
1.979 + INFO_PRINTF1(_L("SetPosition returned KErrArgument"));
1.980 + // now set it to the actual end of the clip, and try again
1.981 + error = iController.SetPosition(KPlayPosition);
1.982 + if(error)
1.983 + {
1.984 + ERR_PRINTF3(_L("SetPosition returned error %d (expected %d)"), error, KErrNone);
1.985 + return iTestStepResult = EFail;
1.986 + }
1.987 +
1.988 + TTimeIntervalMicroSeconds clipPos;
1.989 + error = iController.GetPosition(clipPos);
1.990 + if(error)
1.991 + {
1.992 + ERR_PRINTF2(_L("Error : GetPosition failed, error %d"), error);
1.993 + return iTestStepResult = EInconclusive;
1.994 + }
1.995 +
1.996 + INFO_PRINTF3(_L("Clip position : %ld Expected : %ld"), I64LOW(clipPos.Int64()), I64LOW(KPlayPosition.Int64()));
1.997 + if( (clipPos < (KPlayPositionMinusError)) || (clipPos > (KPlayPositionPlusError)) )
1.998 + {
1.999 + ERR_PRINTF1(_L("Error : clip position not set correctly"));
1.1000 + return iTestStepResult = EFail;
1.1001 + }
1.1002 +
1.1003 + // EPass if we got here
1.1004 + return iTestStepResult = EPass;
1.1005 + }
1.1006 +
1.1007 +// ---------------------------
1.1008 +// RTestMmfCtlfrmI0551
1.1009 +//
1.1010 +// Close a controller when source is still playing
1.1011 +//
1.1012 +// REQ172.5.5.12
1.1013 +
1.1014 +RTestMmfCtlfrmI0551* RTestMmfCtlfrmI0551::NewL()
1.1015 + {
1.1016 + RTestMmfCtlfrmI0551* self = new(ELeave) RTestMmfCtlfrmI0551;
1.1017 + return self;
1.1018 + }
1.1019 +
1.1020 +RTestMmfCtlfrmI0551::RTestMmfCtlfrmI0551()
1.1021 + {
1.1022 + iTestStepName = _L("MM-MMF-CTLFRM-I-0551");
1.1023 + }
1.1024 +
1.1025 +TVerdict RTestMmfCtlfrmI0551::DoTestStepL()
1.1026 + {
1.1027 + INFO_PRINTF1(_L("Close controller while still playing"));
1.1028 + TInt error = KErrNone;
1.1029 +
1.1030 + // controller is fully setup in the preamble, and primed
1.1031 + // play it, then close
1.1032 + error = iController.Play();
1.1033 + if(error)
1.1034 + {
1.1035 + ERR_PRINTF2(_L("Error : play returned error %d"), error);
1.1036 + return iTestStepResult = EInconclusive;
1.1037 + }
1.1038 +
1.1039 + // wait a while, to give it chance to start playing
1.1040 + const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
1.1041 + INFO_PRINTF2(_L("Waiting %d mcs..."), I64LOW(KPlayPosition32.Int()));
1.1042 + User::After(KPlayPosition32);
1.1043 +
1.1044 + iController.Close();
1.1045 +
1.1046 + // Close() returns void - so instead demonstrate that the controller
1.1047 + // has been closed - Reset will return KErrNotReady on a closed controller;
1.1048 + // on an open controller it will succeed in any state.
1.1049 +
1.1050 + error = iController.Reset();
1.1051 + if(error != KErrNotReady)
1.1052 + {
1.1053 + ERR_PRINTF2(_L("Error : reset returned error %d"), error);
1.1054 + return iTestStepResult = EFail;
1.1055 + }
1.1056 +
1.1057 + INFO_PRINTF1(_L("Reset returned KErrNotReady; close succeeded"));
1.1058 + return iTestStepResult = EPass;
1.1059 + }
1.1060 +
1.1061 +// ---------------------------
1.1062 +// RTestMmfCtlfrmI0552
1.1063 +//
1.1064 +// Reset a controller when source is still playing
1.1065 +//
1.1066 +// REQ172.5.5.12
1.1067 +
1.1068 +RTestMmfCtlfrmI0552* RTestMmfCtlfrmI0552::NewL()
1.1069 + {
1.1070 + RTestMmfCtlfrmI0552* self = new(ELeave) RTestMmfCtlfrmI0552;
1.1071 + return self;
1.1072 + }
1.1073 +
1.1074 +RTestMmfCtlfrmI0552::RTestMmfCtlfrmI0552()
1.1075 + {
1.1076 + iTestStepName = _L("MM-MMF-CTLFRM-I-0552");
1.1077 + }
1.1078 +
1.1079 +TVerdict RTestMmfCtlfrmI0552::DoTestStepL()
1.1080 + {
1.1081 + INFO_PRINTF1(_L("Reset controller while still playing"));
1.1082 + TInt error = KErrNone;
1.1083 +
1.1084 + // controller is fully setup in the preamble, and primed
1.1085 + // play it, then reset
1.1086 + error = iController.Play();
1.1087 + if(error)
1.1088 + {
1.1089 + ERR_PRINTF2(_L("Error : play returned error %d"), error);
1.1090 + return iTestStepResult = EInconclusive;
1.1091 + }
1.1092 +
1.1093 + // wait a while, to give it chance to start playing
1.1094 + const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
1.1095 + INFO_PRINTF2(_L("Waiting %d mcs..."), I64LOW(KPlayPosition32.Int()));
1.1096 + User::After(KPlayPosition32);
1.1097 +
1.1098 + error = iController.Reset();
1.1099 + if(error)
1.1100 + {
1.1101 + ERR_PRINTF2(_L("Error : Reset failed, error %d"), error);
1.1102 + return iTestStepResult = EFail;
1.1103 + }
1.1104 +
1.1105 + INFO_PRINTF1(_L("Reset succeeded"));
1.1106 + return iTestStepResult = EPass;
1.1107 + }
1.1108 +
1.1109 +// ---------------------------
1.1110 +// RTestMmfCtlfrmI0553
1.1111 +//
1.1112 +// Close an already closed controller
1.1113 +//
1.1114 +// REQ172.5.5.12
1.1115 +
1.1116 +RTestMmfCtlfrmI0553* RTestMmfCtlfrmI0553::NewL()
1.1117 + {
1.1118 + RTestMmfCtlfrmI0553* self = new(ELeave) RTestMmfCtlfrmI0553;
1.1119 + return self;
1.1120 + }
1.1121 +
1.1122 +RTestMmfCtlfrmI0553::RTestMmfCtlfrmI0553()
1.1123 + {
1.1124 + iTestStepName = _L("MM-MMF-CTLFRM-I-0553");
1.1125 + }
1.1126 +
1.1127 +TVerdict RTestMmfCtlfrmI0553::DoTestStepL()
1.1128 + {
1.1129 + INFO_PRINTF1(_L("Close an already closed controller"));
1.1130 + TInt error = KErrNone;
1.1131 +
1.1132 + // controller is fully setup in the preamble, and primed
1.1133 + // close it, check that code on reset is KErrNotReady,
1.1134 + // then close it again
1.1135 +
1.1136 + iController.Close();
1.1137 + error = iController.Reset();
1.1138 + if(error != KErrNotReady)
1.1139 + {
1.1140 + ERR_PRINTF2(_L("Error : reset returned error %d"), error);
1.1141 + return iTestStepResult = EFail;
1.1142 + }
1.1143 + INFO_PRINTF1(_L("Reset (1) returned KErrNotReady; close succeeded"));
1.1144 +
1.1145 + // if the second close caused problems, we will leave or get an error from Reset
1.1146 + iController.Close();
1.1147 + error = iController.Reset();
1.1148 + if(error != KErrNotReady)
1.1149 + {
1.1150 + ERR_PRINTF2(_L("Error : reset returned error %d"), error);
1.1151 + return iTestStepResult = EFail;
1.1152 + }
1.1153 +
1.1154 + INFO_PRINTF1(_L("Reset (2) returned KErrNotReady; close succeeded"));
1.1155 +
1.1156 + return iTestStepResult = EPass;
1.1157 + }
1.1158 +
1.1159 +// ---------------------------
1.1160 +// RTestMmfCtlfrmI0554
1.1161 +//
1.1162 +// Reset an already closed controller
1.1163 +//
1.1164 +// REQ172.5.5.12
1.1165 +
1.1166 +RTestMmfCtlfrmI0554* RTestMmfCtlfrmI0554::NewL()
1.1167 + {
1.1168 + RTestMmfCtlfrmI0554* self = new(ELeave) RTestMmfCtlfrmI0554;
1.1169 + return self;
1.1170 + }
1.1171 +
1.1172 +RTestMmfCtlfrmI0554::RTestMmfCtlfrmI0554()
1.1173 + {
1.1174 + iTestStepName = _L("MM-MMF-CTLFRM-I-0554");
1.1175 + }
1.1176 +
1.1177 +TVerdict RTestMmfCtlfrmI0554::DoTestStepL()
1.1178 + {
1.1179 + INFO_PRINTF1(_L("Reset an already closed controller"));
1.1180 + TInt error = KErrNone;
1.1181 +
1.1182 + // controller is fully setup in the preamble, and primed
1.1183 + // close it, then attempt a reset
1.1184 +
1.1185 + iController.Close();
1.1186 + // Close() returns void
1.1187 + // wait a while, to give it a chance to complete
1.1188 + const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
1.1189 + INFO_PRINTF2(_L("Waiting %d mcs..."), I64LOW(KPlayPosition32.Int()));
1.1190 + User::After(KPlayPosition32);
1.1191 +
1.1192 + error = iController.Reset();
1.1193 + if(error != KErrNotReady)
1.1194 + {
1.1195 + // this will fail if the controller hasn't been closed
1.1196 + ERR_PRINTF2(_L("Error : reset returned error %d"), error);
1.1197 + return iTestStepResult = EFail;
1.1198 + }
1.1199 +
1.1200 + INFO_PRINTF1(_L("Reset returned KErrNotReady"));
1.1201 + return iTestStepResult = EPass;
1.1202 + }
1.1203 +