Unload libA and check for correct events
| 209 | |
| 210 | // Unload libA and check for correct events |
| 211 | void frame030b(ModuleContext* mc, TestModuleListener& listener, SharedLibrary& libA) |
| 212 | { |
| 213 | Module* moduleA = ModuleRegistry::GetModule("TestModuleA"); |
| 214 | US_TEST_CONDITION_REQUIRED(moduleA != nullptr, "Test for non-null module") |
| 215 | |
| 216 | ServiceReferenceU sr1 |
| 217 | = mc->GetServiceReference("us::TestModuleAService"); |
| 218 | US_TEST_CONDITION(sr1, "Test for valid service reference") |
| 219 | |
| 220 | try |
| 221 | { |
| 222 | libA.Unload(); |
| 223 | US_TEST_CONDITION(moduleA->IsLoaded() == false, "Test for unloaded state") |
| 224 | } |
| 225 | catch (const std::exception& e) |
| 226 | { |
| 227 | US_TEST_FAILED_MSG(<< "UnLoad module exception: " << e.what()) |
| 228 | } |
| 229 | |
| 230 | std::vector<ModuleEvent> pEvts; |
| 231 | pEvts.push_back(ModuleEvent(ModuleEvent::UNLOADING, moduleA)); |
| 232 | pEvts.push_back(ModuleEvent(ModuleEvent::UNLOADED, moduleA)); |
| 233 | |
| 234 | std::vector<ServiceEvent> seEvts; |
| 235 | seEvts.push_back(ServiceEvent(ServiceEvent::UNREGISTERING, sr1)); |
| 236 | |
| 237 | US_TEST_CONDITION(listener.CheckListenerEvents(pEvts, seEvts), "Test for unexpected events"); |
| 238 | } |
| 239 | |
| 240 | |
| 241 | struct LocalListener { |
no test coverage detected