MCPcopy Create free account
hub / github.com/CppMicroServices/CppMicroServices / TEST

Function TEST

framework/test/gtest/ServiceTrackerTest.cpp:691–710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689#ifdef US_ENABLE_THREADING_SUPPORT
690
691TEST(ServiceTrackerTests, TestServiceTrackerDeadlock)
692{
693 Framework framework = FrameworkFactory().NewFramework();
694 framework.Start();
695
696 ServiceTracker<MyInterfaceOne> tracker(framework.GetBundleContext());
697 tracker.Open();
698 auto f = std::async(
699 [&framework]
700 {
701 // technically there's a race here, so the async should ensure WaitForService is started prior to
702 // terminating the framework.
703 std::this_thread::sleep_for(std::chrono::seconds(1));
704
705 framework.Stop();
706 framework.WaitForStop(std::chrono::milliseconds::zero());
707 });
708
709 ASSERT_THROW(tracker.WaitForService(), std::logic_error);
710}
711
712TEST(ServiceTrackerTests, TestServiceTrackerInvalidBundle)
713{

Callers

nothing calls this directly

Calls 8

NewFrameworkMethod · 0.80
WaitForServiceMethod · 0.80
StartMethod · 0.45
GetBundleContextMethod · 0.45
OpenMethod · 0.45
StopMethod · 0.45
WaitForStopMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected