예제 #1
0
GLDEF_C TInt E32Main()
    {
	test.Title();

	test.Start(_L("Test V1 notifier"));
	if(UserSvr::IpcV1Available())
		DoTests(KUidTestTextNotifier1,EFalse);
	else
		test.Printf(_L("IPC V1 not supported"));

	test.Next(_L("Test V2 notifier"));
	DoTests(KUidTestTextNotifier2,EFalse);

	test.Next(_L("Test V1 notifier using MNotifierManager"));
	if(UserSvr::IpcV1Available())
		DoTests(KUidTestTextNotifier1,ETrue);
	else
		test.Printf(_L("IPC V1 not supported"));

	test.Next(_L("Test V2 notifier using MNotifierManager"));
	if(UserSvr::IpcV1Available())
		DoTests(KUidTestTextNotifier2,ETrue);
	else
		test.Printf(_L("FIX ME! - Can't run because IPC V1 not supported\n"));

	
	test.Next(_L("TestNotify"));
	TestNotify();
	
	test.Next(_L("TestNotifyCancel"));
	TestNotifyCancel();

	test.Next(_L("Test removed methods"));
	TestRemovedMethods();

	test.Next(_L("Interactive Tests"));
	test.Printf(_L("  Do you want to test notifiers interactively? y/n\n"));
	test.Printf(_L("  Waiting 10 seconds for answer...\n"));
	TRequestStatus keyStat;
	test.Console()->Read(keyStat);
	RTimer timer;
	test(timer.CreateLocal()==KErrNone);
	TRequestStatus timerStat;
	timer.After(timerStat,10*1000000);
	User::WaitForRequest(timerStat,keyStat);
	TInt key = 0;
	if(keyStat!=KRequestPending)
		key = test.Console()->KeyCode();
	timer.Cancel();
	test.Console()->ReadCancel();
	User::WaitForAnyRequest();
	if(key=='y' || key=='Y')
		DoInteractiveTests();
	else
		test.Printf(_L("  Interactive Tests Not Run\n"));

	test.End();
	return(0);
	}
//from CAdaptationTestBase
TVerdict CTestSimAdaptationPlugin::doTestStepL()
	{
	__UHEAP_MARK;
	
    TInt err = RProperty::Define(KPropertyCategory, KSimPluginPropertyKey, RProperty::EInt);
    TEST((KErrNone == err) || (KErrAlreadyExists == err));
    err = RProperty::Set(KPropertyCategory, KSimPluginPropertyKey, 1);
    TEST(KErrNone == err);
	
	TRAP(err, TestGetSimOwned());
	TEST(err == KErrNone);

	TRAP(err, TestNotifySimEvent());
	TEST(err == KErrNone);
	
	TestNotifyCancel();
	TestGetCancel();
	
	User::LeaveIfError(iSsmSimAdaptation.Connect());
	

	TRAP(err, TestGetSimOwned());
	TEST(err == KErrNone);
	
	TRAP(err, TestNotifySimEvent());
	TEST(err == KErrNone);
	
	TestNotifyCancel();
	TestGetCancel();
	//TestRelease();			// have to test this part too ...

    err = RProperty::Delete(KPropertyCategory, KSimPluginPropertyKey);
    TEST(KErrNone == err);
	__UHEAP_MARKEND;

	return TestStepResult();
	}