From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- .../tests/Makefile.in | 2 +- .../tests/connectivity.c | 23 +++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/dlls/windows.networking.connectivity/tests/Makefile.in b/dlls/windows.networking.connectivity/tests/Makefile.in index 351f6ceeafc..58707a80348 100644 --- a/dlls/windows.networking.connectivity/tests/Makefile.in +++ b/dlls/windows.networking.connectivity/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = windows.networking.connectivity.dll -IMPORTS = combase +IMPORTS = combase wininet
SOURCES = \ connectivity.c diff --git a/dlls/windows.networking.connectivity/tests/connectivity.c b/dlls/windows.networking.connectivity/tests/connectivity.c index b49d2ca3a19..7b568685669 100644 --- a/dlls/windows.networking.connectivity/tests/connectivity.c +++ b/dlls/windows.networking.connectivity/tests/connectivity.c @@ -31,6 +31,8 @@ #define WIDL_using_Windows_Networking_Connectivity #include "windows.networking.connectivity.h"
+#include "wininet.h" + #include "wine/test.h"
#define check_interface( obj, iid ) check_interface_( __LINE__, obj, iid ) @@ -48,8 +50,10 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid ) static void test_NetworkInformationStatics(void) { static const WCHAR *network_information_statics_name = L"Windows.Networking.Connectivity.NetworkInformation"; - INetworkInformationStatics *network_information_statics; - IActivationFactory *factory; + INetworkInformationStatics *network_information_statics = (void *)0xdeadbeef; + IConnectionProfile *connection_profile = (void *)0xdeadbeef; + IActivationFactory *factory = (void *)0xdeadbeef; + LPDWORD flags = 0; HSTRING str; HRESULT hr; LONG ref; @@ -73,6 +77,21 @@ static void test_NetworkInformationStatics(void) hr = IActivationFactory_QueryInterface( factory, &IID_INetworkInformationStatics, (void **)&network_information_statics ); ok( hr == S_OK, "got hr %#lx.\n", hr );
+ if (!InternetGetConnectedState( flags, 0 )) + { + hr = INetworkInformationStatics_GetInternetConnectionProfile( network_information_statics, &connection_profile ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( !connection_profile, "expected NULL, got connection_profile %p.\n", connection_profile ); + win_skip( "Internet connection unavailable, skipping tests.\n" ); + goto out; + } + + hr = INetworkInformationStatics_GetInternetConnectionProfile( network_information_statics, &connection_profile ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = IConnectionProfile_Release( connection_profile ); + ok( ref == 0, "got ref %ld.\n", ref ); +out: ref = INetworkInformationStatics_Release( network_information_statics ); ok( ref == 2, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory );