changeset 279 | 957c583b417b |
parent 244 | a77889bee936 |
child 293 | 0659d0e1a03c |
275:2b433474f2ba | 279:957c583b417b |
---|---|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-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". |
1315 //! |
1315 //! |
1316 //! 1) Call API to modify the state of the resource. |
1316 //! 1) Call API to modify the state of the resource. |
1317 //! |
1317 //! |
1318 //! 2) Call API to get the new state of the resource and check it exhibits |
1318 //! 2) Call API to get the new state of the resource and check it exhibits |
1319 //! the expected value. |
1319 //! the expected value. |
1320 //! |
1320 //! |
1321 //! 3) Call API to return the resource state to its original value. |
1321 //! 3) Call API to modify the state of the resource by setting its level to zero. |
1322 //! |
1322 //! |
1323 //! 4) Call API to get the state of a long latency resource then call API |
1323 //! 4) Call API to get the state of the resource and check it exhibits the expected zero value. |
1324 //! |
|
1325 //! 5) Call API to return the resource state to its original value. |
|
1326 //! |
|
1327 //! 6) Call API to get the state of a long latency resource then call API |
|
1324 //! with operation-type qualifier cancel the request. |
1328 //! with operation-type qualifier cancel the request. |
1325 //! |
1329 //! |
1326 //! 5) Call API to modify the state of the long latency resource then call API |
1330 //! 7) Call API to modify the state of the long latency resource then call API |
1327 //! with operation-type qualifier to cancel the request. |
1331 //! with operation-type qualifier to cancel the request. |
1328 //! |
1332 //! |
1329 //! 6) Call API to get the state of a long latency resource and wait for it |
1333 //! 8) Call API to get the state of a long latency resource and wait for it |
1330 //! to complete. Then call API with operation-type qualifier to cancel the request. |
1334 //! to complete. Then call API with operation-type qualifier to cancel the request. |
1331 //! |
1335 //! |
1332 //! 7) Call API to modify the state of the long latency resource and wait for |
1336 //! 9) Call API to modify the state of the long latency resource and wait for |
1333 //! it to complete. Then call API with operation-type qualifier to cancel the request. |
1337 //! it to complete. Then call API with operation-type qualifier to cancel the request. |
1334 //! |
1338 //! |
1335 //! 8) Call API to get the state of a long latency resource then call API |
1339 //! 10) Call API to get the state of a long latency resource then call API |
1336 //! without operation-type qualifier to cancel the request. |
1340 //! without operation-type qualifier to cancel the request. |
1337 //! |
1341 //! |
1338 //! 9) Call API to modify the state of the long latency resource then call API |
1342 //! 11) Call API to modify the state of the long latency resource then call API |
1339 //! without operation-type qualifier to cancel the request. |
1343 //! without operation-type qualifier to cancel the request. |
1340 //! |
1344 //! |
1341 //! 10) Call API to get the state of a long latency resource and wait for it |
1345 //! 12) Call API to get the state of a long latency resource and wait for it |
1342 //! to complete. Then call API without operation-type qualifier to cancel the request. |
1346 //! to complete. Then call API without operation-type qualifier to cancel the request. |
1343 //! |
1347 //! |
1344 //! 11) Call API to modify the state of the long latency resource and wait for |
1348 //! 13) Call API to modify the state of the long latency resource and wait for |
1345 //! it to complete. Then call API without operation-type qualifier to cancel the request. |
1349 //! it to complete. Then call API without operation-type qualifier to cancel the request. |
1346 //! |
1350 //! |
1347 //! 12) Call API to get the state of a long latency resource 'n' times. Then call API with |
1351 //! 14) Call API to get the state of a long latency resource 'n' times. Then call API with |
1348 //! resource qualifier to cancel the requests. |
1352 //! resource qualifier to cancel the requests. |
1349 //! |
1353 //! |
1350 //! 13) Call API to modify the state of a long latency resource 'm' times. Then call API with |
1354 //! 15) Call API to modify the state of a long latency resource 'm' times. Then call API with |
1351 //! resource qualifier to cancel the requests. |
1355 //! resource qualifier to cancel the requests. |
1352 //! |
1356 //! |
1353 //! 14) Call API to get the state of a long latency resource 'n' times and wait for them to complete. |
1357 //! 16) Call API to get the state of a long latency resource 'n' times and wait for them to complete. |
1354 //! Then call API with resource qualifier to cancel the requests. |
1358 //! Then call API with resource qualifier to cancel the requests. |
1355 //! |
1359 //! |
1356 //! 15) Call API to modify the state of a long latency resource 'm' times and wait for them to complete. |
1360 //! 17) Call API to modify the state of a long latency resource 'm' times and wait for them to complete. |
1357 //! Then call API with resource qualifier to cancel the requests. |
1361 //! Then call API with resource qualifier to cancel the requests. |
1358 //! |
1362 //! |
1359 //! 16) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1363 //! 18) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1360 //! a long latency resource 'm' times. Call the API to cancel the get operations with resource qualifier. |
1364 //! a long latency resource 'm' times. Call the API to cancel the get operations with resource qualifier. |
1361 //! Wait for the operations to complete. Check the state of the associated TRequestStatus objects. |
1365 //! Wait for the operations to complete. Check the state of the associated TRequestStatus objects. |
1362 //! |
1366 //! |
1363 //! 17) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1367 //! 19) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1364 //! a long latency resource 'm' times. Call the API to cancel the modify operations with resource qualifier. |
1368 //! a long latency resource 'm' times. Call the API to cancel the modify operations with resource qualifier. |
1365 //! Wait for the get operations to complete. Check the state of the associated TRequestStatus objects. |
1369 //! Wait for the get operations to complete. Check the state of the associated TRequestStatus objects. |
1366 //! |
1370 //! |
1367 //! 18) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1371 //! 20) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1368 //! a long latency resource 'm' times. Wait for the get operations to complete. Call the API to cancel the get |
1372 //! a long latency resource 'm' times. Wait for the get operations to complete. Call the API to cancel the get |
1369 //! operations with resource qualifier. Check the state of the associated TRequestStatus objects. |
1373 //! operations with resource qualifier. Check the state of the associated TRequestStatus objects. |
1370 //! |
1374 //! |
1371 //! 19) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1375 //! 21) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1372 //! a long latency resource 'm' times. Wait for the modify operations to complete. Call the API to cancel the modify |
1376 //! a long latency resource 'm' times. Wait for the modify operations to complete. Call the API to cancel the modify |
1373 //! operations with resource qualifier. Check the state of the associated TRequestStatus objects. |
1377 //! operations with resource qualifier. Check the state of the associated TRequestStatus objects. |
1374 //! |
1378 //! |
1375 //! 20) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1379 //! 22) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1376 //! a long latency resource 'm' times. |
1380 //! a long latency resource 'm' times. |
1377 //! Then call API with operation-type qualifier to cancel the even-numbered get request(s). |
1381 //! Then call API with operation-type qualifier to cancel the even-numbered get request(s). |
1378 //! Then call API without operation-type qualifier to cancel the even-numbered modify request(s). |
1382 //! Then call API without operation-type qualifier to cancel the even-numbered modify request(s). |
1379 //! Check the state of the associated TRequestStatus objects. |
1383 //! Check the state of the associated TRequestStatus objects. |
1380 //! |
1384 //! |
1385 //! 2) The associated TRequestStatus object should indicate KErrNone, exits otherwise. |
1389 //! 2) The associated TRequestStatus object should indicate KErrNone, exits otherwise. |
1386 //! Exit if the value read back is not as expected. |
1390 //! Exit if the value read back is not as expected. |
1387 //! |
1391 //! |
1388 //! 3) The associated TRequestStatus object should indicate KErrNone, exits otherwise. |
1392 //! 3) The associated TRequestStatus object should indicate KErrNone, exits otherwise. |
1389 //! |
1393 //! |
1390 //! 4) The associated TRequestStatus object should indicate KErrCancel if the cancel |
1394 //! 4) The associated TRequestStatus object should indicate KErrNone, exits otherwise. |
1395 //! Exit if the value read back is not as expected. |
|
1396 //! |
|
1397 //! 5) The associated TRequestStatus object should indicate KErrNone, exits otherwise. |
|
1398 //! |
|
1399 //! 6) The associated TRequestStatus object should indicate KErrCancel if the cancel |
|
1391 //! request was accepted, exits otherwise. |
1400 //! request was accepted, exits otherwise. |
1392 //! The associated TRequestStatus object should indicate KErrNone if the cancel request |
1401 //! The associated TRequestStatus object should indicate KErrNone if the cancel request |
1393 //! was not accepted, exits otherwise. |
1402 //! was not accepted, exits otherwise. |
1394 //! |
1403 //! |
1395 //! 5) The associated TRequestStatus object should indicate KErrCancel if the cancel |
1404 //! 7) The associated TRequestStatus object should indicate KErrCancel if the cancel |
1396 //! request was accepted, exits otherwise. |
1405 //! request was accepted, exits otherwise. |
1397 //! The associated TRequestStatus object should indicate KErrNone if the cancel request |
1406 //! The associated TRequestStatus object should indicate KErrNone if the cancel request |
1398 //! was not accepted, exits otherwise. |
1407 //! was not accepted, exits otherwise. |
1399 //! |
1408 //! |
1400 //! 6) The TRequestStatus object associated with the get operation should indicate |
1409 //! 8) The TRequestStatus object associated with the get operation should indicate |
1401 //! KErrNone - exits otherwise. The TRequestStatus object associated with the cancel |
1410 //! KErrNone - exits otherwise. The TRequestStatus object associated with the cancel |
1402 //! operation should indicate KErrNone - exits otherwise. |
1411 //! operation should indicate KErrNone - exits otherwise. |
1403 //! |
1412 //! |
1404 //! 7) The TRequestStatus object associated with the get operation should indicate |
1413 //! 9) The TRequestStatus object associated with the get operation should indicate |
1405 //! KErrNone - exits otherwise. The TRequestStatus object associated with the cancel |
1414 //! KErrNone - exits otherwise. The TRequestStatus object associated with the cancel |
1406 //! operation should indicate KErrNone - exits otherwise. |
1415 //! operation should indicate KErrNone - exits otherwise. |
1407 //! |
1416 //! |
1408 //! 8) The associated TRequestStatus object should indicate KErrCancel, exits otherwise. |
1417 //! 10) The associated TRequestStatus object should indicate KErrCancel, exits otherwise. |
1409 //! |
1418 //! |
1410 //! 9) The associated TRequestStatus object should indicate KErrCancel, exits otherwise. |
1419 //! 11) The associated TRequestStatus object should indicate KErrCancel, exits otherwise. |
1411 //! |
1420 //! |
1412 //! 10) The TRequestStatus object associated with the get operation should indicate |
1421 //! 12) The TRequestStatus object associated with the get operation should indicate |
1413 //! KErrNone - exits otherwise. The TRequestStatus object associated with the cancel |
1422 //! KErrNone - exits otherwise. The TRequestStatus object associated with the cancel |
1414 //! operation should indicate KErrNone - exits otherwise. |
1423 //! operation should indicate KErrNone - exits otherwise. |
1415 //! |
1424 //! |
1416 //! 11) The TRequestStatus object associated with the get operation should indicate |
1425 //! 13) The TRequestStatus object associated with the get operation should indicate |
1417 //! KErrNone - exits otherwise. The TRequestStatus object associated with the cancel |
1426 //! KErrNone - exits otherwise. The TRequestStatus object associated with the cancel |
1418 //! operation should indicate KErrNone - exits otherwise. |
1427 //! operation should indicate KErrNone - exits otherwise. |
1419 //! |
1428 //! |
1420 //! 12) The TRequestStatus objects should all exibit KErrCancel - exits otherwise. |
1429 //! 14) The TRequestStatus objects should all exibit KErrCancel - exits otherwise. |
1421 //! |
1430 //! |
1422 //! 13) The TRequestStatus objects should all exibit KErrCancel - exits otherwise. |
1431 //! 15) The TRequestStatus objects should all exibit KErrCancel - exits otherwise. |
1423 //! |
1432 //! |
1424 //! 14) The TRequestStatus objects associated with the get operations should all exibit KErrNone - exits otherwise. |
1433 //! 16) The TRequestStatus objects associated with the get operations should all exibit KErrNone - exits otherwise. |
1425 //! The TRequestStatus objects associated with the cancel operations should all exibit KErrNone - exits otherwise |
1434 //! The TRequestStatus objects associated with the cancel operations should all exibit KErrNone - exits otherwise |
1426 //! |
1435 //! |
1427 //! 15) The TRequestStatus objects associated with the modify operations should all exibit KErrNone - exits otherwise. |
1436 //! 17) The TRequestStatus objects associated with the modify operations should all exibit KErrNone - exits otherwise. |
1428 //! The TRequestStatus objects associated with the cancel operations should all exibit KErrNone - exits otherwise |
1437 //! The TRequestStatus objects associated with the cancel operations should all exibit KErrNone - exits otherwise |
1429 //! |
1438 //! |
1430 //! 16) The TRequestStatus objects associated with the get operations should all exibit KErrCancel - exits otherwise. |
1439 //! 18) The TRequestStatus objects associated with the get operations should all exibit KErrCancel - exits otherwise. |
1431 //! The TRequestStatus objects associated with the modify operations should all exibit KErrNone - exits otherwise |
1440 //! The TRequestStatus objects associated with the modify operations should all exibit KErrNone - exits otherwise |
1432 //! |
1441 //! |
1433 //! 17) The TRequestStatus objects associated with the get operations should all exibit KErrNone - exits otherwise. |
1442 //! 19) The TRequestStatus objects associated with the get operations should all exibit KErrNone - exits otherwise. |
1434 //! The TRequestStatus objects associated with the modify operations should all exibit KErrCancel - exits otherwise |
1443 //! The TRequestStatus objects associated with the modify operations should all exibit KErrCancel - exits otherwise |
1435 //! |
1444 //! |
1436 //! 18) The TRequestStatus objects associated with the get and modify operations should all exibit KErrNone - exits otherwise. |
1445 //! 20) The TRequestStatus objects associated with the get and modify operations should all exibit KErrNone - exits otherwise. |
1437 //! |
1446 //! |
1438 //! 19) The TRequestStatus objects associated with the get and modify operations should all exibit KErrNone - exits otherwise. |
1447 //! 21) The TRequestStatus objects associated with the get and modify operations should all exibit KErrNone - exits otherwise. |
1439 //! |
1448 //! |
1440 //! 20) The TRequestStatus objects associated with the even-numbered request should exhibit KErrCancel. |
1449 //! 22) The TRequestStatus objects associated with the even-numbered request should exhibit KErrCancel. |
1441 //! The TRequestStatus objects associated with the odd-numbered request should exhibit KErrNone. |
1450 //! The TRequestStatus objects associated with the odd-numbered request should exhibit KErrNone. |
1442 //! |
1451 //! |
1443 //! @SYMTestPriority High |
1452 //! @SYMTestPriority High |
1444 //! @SYMTestStatus Implemented |
1453 //! @SYMTestStatus Implemented |
1445 //---------------------------------------------------------------------------------------------- |
1454 //---------------------------------------------------------------------------------------------- |
1498 return r; |
1507 return r; |
1499 } |
1508 } |
1500 gTest.Printf(_L("TestGetSetResourceStateOps: level read back =0x%x, levelOwnerId=%d\n"),readValue,levelOwnerId); |
1509 gTest.Printf(_L("TestGetSetResourceStateOps: level read back =0x%x, levelOwnerId=%d\n"),readValue,levelOwnerId); |
1501 gTest(newLevel==(TUint)readValue); |
1510 gTest(newLevel==(TUint)readValue); |
1502 |
1511 |
1503 // 3) Call API to return the resource state to its original value. |
1512 // 3) Call API to modify the state of the resource by setting its level to zero |
1513 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
|
1514 gChannel.ChangeResourceState(status,gLongLatencyResource,0); |
|
1515 User::WaitForRequest(status); |
|
1516 if(status != KErrNone) |
|
1517 { |
|
1518 gTest.Printf(_L("ChangeResourceState to level 0 returned %d\n"),r); |
|
1519 return r; |
|
1520 } |
|
1521 |
|
1522 // 4) Call API to get the state of the resource and check it exhibits the expected zero value. |
|
1523 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
|
1524 gChannel.GetResourceState(status,gLongLatencyResource,cached,&readValue,&levelOwnerId); |
|
1525 User::WaitForRequest(status); |
|
1526 if(status != KErrNone) |
|
1527 { |
|
1528 gTest.Printf(_L("TestGetSetResourceStateOps, get state status = %d\n"),r); |
|
1529 return r; |
|
1530 } |
|
1531 gTest.Printf(_L("TestGetSetResourceStateOps: level read back =0x%x, levelOwnerId=%d\n"),readValue,levelOwnerId); |
|
1532 gTest(readValue==0); |
|
1533 |
|
1534 // 5) Call API to return the resource state to its original value. |
|
1504 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1535 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1505 gTest.Printf(_L("TestGetSetResourceStateOps: write original level 0x%x\n"), startingLevel); |
1536 gTest.Printf(_L("TestGetSetResourceStateOps: write original level 0x%x\n"), startingLevel); |
1506 gChannel.ChangeResourceState(status,gLongLatencyResource,startingLevel); |
1537 gChannel.ChangeResourceState(status,gLongLatencyResource,startingLevel); |
1507 User::WaitForRequest(status); |
1538 User::WaitForRequest(status); |
1508 if(status.Int() != KErrNone) |
1539 if(status.Int() != KErrNone) |
1517 gTest.Printf(_L("TestGetSetResourceStateOps, get state status = %d\n"),r); |
1548 gTest.Printf(_L("TestGetSetResourceStateOps, get state status = %d\n"),r); |
1518 return r; |
1549 return r; |
1519 } |
1550 } |
1520 gTest.Printf(_L("TestGetSetResourceStateOps: check original level read back =0x%x, levelOwnerId=%d\n"),readValue,levelOwnerId); |
1551 gTest.Printf(_L("TestGetSetResourceStateOps: check original level read back =0x%x, levelOwnerId=%d\n"),readValue,levelOwnerId); |
1521 |
1552 |
1522 // 4) Call API to get the state of a long latency resource then call API with operation-type qualifier cancel the request. |
1553 // 6) Call API to get the state of a long latency resource then call API with operation-type qualifier cancel the request. |
1523 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1554 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1524 gChannel.GetResourceState(status,gLongLatencyResource,cached,&readValue,&levelOwnerId); |
1555 gChannel.GetResourceState(status,gLongLatencyResource,cached,&readValue,&levelOwnerId); |
1525 r=gChannel.CancelGetResourceState(status); |
1556 r=gChannel.CancelGetResourceState(status); |
1526 if(r!=KErrInUse) |
1557 if(r!=KErrInUse) |
1527 { |
1558 { |
1552 return r; |
1583 return r; |
1553 } |
1584 } |
1554 |
1585 |
1555 } |
1586 } |
1556 |
1587 |
1557 // 5) Call API to modify the state of the long latency resource then call API with operation-type qualifier to cancel the request. |
1588 // 7) Call API to modify the state of the long latency resource then call API with operation-type qualifier to cancel the request. |
1558 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1589 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1559 newLevel = (TUint)(readValue + gAsyncResStateDelta); |
1590 newLevel = (TUint)(readValue + gAsyncResStateDelta); |
1560 gChannel.ChangeResourceState(status,gLongLatencyResource,newLevel); |
1591 gChannel.ChangeResourceState(status,gLongLatencyResource,newLevel); |
1561 r=gChannel.CancelChangeResourceState(status); |
1592 r=gChannel.CancelChangeResourceState(status); |
1562 if(r!=KErrInUse) |
1593 if(r!=KErrInUse) |
1588 return r; |
1619 return r; |
1589 } |
1620 } |
1590 } |
1621 } |
1591 |
1622 |
1592 |
1623 |
1593 // 6) Call API to get the state of a long latency resource and wait for it to complete. |
1624 // 8) Call API to get the state of a long latency resource and wait for it to complete. |
1594 // Then call API with operation-type qualifier to cancel the request. |
1625 // Then call API with operation-type qualifier to cancel the request. |
1595 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1626 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1596 gChannel.GetResourceState(status,gLongLatencyResource,cached,&readValue,&levelOwnerId); |
1627 gChannel.GetResourceState(status,gLongLatencyResource,cached,&readValue,&levelOwnerId); |
1597 User::WaitForRequest(status); |
1628 User::WaitForRequest(status); |
1598 if(status.Int() != KErrNone) |
1629 if(status.Int() != KErrNone) |
1609 { |
1640 { |
1610 gTest.Printf(_L("TestGetSetResourceStateOps, completed-then-cancelled get state status = %d\n"),r); |
1641 gTest.Printf(_L("TestGetSetResourceStateOps, completed-then-cancelled get state status = %d\n"),r); |
1611 return r; |
1642 return r; |
1612 } |
1643 } |
1613 |
1644 |
1614 // 7) Call API to modify the state of the long latency resource and wait for it to complete. |
1645 // 9) Call API to modify the state of the long latency resource and wait for it to complete. |
1615 // Then call API with operation-type qualifier to cancel the request. |
1646 // Then call API with operation-type qualifier to cancel the request. |
1616 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1647 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1617 gChannel.ChangeResourceState(status,gLongLatencyResource,(readValue + gAsyncResStateDelta)); |
1648 gChannel.ChangeResourceState(status,gLongLatencyResource,(readValue + gAsyncResStateDelta)); |
1618 User::WaitForRequest(status); |
1649 User::WaitForRequest(status); |
1619 if(status.Int() != KErrNone) |
1650 if(status.Int() != KErrNone) |
1630 { |
1661 { |
1631 gTest.Printf(_L("TestGetSetResourceStateOps, completed-then-cancelled change state status = %d\n"),r); |
1662 gTest.Printf(_L("TestGetSetResourceStateOps, completed-then-cancelled change state status = %d\n"),r); |
1632 return r; |
1663 return r; |
1633 } |
1664 } |
1634 |
1665 |
1635 // 8) Call API to get the state of a long latency resource then call API without operation-type qualifier to cancel the request. |
1666 // 10) Call API to get the state of a long latency resource then call API without operation-type qualifier to cancel the request. |
1636 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1667 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1637 |
1668 |
1638 // NOTE: Cancel operation can only remove request which is still inside the resource controller |
1669 // NOTE: Cancel operation can only remove request which is still inside the resource controller |
1639 // message queue. If the queue is empty, the resource controller may process the request very quickly |
1670 // message queue. If the queue is empty, the resource controller may process the request very quickly |
1640 // after it is sent. It may cause the test fail. To solve this, two get long latency resource state |
1671 // after it is sent. It may cause the test fail. To solve this, two get long latency resource state |
1651 { |
1682 { |
1652 gTest.Printf(_L("TestGetSetResourceStateOps, cancelled get state status = %d\n"),r); |
1683 gTest.Printf(_L("TestGetSetResourceStateOps, cancelled get state status = %d\n"),r); |
1653 return r; |
1684 return r; |
1654 } |
1685 } |
1655 |
1686 |
1656 // 9) Call API to modify the state of the long latency resource then call API without operation-type qualifier to cancel the request. |
1687 // 11) Call API to modify the state of the long latency resource then call API without operation-type qualifier to cancel the request. |
1657 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1688 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1658 |
1689 |
1659 // NOTE: Cancel operation can only remove request which is still inside the resource controller |
1690 // NOTE: Cancel operation can only remove request which is still inside the resource controller |
1660 // message queue. If the queue is empty, the resource controller may process the request very quickly |
1691 // message queue. If the queue is empty, the resource controller may process the request very quickly |
1661 // after it is sent. It may cause the test fail. To solve this, two get long latency resource state |
1692 // after it is sent. It may cause the test fail. To solve this, two get long latency resource state |
1673 { |
1704 { |
1674 gTest.Printf(_L("TestGetSetResourceStateOps, cancelled change state status = %d\n"),r); |
1705 gTest.Printf(_L("TestGetSetResourceStateOps, cancelled change state status = %d\n"),r); |
1675 return r; |
1706 return r; |
1676 } |
1707 } |
1677 |
1708 |
1678 // 10) Call API to get the state of a long latency resource and wait for it to complete. |
1709 // 12) Call API to get the state of a long latency resource and wait for it to complete. |
1679 // Then call API without operation-type qualifier to cancel the request. |
1710 // Then call API without operation-type qualifier to cancel the request. |
1680 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1711 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1681 gChannel.GetResourceState(status,gLongLatencyResource,cached,&readValue,&levelOwnerId); |
1712 gChannel.GetResourceState(status,gLongLatencyResource,cached,&readValue,&levelOwnerId); |
1682 User::WaitForRequest(status); |
1713 User::WaitForRequest(status); |
1683 if(status.Int() != KErrNone) |
1714 if(status.Int() != KErrNone) |
1690 { |
1721 { |
1691 gTest.Printf(_L("TestGetSetResourceStateOps, completed-then-cancelled get state status = %d\n"),r); |
1722 gTest.Printf(_L("TestGetSetResourceStateOps, completed-then-cancelled get state status = %d\n"),r); |
1692 return r; |
1723 return r; |
1693 } |
1724 } |
1694 |
1725 |
1695 // 11) Call API to modify the state of the long latency resource and wait for it to complete. |
1726 // 13) Call API to modify the state of the long latency resource and wait for it to complete. |
1696 // Then call API without operation-type qualifier to cancel the request. |
1727 // Then call API without operation-type qualifier to cancel the request. |
1697 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1728 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1698 gChannel.ChangeResourceState(status,gLongLatencyResource,(readValue + gAsyncResStateDelta)); |
1729 gChannel.ChangeResourceState(status,gLongLatencyResource,(readValue + gAsyncResStateDelta)); |
1699 User::WaitForRequest(status); |
1730 User::WaitForRequest(status); |
1700 if(status.Int() != KErrNone) |
1731 if(status.Int() != KErrNone) |
1714 const TInt KLoopVarM = 3; |
1745 const TInt KLoopVarM = 3; |
1715 TRequestStatus getReqStatus[KLoopVarN]; |
1746 TRequestStatus getReqStatus[KLoopVarN]; |
1716 TRequestStatus setReqStatus[KLoopVarM]; |
1747 TRequestStatus setReqStatus[KLoopVarM]; |
1717 TInt i=0; |
1748 TInt i=0; |
1718 |
1749 |
1719 // 12) Call API to get the state of a long latency resource 'n' times. |
1750 // 14) Call API to get the state of a long latency resource 'n' times. |
1720 // Then call API with resource qualifier to cancel the requests. |
1751 // Then call API with resource qualifier to cancel the requests. |
1721 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1752 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1722 for(i=0;i<KLoopVarN;i++) |
1753 for(i=0;i<KLoopVarN;i++) |
1723 { |
1754 { |
1724 gChannel.GetResourceState(getReqStatus[i],gLongLatencyResource,cached,&readValue,&levelOwnerId); |
1755 gChannel.GetResourceState(getReqStatus[i],gLongLatencyResource,cached,&readValue,&levelOwnerId); |
1737 gTest.Printf(_L("TestGetSetResourceStateOps, cancelled get state status[%d] = %d\n"),i,r); |
1768 gTest.Printf(_L("TestGetSetResourceStateOps, cancelled get state status[%d] = %d\n"),i,r); |
1738 return r; |
1769 return r; |
1739 } |
1770 } |
1740 } |
1771 } |
1741 |
1772 |
1742 // 13) Call API to modify the state of a long latency resource 'm' times. |
1773 // 15) Call API to modify the state of a long latency resource 'm' times. |
1743 // Then call API with resource qualifier to cancel the requests. |
1774 // Then call API with resource qualifier to cancel the requests. |
1744 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1775 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1745 for(i=0;i<KLoopVarM;i++) |
1776 for(i=0;i<KLoopVarM;i++) |
1746 { |
1777 { |
1747 gChannel.ChangeResourceState(setReqStatus[i],gLongLatencyResource,(readValue + gAsyncResStateDelta)); |
1778 gChannel.ChangeResourceState(setReqStatus[i],gLongLatencyResource,(readValue + gAsyncResStateDelta)); |
1760 gTest.Printf(_L("TestGetSetResourceStateOps, cancelled change state status[%d] = %d\n"),i,r); |
1791 gTest.Printf(_L("TestGetSetResourceStateOps, cancelled change state status[%d] = %d\n"),i,r); |
1761 return r; |
1792 return r; |
1762 } |
1793 } |
1763 } |
1794 } |
1764 |
1795 |
1765 // 14) Call API to get the state of a long latency resource 'n' times and wait for them to complete. |
1796 // 16) Call API to get the state of a long latency resource 'n' times and wait for them to complete. |
1766 // Then call API with resource qualifier to cancel the requests. |
1797 // Then call API with resource qualifier to cancel the requests. |
1767 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1798 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1768 for(i=0;i<KLoopVarN;i++) |
1799 for(i=0;i<KLoopVarN;i++) |
1769 { |
1800 { |
1770 gChannel.GetResourceState(getReqStatus[i],gLongLatencyResource,cached,&readValue,&levelOwnerId); |
1801 gChannel.GetResourceState(getReqStatus[i],gLongLatencyResource,cached,&readValue,&levelOwnerId); |
1786 gTest.Printf(_L("TestGetSetResourceStateOps, after cancel get state status[%d] = %d\n"),i,r); |
1817 gTest.Printf(_L("TestGetSetResourceStateOps, after cancel get state status[%d] = %d\n"),i,r); |
1787 return r; |
1818 return r; |
1788 } |
1819 } |
1789 } |
1820 } |
1790 |
1821 |
1791 // 15) Call API to modify the state of a long latency resource 'm' times and wait for them to complete. |
1822 // 17) Call API to modify the state of a long latency resource 'm' times and wait for them to complete. |
1792 // Then call API with resource qualifier to cancel the requests. |
1823 // Then call API with resource qualifier to cancel the requests. |
1793 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1824 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1794 for(i=0;i<KLoopVarM;i++) |
1825 for(i=0;i<KLoopVarM;i++) |
1795 { |
1826 { |
1796 gChannel.ChangeResourceState(setReqStatus[i],gLongLatencyResource,(readValue + gAsyncResStateDelta)); |
1827 gChannel.ChangeResourceState(setReqStatus[i],gLongLatencyResource,(readValue + gAsyncResStateDelta)); |
1812 gTest.Printf(_L("TestGetSetResourceStateOps, after cancel change state status[%d] = %d\n"),i,r); |
1843 gTest.Printf(_L("TestGetSetResourceStateOps, after cancel change state status[%d] = %d\n"),i,r); |
1813 return r; |
1844 return r; |
1814 } |
1845 } |
1815 } |
1846 } |
1816 |
1847 |
1817 // 16) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1848 // 18) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1818 // a long latency resource 'm' times. |
1849 // a long latency resource 'm' times. |
1819 // Call the API to cancel the get operations with resource qualifier. |
1850 // Call the API to cancel the get operations with resource qualifier. |
1820 // Wait for the operations to complete. Check the state of the associated TRequestStatus objects. |
1851 // Wait for the operations to complete. Check the state of the associated TRequestStatus objects. |
1821 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1852 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1822 for(i=0;i<KLoopVarN;i++) |
1853 for(i=0;i<KLoopVarN;i++) |
1850 gTest.Printf(_L("TestGetSetResourceStateOps, completed change state status[%d] = %d\n"),i,r); |
1881 gTest.Printf(_L("TestGetSetResourceStateOps, completed change state status[%d] = %d\n"),i,r); |
1851 return r; |
1882 return r; |
1852 } |
1883 } |
1853 } |
1884 } |
1854 |
1885 |
1855 // 17) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1886 // 19) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1856 // a long latency resource 'm' times. |
1887 // a long latency resource 'm' times. |
1857 // Call the API to cancel the modify operations with resource qualifier. |
1888 // Call the API to cancel the modify operations with resource qualifier. |
1858 // Wait for the get operations to complete. Check the state of the associated TRequestStatus objects. |
1889 // Wait for the get operations to complete. Check the state of the associated TRequestStatus objects. |
1859 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1890 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1860 for(i=0;i<KLoopVarN;i++) |
1891 for(i=0;i<KLoopVarN;i++) |
1883 gTest.Printf(_L("TestGetSetResourceStateOps, cancelled change state status[%d] = %d\n"),i,r); |
1914 gTest.Printf(_L("TestGetSetResourceStateOps, cancelled change state status[%d] = %d\n"),i,r); |
1884 return r; |
1915 return r; |
1885 } |
1916 } |
1886 } |
1917 } |
1887 |
1918 |
1888 // 18) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1919 // 20) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1889 // a long latency resource 'm' times. Wait for the get operations to complete. |
1920 // a long latency resource 'm' times. Wait for the get operations to complete. |
1890 // Call the API to cancel the get operations with resource qualifier. Check the state of the associated TRequestStatus objects. |
1921 // Call the API to cancel the get operations with resource qualifier. Check the state of the associated TRequestStatus objects. |
1891 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1922 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1892 for(i=0;i<KLoopVarN;i++) |
1923 for(i=0;i<KLoopVarN;i++) |
1893 { |
1924 { |
1925 gTest.Printf(_L("TestGetSetResourceStateOps, completed-then-cancelled get state status[%d]= %d\n"),i,r); |
1956 gTest.Printf(_L("TestGetSetResourceStateOps, completed-then-cancelled get state status[%d]= %d\n"),i,r); |
1926 return r; |
1957 return r; |
1927 } |
1958 } |
1928 } |
1959 } |
1929 |
1960 |
1930 // 19) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1961 // 21) Call API to get the state of a long latency resource 'n' times, call API to modify the state of |
1931 // a long latency resource 'm' times. Wait for the modify operations to complete. Call the API to cancel the modify |
1962 // a long latency resource 'm' times. Wait for the modify operations to complete. Call the API to cancel the modify |
1932 // operations with resource qualifier. Check the state of the associated TRequestStatus objects. |
1963 // operations with resource qualifier. Check the state of the associated TRequestStatus objects. |
1933 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1964 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1934 for(i=0;i<KLoopVarN;i++) |
1965 for(i=0;i<KLoopVarN;i++) |
1935 { |
1966 { |
1965 gTest.Printf(_L("TestGetSetResourceStateOps, cancelled change state status[%d] = %d\n"),i,r); |
1996 gTest.Printf(_L("TestGetSetResourceStateOps, cancelled change state status[%d] = %d\n"),i,r); |
1966 return r; |
1997 return r; |
1967 } |
1998 } |
1968 } |
1999 } |
1969 |
2000 |
1970 // 20) Call API to get the state of a long latency resource 'n' times, call API to modify the state of a long latency resource 'm' times. |
2001 // 22) Call API to get the state of a long latency resource 'n' times, call API to modify the state of a long latency resource 'm' times. |
1971 // Then call API without operation-type qualifier to cancel the even-numbered modify request(s). |
2002 // Then call API without operation-type qualifier to cancel the even-numbered modify request(s). |
1972 // Then call API with operation-type qualifier to cancel the even-numbered get request(s). |
2003 // Then call API with operation-type qualifier to cancel the even-numbered get request(s). |
1973 // Check the state of the associated TRequestStatus objects. |
2004 // Check the state of the associated TRequestStatus objects. |
1974 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
2005 gTest.Printf(_L("TestGetSetResourceStateOps, starting test %d\n"),testNo++); |
1975 for(i=0;i<KLoopVarN;i++) |
2006 for(i=0;i<KLoopVarN;i++) |