- Timestamp:
- Mar 13, 2014, 7:30:17 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/SystemQueue-tests.cc
r12762 r12763 92 92 void Check() 93 93 { 94 // XXX95 94 cout << "### Check ### "<< endl; 96 95 97 96 checkmark = true; 98 97 } 99 98 99 void Cancel() 100 { 101 cout << "### Cancel ### "<< endl; 102 103 SystemQueue::instance().cancel(); 104 checkmark = true; 105 } 106 100 107 void LongRunner() 101 108 { … … 163 170 164 171 /** 172 * Enqueues an event but then cancels the SystemQueue without running 173 */ 174 TEST_F(SystemQueueTest, EmptyAfterCancel) 175 { 176 SystemQueue& sysq = SystemQueue::instance(); 177 178 EXPECT_TRUE( sysq.isEmpty() ); 179 180 // enqueue event 181 sysq.scheduleCall( 182 boost::bind(&SystemQueueTest::Check, this) 183 ); 184 185 EXPECT_FALSE( sysq.isEmpty() ); 186 187 // cancel 188 sysq.cancel(); 189 190 EXPECT_TRUE( sysq.isEmpty() ); 191 } 192 193 194 /** 195 * cancels the SystemQueue from inside a scheduled event 196 */ 197 TEST_F(SystemQueueTest, CancelFromInsideEvent) 198 { 199 SystemQueue& sysq = SystemQueue::instance(); 200 checkmark = false; // just to be sure.. 201 202 // start 203 sysq.run(); 204 205 // scheduleCall 206 sysq.scheduleCall( 207 boost::bind(&SystemQueueTest::Cancel, this) 208 ); 209 210 // wait for the event to happen 211 wait_for_checkmark(MAX_WAIT); 212 213 EXPECT_FALSE( sysq.isRunning() ) << "SystemQueue has not stopped properly."; 214 EXPECT_TRUE( sysq.isEmpty() ) << "SystemQueue has not stopped properly."; 215 } 216 217 218 /** 165 219 * schedule a call and test whether it is actually performed by the SystemQueue 166 220 */
Note:
See TracChangeset
for help on using the changeset viewer.