152a38012SejakowatzBMessenger() 252a38012Sejakowatzcase 1: IsValid() should return false. 352a38012Sejakowatz IsTargetLocal() should return false. 452a38012Sejakowatz Target() should return NULL and NULL for looper. 552a38012Sejakowatz Team() should return -1. 652a38012Sejakowatz 752a38012SejakowatzBMessenger(const BHandler *handler, const BLooper *looper, status_t *result) 852a38012Sejakowatzcase 1: handler is NULL, looper is NULL, result is NULL => 952a38012Sejakowatz IsValid() and IsTargetLocal() should return false 1052a38012Sejakowatz Target() should return NULL and NULL for looper. 1152a38012Sejakowatz Team() should return -1. 1252a38012Sejakowatzcase 2: handler is NULL, looper is NULL, result is not NULL => 1352a38012Sejakowatz IsValid() and IsTargetLocal() should return false. 1452a38012Sejakowatz Target() should return NULL and NULL for looper. 1552a38012Sejakowatz Team() should return -1. 1652a38012Sejakowatz result is set to B_BAD_VALUE. 1752a38012Sejakowatzcase 3: handler is NULL, looper is not NULL, result is not NULL => 1852a38012Sejakowatz IsValid() and IsTargetLocal() should return true. 1952a38012Sejakowatz Target() should return NULL and the correct value for looper. 2052a38012Sejakowatz Team() should return this team. 2152a38012Sejakowatz result is set to B_OK. 2252a38012Sejakowatzcase 4: handler is not NULL, looper is NULL, result is not NULL, 2352a38012Sejakowatz handler doesn't belong to a looper => 2452a38012Sejakowatz IsValid() and IsTargetLocal() should return false. 2552a38012Sejakowatz Target() should return NULL and NULL for looper. 2652a38012Sejakowatz Team() should return -1. 2752a38012Sejakowatz result is set to B_MISMATCHED_VALUES. 2852a38012Sejakowatzcase 5: handler is not NULL, looper is NULL, result is not NULL 2952a38012Sejakowatz handler does belong to a looper => 3052a38012Sejakowatz IsValid() and IsTargetLocal() should return true. 3152a38012Sejakowatz Target() should return the correct handler and handler->Looper() 3252a38012Sejakowatz for looper. 3352a38012Sejakowatz Team() should return this team. 3452a38012Sejakowatz result is set to B_OK. 3552a38012Sejakowatzcase 6: handler is not NULL, looper is not NULL, result is not NULL 3652a38012Sejakowatz handler does belong to the looper => 3752a38012Sejakowatz IsValid() and IsTargetLocal() should return true. 3852a38012Sejakowatz Target() should return the correct handler and the correct value 3952a38012Sejakowatz for looper. 4052a38012Sejakowatz Team() should return this team. 4152a38012Sejakowatz result is set to B_OK. 4252a38012Sejakowatzcase 7: handler is not NULL, looper is not NULL, result is not NULL 4352a38012Sejakowatz handler does belong to a different looper => 4452a38012Sejakowatz IsValid() and IsTargetLocal() should return false. 4552a38012Sejakowatz Target() should return NULL and NULL for looper. 4652a38012Sejakowatz Team() should return -1. 4752a38012Sejakowatz result is set to B_MISMATCHED_VALUES. 4852a38012Sejakowatz 4952a38012SejakowatzBMessenger(const BMessenger &from) 5052a38012Sejakowatzcase 1: from is uninitialized => 5152a38012Sejakowatz IsValid() and IsTargetLocal() should return false 5252a38012Sejakowatz Target() should return NULL and NULL for looper. 5352a38012Sejakowatz Team() should return -1. 5452a38012Sejakowatzcase 2: from is properly initialized to a local target => 5552a38012Sejakowatz IsValid() and IsTargetLocal() should return true 5652a38012Sejakowatz Target() should return the same values as for from. 5752a38012Sejakowatz Team() should return this team. 5852a38012Sejakowatz 5952a38012SejakowatzBMessenger(const char *signature, team_id team, status_t *result) 6052a38012SejakowatzTODO 6152a38012Sejakowatz 624f139d77SIngo Weinholdbool IsTargetLocal() const 634f139d77SIngo Weinholdcase 1: this is uninitialized => 644f139d77SIngo Weinhold should return false. 654f139d77SIngo Weinholdcase 2: this is initialized to local target with preferred handler => 664f139d77SIngo Weinhold should return true. 674f139d77SIngo Weinholdcase 3: this is initialized to local target with specific handler => 684f139d77SIngo Weinhold should return true. 694f139d77SIngo Weinholdcase 4: this is initialized to local target with preferred handler => 704f139d77SIngo Weinhold should return false. 714f139d77SIngo Weinholdcase 5: this is initialized to remote target with specific handler => 724f139d77SIngo Weinhold should return false. 734f139d77SIngo Weinhold 74c1289294SIngo WeinholdBHandler *Target(BLooper **looper) const 75c1289294SIngo Weinholdcase 1: this is uninitialized, looper is NULL => 76c1289294SIngo Weinhold should return NULL. 77c1289294SIngo Weinholdcase 2: this is initialized to local target with preferred handler, 78c1289294SIngo Weinhold looper is NULL => 79c1289294SIngo Weinhold should return NULL. 80c1289294SIngo Weinholdcase 3: this is initialized to local target with specific handler, 81c1289294SIngo Weinhold looper is NULL => 82c1289294SIngo Weinhold should return correct handler. 83c1289294SIngo Weinholdcase 4: this is initialized to remote target with preferred handler, 84c1289294SIngo Weinhold looper is NULL => 85c1289294SIngo Weinhold should return NULL. 86c1289294SIngo Weinholdcase 5: this is initialized to remote target with specific handler, 87c1289294SIngo Weinhold looper is NULL => 88c1289294SIngo Weinhold should return NULL. 897ce28c04SIngo Weinholdother cases included in BMessenger(...) cases 904f139d77SIngo Weinhold 91c1289294SIngo Weinholdbool LockTarget() const 92c1289294SIngo Weinholdcase 1: this is uninitialized => 93c1289294SIngo Weinhold should return false. 94c1289294SIngo Weinholdcase 2: this is initialized to local target with preferred handler, 95c1289294SIngo Weinhold looper is not locked => 96c1289294SIngo Weinhold should lock the looper and return true. 97c1289294SIngo Weinholdcase 3: this is initialized to local target with specific handler, 98c1289294SIngo Weinhold looper is not locked => 99c1289294SIngo Weinhold should lock the looper and return true. 100c1289294SIngo Weinholdcase 4: this is initialized to local target with preferred handler, 101c1289294SIngo Weinhold looper is locked by another thread => 102c1289294SIngo Weinhold should block until the looper is unlocked, lock it and return true. 103c1289294SIngo Weinholdcase 5: this is initialized to local target with specific handler, 104c1289294SIngo Weinhold looper is locked by another thread => 105c1289294SIngo Weinhold should block until the looper is unlocked, lock it and return true. 106c1289294SIngo Weinholdcase 6: this is initialized to remote target with preferred handler, 107c1289294SIngo Weinhold looper is not locked => 108c1289294SIngo Weinhold should not lock the looper and return false. 109c1289294SIngo Weinholdcase 7: this is initialized to remote target with specific handler, 110c1289294SIngo Weinhold looper is not locked => 111c1289294SIngo Weinhold should not lock the looper and return false. 112c1289294SIngo Weinhold 113c1289294SIngo Weinholdstatus_t LockTargetWithTimeout(bigtime_t timeout) const 1147ce28c04SIngo Weinholdcase 1: this is uninitialized => 1157ce28c04SIngo Weinhold should return B_BAD_VALUE. 1167ce28c04SIngo Weinholdcase 2: this is initialized to local target with preferred handler, 1177ce28c04SIngo Weinhold looper is not locked => 1187ce28c04SIngo Weinhold should lock the looper and return B_OK. 1197ce28c04SIngo Weinholdcase 3: this is initialized to local target with specific handler, 1207ce28c04SIngo Weinhold looper is not locked => 1217ce28c04SIngo Weinhold should lock the looper and return B_OK. 1227ce28c04SIngo Weinholdcase 4: this is initialized to local target with preferred handler, 1237ce28c04SIngo Weinhold looper is locked by another thread, timeout is 100ms => 1247ce28c04SIngo Weinhold should block until the looper is unlocked (after 50ms), lock it 1257ce28c04SIngo Weinhold and return B_OK. 1267ce28c04SIngo Weinholdcase 5: this is initialized to local target with preferred handler, 1277ce28c04SIngo Weinhold looper is locked by another thread, timeout is 25ms => 1287ce28c04SIngo Weinhold should block for 25ms, not until the looper is unlocked (after 50ms), 1297ce28c04SIngo Weinhold should return B_TIMED_OUT. 1307ce28c04SIngo Weinholdcase 6: this is initialized to local target with specific handler, 1317ce28c04SIngo Weinhold looper is locked by another thread, timeout is 100ms => 1327ce28c04SIngo Weinhold should block until the looper is unlocked (after 50ms), lock it 1337ce28c04SIngo Weinhold and return B_OK. 1347ce28c04SIngo Weinholdcase 7: this is initialized to local target with specific handler, 1357ce28c04SIngo Weinhold looper is locked by another thread, timeout is 25ms => 1367ce28c04SIngo Weinhold should block for 25ms, not until the looper is unlocked (after 50ms), 1377ce28c04SIngo Weinhold should return B_TIMED_OUT. 1387ce28c04SIngo Weinholdcase 8: this is initialized to remote target with preferred handler, 1397ce28c04SIngo Weinhold looper is not locked => 1407ce28c04SIngo Weinhold should not lock the looper and return B_BAD_VALUE. 1417ce28c04SIngo Weinholdcase 9: this is initialized to remote target with specific handler, 1427ce28c04SIngo Weinhold looper is not locked => 1437ce28c04SIngo Weinhold should not lock the looper and return B_BAD_VALUE. 1447ce28c04SIngo Weinhold 1457ce28c04SIngo Weinholdbool IsValid() const 1467ce28c04SIngo Weinholdincluded in BMessenger(...) cases 1477ce28c04SIngo Weinhold 1487ce28c04SIngo Weinholdteam_id Team() const 1497ce28c04SIngo Weinholdincluded in BMessenger(...) cases 1507ce28c04SIngo Weinhold 1517ce28c04SIngo WeinholdBMessenger &operator=(const BMessenger &from) 1527ce28c04SIngo Weinholdcase 1: from is uninitialized => 1537ce28c04SIngo Weinhold IsValid() and IsTargetLocal() should return false 1547ce28c04SIngo Weinhold Target() should return NULL and NULL for looper. 1557ce28c04SIngo Weinhold Team() should return -1. 1567ce28c04SIngo Weinholdcase 2: from is properly initialized to a local target (preferred handler) => 1577ce28c04SIngo Weinhold IsValid() and IsTargetLocal() should return true 1587ce28c04SIngo Weinhold Target() should return the same values as for from. 1597ce28c04SIngo Weinhold Team() should return this team. 1607ce28c04SIngo Weinholdcase 3: from is properly initialized to a local target (specific handler) => 1617ce28c04SIngo Weinhold IsValid() and IsTargetLocal() should return true 1627ce28c04SIngo Weinhold Target() should return the same values as for from. 1637ce28c04SIngo Weinhold Team() should return this team. 1647ce28c04SIngo Weinhold 1657ce28c04SIngo Weinholdbool operator==(const BMessenger &other) const 1667ce28c04SIngo Weinholdcase 1: this and other are uninitialized => 1677ce28c04SIngo Weinhold should return true. 1687ce28c04SIngo Weinholdcase 2: this is initialized, other is uninitialized, and vice versa => 1697ce28c04SIngo Weinhold should return false. 1707ce28c04SIngo Weinholdcase 3: this and other are initialized, different cases: 1717ce28c04SIngo Weinhold - same object => true 1727ce28c04SIngo Weinhold - different objects same target => true 1737ce28c04SIngo Weinhold - looper preferred handler vs. same looper but the looper itself as 1747ce28c04SIngo Weinhold handler => false 1757ce28c04SIngo Weinhold - looper preferred handler vs. other looper preferred handler => false 1767ce28c04SIngo Weinhold - looper preferred handler vs. other looper specific handler => false 1777ce28c04SIngo Weinhold - local looper vs. remote looper => false 1787ce28c04SIngo Weinhold 1797ce28c04SIngo Weinholdbool operator!=(const BMessenger &a, const BMessenger &b) 1807ce28c04SIngo Weinholdincluded in == cases 1817ce28c04SIngo Weinhold 1827ce28c04SIngo Weinholdbool operator<(const BMessenger &a, const BMessenger &b) 183*014ff001SIngo Weinholdcase 1: set fields of a and b manually => 184*014ff001SIngo Weinhold should return whatever the reference implementation returns. 185*014ff001SIngo Weinhold 186*014ff001SIngo Weinholdstatus_t SendMessage(uint32 command, BHandler *replyTo) const 187*014ff001SIngo Weinholdcase 1: this is uninitialized, replyTo is NULL => 188*014ff001SIngo Weinhold should return B_BAD_PORT_ID. 189*014ff001SIngo Weinholdcase 2: this is uninitialized, replyTo points to a valid handler => 190*014ff001SIngo Weinhold should return B_BAD_PORT_ID. 191*014ff001SIngo Weinholdcase 3: this is initialized to a local target with preferred handler, 192*014ff001SIngo Weinhold replyTo is NULL => 193*014ff001SIngo Weinhold should deliver the message and return B_OK. 194*014ff001SIngo Weinholdcase 4: this is initialized to a local target with preferred handler, 195*014ff001SIngo Weinhold replyTo points to a valid handler => 196*014ff001SIngo Weinhold should deliver the message and return B_OK, a reply should be posted 197*014ff001SIngo Weinhold to the reply handler. 198*014ff001SIngo Weinholdcase 5: this is initialized to a local target with specific handler, 199*014ff001SIngo Weinhold replyTo is NULL => 200*014ff001SIngo Weinhold should deliver the message and return B_OK. 201*014ff001SIngo Weinholdcase 6: this is initialized to a local target with specific handler, 202*014ff001SIngo Weinhold replyTo points to a valid handler => 203*014ff001SIngo Weinhold should deliver the message and return B_OK, a reply should be posted 204*014ff001SIngo Weinhold to the reply handler. 205*014ff001SIngo WeinholdTODO: remote targets... 206*014ff001SIngo Weinhold 207*014ff001SIngo Weinholdstatus_t SendMessage(BMessage *message, BHandler *replyTo, 208*014ff001SIngo Weinhold bigtime_t timeout) const 209*014ff001SIngo Weinholdcase 1: message is NULL, replyTo is NULL, timeout is B_INFINITE_TIMEOUT => 210*014ff001SIngo Weinhold should return B_BAD_VALUE. 211*014ff001SIngo Weinholdother cases similar to those of SendMessage(uint32, BHandler *). Each one with 212*014ff001SIngo Weinholda timeout of B_INFINITE_TIMEOUT, 0 and some ms. For the last two 213*014ff001SIngo Weinholdtimeouts in failure cases B_WOULD_BLOCK/B_TIMED_OUT should be returned. 214*014ff001SIngo Weinhold 215*014ff001SIngo Weinholdstatus_t SendMessage(BMessage *message, BMessenger replyTo, 216*014ff001SIngo Weinhold bigtime_t timeout) const 217*014ff001SIngo Weinholdcases similar to those of SendMessage(BMessage *, BHandler *, bigtime_t). 218*014ff001SIngo WeinholdAn invalid replyTo messenger causes the same behavior as a NULL handler. 219*014ff001SIngo Weinhold 220*014ff001SIngo Weinholdstatus_t SendMessage(uint32 command, BMessage *reply) const 221*014ff001SIngo Weinholdcase 1: this is uninitialized, reply is NULL => 222*014ff001SIngo Weinhold should return B_BAD_PORT_ID or B_BAD_VALUE. 223*014ff001SIngo Weinholdcase 2: this is uninitialized, replyTo points to a valid message => 224*014ff001SIngo Weinhold should return B_BAD_PORT_ID. 225*014ff001SIngo Weinholdcase 3: this is initialized to a local target with preferred handler, 226*014ff001SIngo Weinhold reply is NULL => 227*014ff001SIngo Weinhold should return B_BAD_VALUE. 228*014ff001SIngo Weinholdcase 4: this is initialized to a local target with preferred handler, 229*014ff001SIngo Weinhold reply points to a valid message => 230*014ff001SIngo Weinhold should deliver the message, wait for a reply and return B_OK, 231*014ff001SIngo Weinhold reply should contain the reply. 232*014ff001SIngo Weinhold 233*014ff001SIngo Weinholdstatus_t SendMessage(BMessage *message, BMessage *reply, 234*014ff001SIngo Weinhold bigtime_t deliveryTimeout, 235*014ff001SIngo Weinhold bigtime_t replyTimeout) const 236*014ff001SIngo Weinholdcases similar to those of SendMessage(uint32, BMessage *). deliveryTimeout and 237*014ff001SIngo WeinholdreplyTimeout are B_INFINITE_TIMEOUT, 0 or some ms. In timeout cases 238*014ff001SIngo WeinholdB_WOULD_BLOCK/B_TIMED_OUT should be returned. 239*014ff001SIngo Weinhold 2407ce28c04SIngo Weinhold 241