[unit] Test for gbinder_idle_callback_invoke_later(). JB#53719
This commit is contained in:
parent
b60960d955
commit
a6a5df963f
|
@ -1,4 +1,3 @@
|
|||
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script requires lcov, dirname
|
||||
|
@ -65,9 +64,13 @@ for t in $TESTS ; do
|
|||
popd
|
||||
done
|
||||
|
||||
# Sometimes you need this, sometimes that :S
|
||||
BASE_DIR="$TOP_DIR"
|
||||
#BASE_DIR="$TOP_DIR/src"
|
||||
|
||||
FULL_COV="$COV_DIR/full.gcov"
|
||||
LIB_COV="$COV_DIR/lib.gcov"
|
||||
rm -f "$FULL_COV" "$LIB_COV"
|
||||
lcov $LCOV_OPT -c -d "$TOP_DIR/build/coverage" -b "$TOP_DIR/src" -o "$FULL_COV" || exit 1
|
||||
lcov $LCOV_OPT -e "$FULL_COV" "$TOP_DIR/src/*" -o "$LIB_COV" || exit 1
|
||||
lcov $LCOV_OPT -c -d "$TOP_DIR/build/coverage" -b "$BASE_DIR" -o "$FULL_COV" || exit 1
|
||||
lcov $LCOV_OPT -e "$FULL_COV" "$BASE_DIR/*" -o "$LIB_COV" || exit 1
|
||||
genhtml $GENHTML_OPT "$LIB_COV" -t "libgbinder" --output-directory "$COV_DIR/report" || exit 1
|
||||
|
|
|
@ -48,6 +48,14 @@ test_unreached_proc(
|
|||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
test_quit_cb(
|
||||
gpointer data)
|
||||
{
|
||||
g_main_loop_quit((GMainLoop*)data);
|
||||
}
|
||||
|
||||
/*==========================================================================*
|
||||
* Test event loop integration
|
||||
*==========================================================================*/
|
||||
|
@ -212,14 +220,6 @@ test_timeout(
|
|||
* callback
|
||||
*==========================================================================*/
|
||||
|
||||
static
|
||||
void
|
||||
test_quit_cb(
|
||||
gpointer data)
|
||||
{
|
||||
g_main_loop_quit((GMainLoop*)data);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
test_callback(
|
||||
|
@ -238,6 +238,28 @@ test_callback(
|
|||
g_main_loop_unref(loop);
|
||||
}
|
||||
|
||||
/*==========================================================================*
|
||||
* invoke
|
||||
*==========================================================================*/
|
||||
|
||||
static
|
||||
void
|
||||
test_invoke(
|
||||
void)
|
||||
{
|
||||
GMainLoop* loop = g_main_loop_new(NULL, FALSE);
|
||||
|
||||
gbinder_eventloop_set(NULL);
|
||||
gbinder_idle_callback_invoke_later(test_quit_cb, loop, NULL);
|
||||
test_run(&test_opt, loop);
|
||||
|
||||
gbinder_eventloop_set(NULL);
|
||||
gbinder_idle_callback_invoke_later(NULL, loop, test_quit_cb);
|
||||
test_run(&test_opt, loop);
|
||||
|
||||
g_main_loop_unref(loop);
|
||||
}
|
||||
|
||||
/*==========================================================================*
|
||||
* Common
|
||||
*==========================================================================*/
|
||||
|
@ -251,6 +273,7 @@ int main(int argc, char* argv[])
|
|||
g_test_add_func(TEST_("idle"), test_idle);
|
||||
g_test_add_func(TEST_("timeout"), test_timeout);
|
||||
g_test_add_func(TEST_("callback"), test_callback);
|
||||
g_test_add_func(TEST_("invoke"), test_invoke);
|
||||
test_init(&test_opt, argc, argv);
|
||||
return g_test_run();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue