VirtualBox

Changeset 47273 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jul 19, 2013 5:39:38 PM (11 years ago)
Author:
vboxsync
Message:

Main/testcase: eliminated fundamentally broken use of Assert, and made it work on COM (with major trickery)

Location:
trunk/src/VBox/Main/testcase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/testcase/Makefile.kmk

    r47266 r47273  
    227227        $(dir $(VBOX_XML_SCHEMADEFS_H))
    228228tstMouseImpl_LIBS      = $(PATH_STAGE_LIB)/VBoxAPIWrap$(VBOX_SUFF_LIB)
     229# Super ugly hack to make the code work well enough without having ATL/COM
     230# completely initialized, without it there are crashes caused by ComObjPtr
     231# and many other pieces of glue code, as the inproc code path is more picky.
     232tstMouseImpl_DEFS.win  += VBOX_COM_OUTOFPROC_MODULE
    229233
    230234
  • trunk/src/VBox/Main/testcase/tstMouseImpl.cpp

    r47261 r47273  
    55
    66/*
    7  * Copyright (C) 2011 Oracle Corporation
     7 * Copyright (C) 2011-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    138138static struct PDMDRVINS *ppdmdrvIns = NULL;
    139139
    140 Mouse *pMouse;
    141 ConsoleMouseInterface *pConsole;
     140ComObjPtr<Mouse> pMouse;
     141ConsoleMouseInterface *pConsole = NULL;
    142142
    143143static struct
     
    204204    VMMDevPort.pfnSetAbsoluteMouse = setAbsoluteMouse;
    205205    VMMDevPort.pfnUpdateMouseCapabilities = updateMouseCapabilities;
    206     pMouse = new Mouse;
    207     Assert(SUCCEEDED(pMouse->FinalConstruct()));
     206    HRESULT hrc = pMouse.createInstance();
     207    AssertComRC(hrc);
     208    if (FAILED(hrc))
     209        return VERR_GENERAL_FAILURE;
    208210    pConsole = new TestConsole;
    209211    pMouse->init(pConsole);
     
    217219static void teardown(void)
    218220{
    219     delete pMouse;
    220     delete pConsole;
    221     RTMemFree(ppdmdrvIns);
     221    pMouse.setNull();
     222    if (pConsole)
     223        delete pConsole;
     224    if (ppdmdrvIns)
     225        RTMemFree(ppdmdrvIns);
    222226}
    223227
     
    351355    for (unsigned i = 0; g_tests[i]; ++i)
    352356    {
    353         AssertRC(setup());
    354         g_tests[i](hTest);
     357        int rc = setup();
     358        AssertRC(rc);
     359        if (RT_SUCCESS(rc))
     360            g_tests[i](hTest);
    355361        teardown();
    356362    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette