void OpenHome::TestFramework::Runner::Main(TInt aArgc, TChar* aArgv[], InitialisationParams* aInitParams) { OptionParser parser; OptionBool loopback("-l", "--loopback", "Use the loopback adapter only"); parser.AddOption(&loopback); if (!parser.Parse(aArgc, aArgv) || parser.HelpDisplayed()) { return; } if (loopback.Value()) { aInitParams->SetUseLoopbackNetworkAdapter(); } aInitParams->SetMsearchTime(1); aInitParams->SetDvUpnpServerPort(0); UpnpLibrary::Initialise(aInitParams); std::vector<NetworkAdapter*>* subnetList = UpnpLibrary::CreateSubnetList(); TIpAddress subnet = (*subnetList)[0]->Subnet(); UpnpLibrary::DestroySubnetList(subnetList); UpnpLibrary::StartCombined(subnet); //Debug::SetLevel(Debug::kEvent | Debug::kDvEvent); Print("TestDvDeviceStd - starting\n"); Semaphore* sem = new Semaphore("SEM1", 0); DeviceBasic* device = new DeviceBasic(DeviceBasic::eProtocolUpnp); CpDevices* deviceList = new CpDevices(device->Device().Udn(), *sem); FunctorCpDeviceCpp added = MakeFunctorCpDeviceCpp(*deviceList, &CpDevices::Added); FunctorCpDeviceCpp removed = MakeFunctorCpDeviceCpp(*deviceList, &CpDevices::Removed); std::string domainName("openhome.org"); std::string serviceType("TestBasic"); TUint ver = 1; CpDeviceListCppUpnpServiceType* list = new CpDeviceListCppUpnpServiceType(domainName, serviceType, ver, added, removed); sem->Wait(30*1000); // allow up to 30s to find our one device try { deviceList->TestActions(); Functor cb = MakeFunctor(sem, &DeviceDisabled); device->Device().SetDisabled(cb); sem->Wait(); deviceList->TestThrows(); device->Device().SetEnabled(); deviceList->TestSubscriptions(); } catch (Exception& e) { Print("Exception %s from %s:%u\n", e.Message(), e.File(), e.Line()); ASSERTS(); } delete sem; delete list; delete deviceList; delete device; Print("TestDvDeviceStd - completed\n"); UpnpLibrary::Close(); }
void TestCpDeviceDv(CpStack& aCpStack, DvStack& aDvStack) { Print("TestCpDeviceDv - starting\n"); DeviceBasic* device = new DeviceBasic(aDvStack); CpDeviceDv* cpDevice = CpDeviceDv::New(aCpStack, device->Device()); TestInvocation(*cpDevice); TestSubscription(*cpDevice); cpDevice->RemoveRef(); delete device; Print("TestCpDeviceDv - completed\n"); }
void OpenHome::TestFramework::Runner::Main(TInt /*aArgc*/, TChar* /*aArgv*/[], InitialisationParams* aInitParams) { aInitParams->SetUseLoopbackNetworkInterface(); UpnpLibrary::Initialise(aInitParams); UpnpLibrary::StartCombined(); Print("TestCpDeviceDv - starting\n"); DeviceBasic* device = new DeviceBasic; CpDeviceDv* cpDevice = CpDeviceDv::New(device->Device()); TestInvocation(*cpDevice); TestSubscription(*cpDevice); cpDevice->RemoveRef(); delete device; Print("TestCpDeviceDv - completed\n"); UpnpLibrary::Close(); }