vikramranabhatt
unread,Dec 27, 2011, 12:18:40 PM12/27/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google C++ Testing Framework, vikramr...@gmail.com
I have C++ Library which expose Asynchronous Api.Here I am enumerating
the Device list and the callback is called up in every 400 ms.user can
set Interval here.But the callback never get called.I am not using any
thread in my static library.bool m_bIsDiscovered is supposed to be
updated by the Callback.But callback never get called.
IDeviceEnumerationCallback
{
virtual void onWiFiDeviceDiscovered( WiFiDeviceInfo*
pDeviceInfo,unsigned short nNoOfDevice) = 0;
};
class IDeviceDiscovery
{
virtual int
InitialiseDeviceDiscovery(IWifiCameraEnumerationCallback*) = 0;
virtual int EnumerateDevice() = 0;
virtual void UnInitialiseDiscovery() = 0;
};
Unit Test
I have Developed a class which implements the Callback Interface
and
class CEnumDevTst:IDeviceEnumerationCallback
{
// implemented the Callback
bool m_bIsDeviceDiscovered;
}
class CUEnumDevTst: public testing::Test
{
}
void CUEnumDevTst::SetUp()
{
m_CEnumDevTst = new CEnumDevTst();
}
void CUEnumDevTst::TearDown()
{
if (NULL != m_CEnumDevTst)
{
delete CEnumDevTst;
m_CEnumDevTst = NULL;
}
}
TEST_F(CUEnumWifiDevTst,WiFiDisc_Callback)
{
ASSERT_TRUE( NULL != m_CEnumDevTst );
int nret = m_CEnumDevTst ->EnumWiFiDevice();
Sleep(400);
EXPECT_TRUE(true == m_CEnumDevTst ->IsDeviceDiscovered());
}
};
Here I awaiting for callback for 400 ms but the callback never get
called.