Example #1
0
void TreeViewItem::OnItemsChanged(NotifyContainerChangedArg& e)
{
    __super::OnItemsChanged(e);

    if (e.GetAction() == NotifyContainerChangedAction::Add)
    {
        for (int i = 0; i < e.GetNewItems()->GetCount(); ++i)
        {
            TreeViewItemPtr itemPtr(e.GetNewItems()->GetAt(i));

            if (itemPtr)
            {
                itemPtr->ItemSelected = ItemSelected;
                itemPtr->ItemUnselected = ItemUnselected;
            }
        }
    }
}
Example #2
0
XAPP::ListItem App::GetLaunchedListItem()
{
  CFileItemPtr itemPtr(new CFileItem(CAppManager::GetInstance().GetLastLaunchedItem()));
  ListItem item(itemPtr);
  return item;
}
Example #3
0
void StartL()
	{	
	// The following two lines create a semaphore which removes the security dialog
	// displayed when an untrusted certificate is received from a SSL server
	RSemaphore semaphore;
	semaphore.CreateGlobal(_L("T_AUTOSSL"), 0);

	TBool runTestDefault = EFalse;

	CTestScheduler* as = new(ELeave) CTestScheduler;
	CleanupStack::PushL(as);
	if (!as)
		{
		User::Panic(_L("Failed to create active scheduler"),KErrNoMemory);
		}
	CActiveScheduler::Install(as); // Install active scheduler
	
	// tialise Comms, required in a minimal console environment
	CHTTPTestUtils::InitCommsL();
	
	CHttpTestEngine* engine = NULL;
	// not silent by default
	TRAPD(err,engine = CHttpTestEngine::NewL(KHttpTestTitle(), ETrue));
	if (err != KErrNone)
		{
		User::Panic(_L("T_HTTP_ENG"),err);
		}
	CleanupStack::PushL(engine);

	engine->Utils().LogIt(_L("@SYMTestCaseID IWS-APPPROTOCOLS-HTTP-FRAMEWORK-ACCPT-T_HTTP-0001  "));
	
	// Open the INI file to initialise the tests we're going to run
	CScriptFile* iniFile = NULL;
	TRAP(err, iniFile = CScriptFile::NewL(engine->Utils(), KAcceptanceTestCompName));
	if (err != KErrNone)
		{
		User::Panic(_L("T_HTTP_INI"),err);
		}
	CleanupStack::PushL(iniFile);
	iniFile->ReadScriptL(KAcceptanceTestScriptName());

	// Open the settings.ini file which has the server IP/Name that would
	// be used by the tests.
	CScriptFile* iniSettingsFile = NULL;
	TRAP(err, iniSettingsFile = CScriptFile::NewL(engine->Utils(), KSettingsIniCompName, KSettingsIniName()));
	if (err != KErrNone)
		{
		User::Panic(KAcceptanceTestCompName(),err);
		}
	CleanupStack::PushL(iniSettingsFile);

	// Create an array containing all the tests we're going to run. 
	// Ownership is transferred to the test engine
	RPointerArray<CHttpTestBase> acceptanceTests;
	CleanupClosePushL(acceptanceTests);
	
	CArrayPtrFlat<CScriptSection>& sections=iniFile->Sections();

	//create the tests for iteration2   and  append them in the array
	AppendIteration1Tests(*iniFile, *iniSettingsFile, acceptanceTests);

	//create the  tests for iteration2   and  append them in the array
	TInt secCount = sections.Count();
	TInt count= secCount;
	CScriptSection* section = NULL;
	for (TInt i=0;i<count;i++)
		{
		//create an array of tests to be sent to the engine
		section = sections[i];
		_LIT(KZero, "0");

		if (section->SectionName().CompareF(KSectionDefaults) == 0)
			{
			if (iniFile->Section(i).ItemL(KItemSilent).Value().CompareF(KZero) == 0)
				{
   				engine->SetSilent(EFalse);
				}
 			else
				{
				engine->SetSilent(ETrue);
				}
 			if (iniFile->Section(i).ItemL(KRunTestItemName).Value().CompareF(KZero) != 0)
				{
				runTestDefault = ETrue;
				}
			}

		if ( section->SectionName().CompareF(KSectionSingleTrans) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestBase* singleTrans = CHttpTestSingleTrans::NewL(*iniFile,iniSettingsFile,i);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				singleTrans->SetLeakTests(numLeakTests, firstLeakIter);
   				acceptanceTests.Append(singleTrans);
   				}
			}

		if ( section->SectionName().CompareF(KSectionWspSingleTrans) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestBase* wspTrans = CWspTestTransactions::NewL(*iniFile, iniSettingsFile,i);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				wspTrans->SetLeakTests(numLeakTests, firstLeakIter);
   				acceptanceTests.Append(wspTrans);
   				}
			}

		if ( section->SectionName().CompareF(KSectionGet12) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCaseGet12* get12 = new(ELeave) CHttpTestCaseGet12(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				get12->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(get12);
   				}
			}

		if ( section->SectionName().CompareF(KSectionGet13) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCaseGet13* get13 = new(ELeave) CHttpTestCaseGet13(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				get13->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(get13);
   				}
			}
		if ( section->SectionName().CompareF(KSectionGet14) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCaseGet14* get14 = new(ELeave) CHttpTestCaseGet14(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				get14->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(get14);
   				}
			}
		if ( section->SectionName().CompareF(KSectionGet17) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCaseGet17* get17 = new(ELeave) CHttpTestCaseGet17(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				get17->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(get17);
   				}
			}

		if ( section->SectionName().CompareF(KSectionGet18) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
	   			CHttpTestCaseGet18* get18 = new(ELeave) CHttpTestCaseGet18(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				get18->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(get18);
   				}
			}
		if ( section->SectionName().CompareF(KSectionGet21) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCaseGet21* get21 = new(ELeave) CHttpTestCaseGet21;
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				get21->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(get21);
   				}
			}
		if ( section->SectionName().CompareF(KSectionPost12) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCasePost12* post12 = new(ELeave) CHttpTestCasePost12(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				post12->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(post12);
   				}
			}
		if ( section->SectionName().CompareF(KSectionPost13) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCasePost13* post13 = new(ELeave) CHttpTestCasePost13(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				post13->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(post13);
   				}
			}	
		if ( section->SectionName().CompareF(KSectionPost14) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCasePost14* post14 = new(ELeave) CHttpTestCasePost14(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				post14->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(post14);
   				}
			}
		if ( section->SectionName().CompareF(KSectionPost23) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCasePost23* post23 = new(ELeave) CHttpTestCasePost23(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				post23->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(post23);
   				}
			}
		if ( section->SectionName().CompareF(KSection3Post6) == 0)
			{
			TBool runTest = runTestDefault;
   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCaseIter3Post6* iter3Post6= new(ELeave) CHttpTestCaseIter3Post6(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				iter3Post6->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(iter3Post6);
   				}
			}
		if ( section->SectionName().CompareF(KSection3Post7) == 0)
			{
			TBool runTest = runTestDefault;
   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCaseIter3Post7* iter3Post7 = new(ELeave) CHttpTestCaseIter3Post7(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				iter3Post7->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(iter3Post7);
   				}
			}
		if ( section->SectionName().CompareF(KSection5Chunked1) == 0)
			{
			TBool runTest = runTestDefault;
   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCaseIter5Chunked1* iter5Chunked1 = new(ELeave) CHttpTestCaseIter5Chunked1(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				iter5Chunked1->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(iter5Chunked1);
   				}
			}
		if ( section->SectionName().CompareF(KSection5Chunked2) == 0)
			{
			TBool runTest = runTestDefault;
   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
   				CHttpTestCaseIter5Chunked2* iter5Chunked2 = new(ELeave) CHttpTestCaseIter5Chunked2(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				iter5Chunked2->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(iter5Chunked2);
   				}
			}

		if ( section->SectionName().CompareF(K3BasicAuthTransactions) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
	   			C3BasicAuthTransactions* basicAuthTrans = new(ELeave) C3BasicAuthTransactions(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				basicAuthTrans->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(basicAuthTrans);
   				}
			}

		if ( section->SectionName().CompareF(K3DigestAuthTransactions) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
	   			C3DigestAuthTransactions* digestAuthTrans = new(ELeave) C3DigestAuthTransactions(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				digestAuthTrans->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(digestAuthTrans);
   				}
			}

		if ( section->SectionName().CompareF(KEofTransactionResubmission) == 0)
			{
			TBool runTest = runTestDefault;

   			TPtrC itemPtr(iniFile->Section(i).Item(0).Item());
 			if (itemPtr.CompareF(KRunTestItemName)==0)
				{
 				runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0);
				}
 			if (runTest)
   				{
	   			CEofTransactionResubmission* eofTransResubmission = new(ELeave) CEofTransactionResubmission(iniSettingsFile);
				TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0);
				TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0);
				eofTransResubmission->SetLeakTests(numLeakTests, firstLeakIter);
				acceptanceTests.Append(eofTransResubmission);
   				}
			}
		}
	
	// Set the test array then pop because the engine takes ownership
	engine->ConfigureTestSet(acceptanceTests);		

	//--------
	CleanupStack::Pop(&acceptanceTests);// 

	// All the action happens within the main event loop
	CActiveScheduler::Start();

	TInt pass, fail;
	engine->TestSummary(pass, fail);
	engine->Utils().LogIt(_L("\nTest Summary: %d passed, %d failed.\n"), 
		pass, fail);
	engine->PressAnyKey();
	// Returned from start so shutdown	
	//RL: pause a sec to get a gander
	engine->Utils().LogIt(_L("\nEnd of test program "));	
	CleanupStack::PopAndDestroy(4); // engine, iniSettingsFile, iniFile, as
	}