vfs: check userland buffers before reading them.
[haiku.git] / src / tests / kits / app / bhandler / UnlockLooperTest.cpp
blob08090b149356052e1209a05e738da64cceb00f64
1 //------------------------------------------------------------------------------
2 // UnlockLooperTest.cpp
3 //
4 //------------------------------------------------------------------------------
6 // Standard Includes -----------------------------------------------------------
8 // System Includes -------------------------------------------------------------
9 #include <Looper.h>
11 // Project Includes ------------------------------------------------------------
13 // Local Includes --------------------------------------------------------------
14 #include "UnlockLooperTest.h"
16 // Local Defines ---------------------------------------------------------------
18 // Globals ---------------------------------------------------------------------
20 //------------------------------------------------------------------------------
21 /**
22 UnlockLooper()
23 @case handler has no looper
24 @results NONE
25 @note Original implementation apparently doesn't check to see if a
26 looper actually exists before trying to call Unlock() on it.
27 Disabled for TEST_R5.
29 void TUnlockLooperTest::UnlockLooper1()
31 #if !defined(TEST_R5)
32 BHandler Handler;
33 Handler.UnlockLooper();
34 #endif
36 //------------------------------------------------------------------------------
37 /**
38 UnlockLooper()
39 @case handler has a looper which is initially unlocked
40 @results debug message "looper must be locked before proceeding" from
41 BLooper::AssertLock()
43 void TUnlockLooperTest::UnlockLooper2()
45 DEBUGGER_ESCAPE;
47 BLooper Looper;
48 BHandler Handler;
49 Looper.AddHandler(&Handler);
50 if (Looper.IsLocked())
52 // Make sure the looper is unlocked
53 Looper.Unlock();
55 Handler.UnlockLooper();
57 //------------------------------------------------------------------------------
58 /**
59 UnlockLooper()
60 @case handler has a looper which is initially locked
61 @results NONE
63 void TUnlockLooperTest::UnlockLooper3()
65 BLooper Looper;
66 BHandler Handler;
67 Looper.AddHandler(&Handler);
68 if (!Looper.IsLocked())
70 Looper.Lock();
72 Handler.UnlockLooper();
74 //------------------------------------------------------------------------------
75 Test* TUnlockLooperTest::Suite()
77 TestSuite* SuiteOfTests = new TestSuite("BHandler::UnlockLooper");
79 ADD_TEST4(BHandler, SuiteOfTests, TUnlockLooperTest, UnlockLooper1);
80 ADD_TEST4(BHandler, SuiteOfTests, TUnlockLooperTest, UnlockLooper2);
81 ADD_TEST4(BHandler, SuiteOfTests, TUnlockLooperTest, UnlockLooper3);
83 return SuiteOfTests;
85 //------------------------------------------------------------------------------
88 * $Log $
90 * $Id $