Changeset 36993 in vbox for trunk/src/VBox/Main/include
- Timestamp:
- May 6, 2011 9:53:21 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 71604
- Location:
- trunk/src/VBox/Main/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/USBGetDevices.h
r36958 r36993 84 84 bool fIsDeviceNodes); 85 85 86 #ifdef UNIT_TEST 87 /** 88 * Specify the list of devices that will appear to be available through 89 * usbfs during unit testing (of USBProxyLinuxGetDevices) 90 * @param pacszDeviceAddresses NULL terminated array of usbfs device addresses 91 */ 92 extern void TestUSBSetAvailableUsbfsDevices(const char **pacszDeviceAddresses); 93 /** 94 * Specify the list of files that access will report as accessible (at present 95 * we only do accessible or not accessible) during unit testing (of 96 * USBProxyLinuxGetDevices) 97 * @param pacszAccessibleFiles NULL terminated array of file paths to be 98 * reported accessible 99 */ 100 extern void TestUSBSetAccessibleFiles(const char **pacszAccessibleFiles); 101 #endif 102 86 103 /** 87 104 * Get the list of USB devices supported by the system. Should be freed using -
trunk/src/VBox/Main/include/USBProxyService.h
r36418 r36993 211 211 virtual int releaseDevice(HostUSBDevice *aDevice); 212 212 213 protected: 214 #ifdef TESTCASE 215 virtual 216 #endif 213 # ifdef UNIT_TEST 214 /* Functions for setting our unit test mock functions. Not quite sure if 215 * it is good form to mix test and production code like this, but it seems 216 * cleaner to me than tying the unit test to implementation details of the 217 * class. */ 218 /** Select which access methods will be available to the @a init method 219 * during unit testing, and (hack!) what return code it will see from 220 * the access method-specific initialisation. */ 221 void testSetupInit(const char *pcszUsbfsRoot, bool fUsbfsAccessible, 222 const char *pcszDevicesRoot, bool fDevicesAccessible, 223 int rcMethodInitResult) 224 { 225 mpcszTestUsbfsRoot = pcszUsbfsRoot; 226 mfTestUsbfsAccessible = fUsbfsAccessible; 227 mpcszTestDevicesRoot = pcszDevicesRoot; 228 mfTestDevicesAccessible = fDevicesAccessible; 229 mrcTestMethodInitResult = rcMethodInitResult; 230 } 231 /** Specify the environment that the @a init method will see during unit 232 * testing. */ 233 void testSetEnv(const char *pcszEnvUsb, const char *pcszEnvUsbRoot) 234 { 235 mpcszTestEnvUsb = pcszEnvUsb; 236 mpcszTestEnvUsbRoot = pcszEnvUsbRoot; 237 } 238 bool testGetUsingUsbfs(void) { return mUsingUsbfsDevices; } 239 const char *testGetDevicesRoot(void) { return mDevicesRoot.c_str(); } 240 # endif 241 242 protected: 217 243 int initUsbfs(void); 218 #ifdef TESTCASE219 virtual220 #endif221 244 int initSysfs(void); 222 245 void doUsbfsCleanupAsNeeded(void); … … 248 271 VBoxMainHotplugWaiter *mpWaiter; 249 272 # endif 273 # ifdef UNIT_TEST 274 /** The path we pretend the usbfs root is located at, or NULL. */ 275 const char *mpcszTestUsbfsRoot; 276 /** Should usbfs be accessible to the current user? */ 277 bool mfTestUsbfsAccessible; 278 /** The path we pretend the device node tree root is located at, or NULL. */ 279 const char *mpcszTestDevicesRoot; 280 /** Should the device node tree be accessible to the current user? */ 281 bool mfTestDevicesAccessible; 282 /** The result of the usbfs/inotify-specific init */ 283 int mrcTestMethodInitResult; 284 /** The value of the VBOX_USB environment variable. */ 285 const char *mpcszTestEnvUsb; 286 /** The value of the VBOX_USB_ROOT environment variable. */ 287 const char *mpcszTestEnvUsbRoot; 288 # endif 250 289 }; 251 290 # endif /* RT_OS_LINUX */
Note:
See TracChangeset
for help on using the changeset viewer.