netprofm: Add a stub implementation of INetworkCostManager.
[wine.git] / dlls / netprofm / tests / list.c
blob453856fa47b616ab8bfd77b25a48e53291262946
1 /*
2 * Copyright 2014 Hans Leidekker for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdio.h>
20 #include "windows.h"
21 #define COBJMACROS
22 #include "initguid.h"
23 #include "objbase.h"
24 #include "netlistmgr.h"
25 #include "wine/test.h"
27 static void test_INetworkListManager( void )
29 INetworkListManager *mgr;
30 INetworkCostManager *cost_mgr;
31 NLM_CONNECTIVITY connectivity;
32 VARIANT_BOOL connected;
33 HRESULT hr;
35 hr = CoCreateInstance( &CLSID_NetworkListManager, NULL, CLSCTX_INPROC_SERVER,
36 &IID_INetworkListManager, (void **)&mgr );
37 if (hr != S_OK)
39 win_skip( "can't create instance of NetworkListManager\n" );
40 return;
43 connectivity = 0xdeadbeef;
44 hr = INetworkListManager_GetConnectivity( mgr, &connectivity );
45 ok( hr == S_OK, "got %08x\n", hr );
46 ok( connectivity != 0xdeadbeef, "unchanged value\n" );
47 trace( "GetConnectivity: %08x\n", connectivity );
49 connected = 0xdead;
50 hr = INetworkListManager_IsConnected( mgr, &connected );
51 ok( hr == S_OK, "got %08x\n", hr );
52 ok( connected == VARIANT_TRUE || connected == VARIANT_FALSE, "expected boolean value\n" );
54 connected = 0xdead;
55 hr = INetworkListManager_IsConnectedToInternet( mgr, &connected );
56 ok( hr == S_OK, "got %08x\n", hr );
57 ok( connected == VARIANT_TRUE || connected == VARIANT_FALSE, "expected boolean value\n" );
59 INetworkListManager_QueryInterface( mgr, &IID_INetworkCostManager, (void **)&cost_mgr );
60 ok( hr == S_OK, "got %08x\n", hr );
61 if (hr == S_OK)
63 DWORD cost;
65 hr = INetworkCostManager_GetCost( cost_mgr, NULL, NULL );
66 ok( hr == E_POINTER, "got %08x\n", hr );
68 cost = 0xdeadbeef;
69 hr = INetworkCostManager_GetCost( cost_mgr, &cost, NULL );
70 ok( hr == S_OK, "got %08x\n", hr );
71 ok( cost != 0xdeadbeef, "cost not set\n" );
73 INetworkCostManager_Release( cost_mgr );
76 INetworkListManager_Release( mgr );
79 START_TEST( list )
81 CoInitialize( NULL );
82 test_INetworkListManager();
83 CoUninitialize();