diff options
author | Vic Yang <victoryang@chromium.org> | 2013-06-12 11:10:38 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-06-13 18:13:17 -0700 |
commit | 37597465503b30bbd2565e3f1affe9b683c418ce (patch) | |
tree | c3004e3b0db997a8852ba171dfc43ae5c4610e55 /test | |
parent | 11e7d31dbbed6c18a86188d5515ea66e0f6928d7 (diff) | |
download | chrome-ec-37597465503b30bbd2565e3f1affe9b683c418ce.tar.gz |
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>
Diffstat (limited to 'test')
-rw-r--r-- | test/hooks.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/hooks.c b/test/hooks.c index 26b02d511f..843833917a 100644 --- a/test/hooks.c +++ b/test/hooks.c @@ -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; } |