Changeset 16198 in vbox for trunk/src/VBox/Main/testcase
- Timestamp:
- Jan 23, 2009 12:46:45 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 41968
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/testcase/tstAPI.cpp
r16188 r16198 1127 1127 #endif 1128 1128 1129 #if 0 1130 do { 1131 // Get host 1132 ComPtr <IHost> host; 1133 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host) (host.asOutParam())); 1134 1135 ULONG uMemSize, uMemAvail; 1136 CHECK_ERROR_BREAK (host, COMGETTER(MemorySize) (&uMemSize)); 1137 printf("Total memory (MB): %u\n", uMemSize); 1138 CHECK_ERROR_BREAK (host, COMGETTER(MemoryAvailable) (&uMemAvail)); 1139 printf("Free memory (MB): %u\n", uMemAvail); 1140 } while (0); 1141 #endif 1142 1129 1143 #if 1 1130 1144 do { … … 1133 1147 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host) (host.asOutParam())); 1134 1148 1135 ULONG uMemSize, uMemAvail; 1136 CHECK_ERROR_BREAK (host, COMGETTER(MemorySize) (&uMemSize)); 1137 printf("Total memory (MB): %u\n", uMemSize); 1138 CHECK_ERROR_BREAK (host, COMGETTER(MemoryAvailable) (&uMemAvail)); 1139 printf("Free memory (MB): %u\n", uMemAvail); 1149 com::SafeIfaceArray <IHostNetworkInterface> hostNetworkInterfaces; 1150 CHECK_ERROR_BREAK(host, 1151 COMGETTER(NetworkInterfaces) (ComSafeArrayAsOutParam (hostNetworkInterfaces))); 1152 if (hostNetworkInterfaces.size() > 0) 1153 { 1154 ComPtr<IHostNetworkInterface> networkInterface = hostNetworkInterfaces[0]; 1155 Bstr interfaceName; 1156 networkInterface->COMGETTER(Name)(interfaceName.asOutParam()); 1157 printf("Found %d network interfaces, testing with %lS...\n", hostNetworkInterfaces.size(), interfaceName.raw()); 1158 Guid interfaceGuid; 1159 networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam()); 1160 // Find the interface by its name 1161 networkInterface.setNull(); 1162 CHECK_ERROR_BREAK(host, 1163 FindHostNetworkInterfaceByName (interfaceName, networkInterface.asOutParam())); 1164 Guid interfaceGuid2; 1165 networkInterface->COMGETTER(Id)(interfaceGuid2.asOutParam()); 1166 if (interfaceGuid2 != interfaceGuid) 1167 printf("Failed to retrive an interface by name %lS.\n", interfaceName.raw()); 1168 // Find the interface by its guid 1169 networkInterface.setNull(); 1170 CHECK_ERROR_BREAK(host, 1171 FindHostNetworkInterfaceById (interfaceGuid, networkInterface.asOutParam())); 1172 Bstr interfaceName2; 1173 networkInterface->COMGETTER(Name)(interfaceName2.asOutParam()); 1174 if (interfaceName != interfaceName2) 1175 printf("Failed to retrive an interface by GUID %lS.\n", Bstr(interfaceGuid.toString()).raw()); 1176 } 1177 else 1178 { 1179 printf("No network interfaces found!\n"); 1180 } 1140 1181 } while (0); 1141 1182 #endif … … 1255 1296 } while (false); 1256 1297 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 1257 #if 11298 #if 0 1258 1299 // check of OVF appliance handling 1259 1300 ///////////////////////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.