More hooks unit test

Checks we cannot call non-registered deferred functions.

BUG=chrome-os-partner:19236
TEST=Pass the test.
BRANCH=None

Change-Id: I6cf67f85c7749632627819cc05e6809c040fb697
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58330
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Vic Yang
2013-06-12 11:10:38 +08:00
committed by ChromeBot
parent 11e7d31dbb
commit 3759746550

View File

@@ -56,6 +56,11 @@ static void deferred_func(void)
}
DECLARE_DEFERRED(deferred_func);
static void non_deferred_func(void)
{
deferred_call_count++;
}
static int test_init(void)
{
TEST_ASSERT(init_hook_count == 1);
@@ -116,6 +121,11 @@ static int test_deferred(void)
usleep(50 * MSEC);
TEST_ASSERT(deferred_call_count == 2);
TEST_ASSERT(hook_call_deferred(non_deferred_func, 50 * MSEC) !=
EC_SUCCESS);
usleep(100 * MSEC);
TEST_ASSERT(deferred_call_count == 2);
return EC_SUCCESS;
}