kerneltest/e32test/property/t_prop_ldd.cpp
changeset 271 dc268b18d709
parent 0 a41df078684a
equal deleted inserted replaced
269:d57b86b1867a 271:dc268b18d709
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   133 	RProperty::TType type = aInfo->iType;
   133 	RProperty::TType type = aInfo->iType;
   134 
   134 
   135 	for (TUint i = 0; i < count; ++i)
   135 	for (TUint i = 0; i < count; ++i)
   136 		{
   136 		{
   137 		RPropertyRef prop;
   137 		RPropertyRef prop;
       
   138 		TPropertyStatus propStatus;
   138 		TInt r = prop.Open(category, key);
   139 		TInt r = prop.Open(category, key);
   139 		BASIC_ERROR(r, r == KErrNotFound);
   140 		BASIC_ERROR(r, r == KErrNotFound);
   140 		r = prop.Attach(category, key);
   141 		r = prop.Attach(category, key);
   141 		BASIC_ERROR(r, r == KErrNone);
   142 		BASIC_ERROR(r, r == KErrNone);
   142 
   143 
   144 		//	once for each property. Subsequent attempts to define the same property will return
   145 		//	once for each property. Subsequent attempts to define the same property will return
   145 		//	KErrAlreadyExists.
   146 		//	KErrAlreadyExists.
   146 
   147 
   147 		TSecurityPolicy policy;
   148 		TSecurityPolicy policy;
   148 
   149 
       
   150 		NKern::LockSystem();
       
   151 		TBool defined = prop.GetStatus(propStatus);
       
   152 		NKern::UnlockSystem();
       
   153 		BASIC_ERROR(defined, !defined); // should be EFALSE when not defined
       
   154 		
   149 		r = prop.Define(type, policy, policy);
   155 		r = prop.Define(type, policy, policy);
   150 		BASIC_ERROR(r, r == KErrNone);
   156 		BASIC_ERROR(r, r == KErrNone);
       
   157 
       
   158 		NKern::LockSystem();
       
   159 		defined = prop.GetStatus(propStatus);
       
   160 		NKern::UnlockSystem();
       
   161 		BASIC_ERROR(defined, defined);  // should be ETRUE, when defined
       
   162 		BASIC_ERROR(propStatus.iType, propStatus.iType==type);
       
   163 
   151 		r = prop.Define(type, policy, policy);
   164 		r = prop.Define(type, policy, policy);
   152 		BASIC_ERROR(r, r == KErrAlreadyExists);
   165 		BASIC_ERROR(r, r == KErrAlreadyExists);
   153 		r = prop.Delete();
   166 		r = prop.Delete();
   154 		BASIC_ERROR(r, r == KErrNone);
   167 		BASIC_ERROR(r, r == KErrNone);
   155 
   168 
   337 			TBuf8<16> ibuf((TUint8*) "0123456789012345");
   350 			TBuf8<16> ibuf((TUint8*) "0123456789012345");
   338 			TBuf8<16> obuf((TUint8*) "abcdefghigklmnop");
   351 			TBuf8<16> obuf((TUint8*) "abcdefghigklmnop");
   339 			TPtr8 optr((TUint8*) obuf.Ptr(), 0, 15);
   352 			TPtr8 optr((TUint8*) obuf.Ptr(), 0, 15);
   340 			r = prop.Set(ibuf);
   353 			r = prop.Set(ibuf);
   341 			BASIC_ERROR(r, r == KErrNone);
   354 			BASIC_ERROR(r, r == KErrNone);
       
   355 
       
   356 			NKern::LockSystem();
       
   357 			defined = prop.GetStatus(propStatus);
       
   358 			NKern::UnlockSystem();
       
   359 			BASIC_ERROR(propStatus.iSize, propStatus.iSize == ibuf.Length());
       
   360 
   342 			r = prop.Get(optr);
   361 			r = prop.Get(optr);
   343 			BASIC_ERROR(r, r == KErrOverflow);
   362 			BASIC_ERROR(r, r == KErrOverflow);
   344 			BASIC_ERROR(optr.Length(), optr.Length() == 15); 
   363 			BASIC_ERROR(optr.Length(), optr.Length() == 15); 
   345 			BASIC_ERROR(obuf[14], obuf[14] == '4'); 
   364 			BASIC_ERROR(obuf[14], obuf[14] == '4'); 
   346 			BASIC_ERROR(obuf[15], obuf[15] == 'p');
   365 			BASIC_ERROR(obuf[15], obuf[15] == 'p');