Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wireplumber
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
wireplumber
Commits
444814d7
Commit
444814d7
authored
4 years ago
by
George Kiagiadakis
Browse files
Options
Downloads
Patches
Plain Diff
tests: common: add common callbacks based on the si-simple-node-endpoint test
parent
1c74a83a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/common/base-test-fixture.h
+36
-0
36 additions, 0 deletions
tests/common/base-test-fixture.h
tests/modules/si-simple-node-endpoint.c
+8
-39
8 additions, 39 deletions
tests/modules/si-simple-node-endpoint.c
with
44 additions
and
39 deletions
tests/common/base-test-fixture.h
+
36
−
0
View file @
444814d7
...
@@ -107,3 +107,39 @@ wp_base_test_fixture_teardown (WpBaseTestFixture * self)
...
@@ -107,3 +107,39 @@ wp_base_test_fixture_teardown (WpBaseTestFixture * self)
g_clear_pointer
(
&
self
->
context
,
g_main_context_unref
);
g_clear_pointer
(
&
self
->
context
,
g_main_context_unref
);
wp_test_server_teardown
(
&
self
->
server
);
wp_test_server_teardown
(
&
self
->
server
);
}
}
static
G_GNUC_UNUSED
void
test_proxy_augment_finish_cb
(
WpProxy
*
proxy
,
GAsyncResult
*
res
,
WpBaseTestFixture
*
f
)
{
g_autoptr
(
GError
)
error
=
NULL
;
gboolean
augment_ret
=
wp_proxy_augment_finish
(
proxy
,
res
,
&
error
);
g_assert_no_error
(
error
);
g_assert_true
(
augment_ret
);
g_main_loop_quit
(
f
->
loop
);
}
static
G_GNUC_UNUSED
void
test_si_activate_finish_cb
(
WpSessionItem
*
item
,
GAsyncResult
*
res
,
WpBaseTestFixture
*
f
)
{
g_autoptr
(
GError
)
error
=
NULL
;
gboolean
activate_ret
=
wp_session_item_activate_finish
(
item
,
res
,
&
error
);
g_assert_no_error
(
error
);
g_assert_true
(
activate_ret
);
g_main_loop_quit
(
f
->
loop
);
}
static
G_GNUC_UNUSED
void
test_si_export_finish_cb
(
WpSessionItem
*
item
,
GAsyncResult
*
res
,
WpBaseTestFixture
*
f
)
{
g_autoptr
(
GError
)
error
=
NULL
;
gboolean
export_ret
=
wp_session_item_export_finish
(
item
,
res
,
&
error
);
g_assert_no_error
(
error
);
g_assert_true
(
export_ret
);
g_main_loop_quit
(
f
->
loop
);
}
This diff is collapsed.
Click to expand it.
tests/modules/si-simple-node-endpoint.c
+
8
−
39
View file @
444814d7
...
@@ -52,39 +52,6 @@ test_si_simple_node_endpoint_teardown (TestFixture * f, gconstpointer user_data)
...
@@ -52,39 +52,6 @@ test_si_simple_node_endpoint_teardown (TestFixture * f, gconstpointer user_data)
wp_base_test_fixture_teardown
(
&
f
->
base
);
wp_base_test_fixture_teardown
(
&
f
->
base
);
}
}
static
void
on_proxy_augmented
(
WpProxy
*
proxy
,
GAsyncResult
*
res
,
TestFixture
*
f
)
{
g_autoptr
(
GError
)
error
=
NULL
;
gboolean
augment_ret
=
wp_proxy_augment_finish
(
proxy
,
res
,
&
error
);
g_assert_no_error
(
error
);
g_assert_true
(
augment_ret
);
g_main_loop_quit
(
f
->
base
.
loop
);
}
static
void
on_item_activated
(
WpSessionItem
*
item
,
GAsyncResult
*
res
,
TestFixture
*
f
)
{
g_autoptr
(
GError
)
error
=
NULL
;
gboolean
activate_ret
=
wp_session_item_activate_finish
(
item
,
res
,
&
error
);
g_assert_no_error
(
error
);
g_assert_true
(
activate_ret
);
g_main_loop_quit
(
f
->
base
.
loop
);
}
static
void
on_item_exported
(
WpSessionItem
*
item
,
GAsyncResult
*
res
,
TestFixture
*
f
)
{
g_autoptr
(
GError
)
error
=
NULL
;
gboolean
export_ret
=
wp_session_item_export_finish
(
item
,
res
,
&
error
);
g_assert_no_error
(
error
);
g_assert_true
(
export_ret
);
g_main_loop_quit
(
f
->
base
.
loop
);
}
static
void
static
void
test_si_simple_node_endpoint_configure_activate
(
TestFixture
*
f
,
test_si_simple_node_endpoint_configure_activate
(
TestFixture
*
f
,
gconstpointer
user_data
)
gconstpointer
user_data
)
...
@@ -111,7 +78,7 @@ test_si_simple_node_endpoint_configure_activate (TestFixture * f,
...
@@ -111,7 +78,7 @@ test_si_simple_node_endpoint_configure_activate (TestFixture * f,
g_assert_nonnull
(
node
);
g_assert_nonnull
(
node
);
wp_proxy_augment
(
WP_PROXY
(
node
),
WP_PROXY_FEATURES_STANDARD
,
NULL
,
wp_proxy_augment
(
WP_PROXY
(
node
),
WP_PROXY_FEATURES_STANDARD
,
NULL
,
(
GAsyncReadyCallback
)
on
_proxy_augment
ed
,
f
);
(
GAsyncReadyCallback
)
test
_proxy_augment
_finish_cb
,
f
);
g_main_loop_run
(
f
->
base
.
loop
);
g_main_loop_run
(
f
->
base
.
loop
);
/* configure */
/* configure */
...
@@ -155,7 +122,8 @@ test_si_simple_node_endpoint_configure_activate (TestFixture * f,
...
@@ -155,7 +122,8 @@ test_si_simple_node_endpoint_configure_activate (TestFixture * f,
/* activate */
/* activate */
wp_session_item_activate
(
item
,
(
GAsyncReadyCallback
)
on_item_activated
,
f
);
wp_session_item_activate
(
item
,
(
GAsyncReadyCallback
)
test_si_activate_finish_cb
,
f
);
g_main_loop_run
(
f
->
base
.
loop
);
g_main_loop_run
(
f
->
base
.
loop
);
g_assert_cmphex
(
wp_session_item_get_flags
(
item
),
==
,
g_assert_cmphex
(
wp_session_item_get_flags
(
item
),
==
,
...
@@ -295,7 +263,7 @@ test_si_simple_node_endpoint_export (TestFixture * f, gconstpointer user_data)
...
@@ -295,7 +263,7 @@ test_si_simple_node_endpoint_export (TestFixture * f, gconstpointer user_data)
g_assert_nonnull
(
node
);
g_assert_nonnull
(
node
);
wp_proxy_augment
(
WP_PROXY
(
node
),
WP_PROXY_FEATURES_STANDARD
,
NULL
,
wp_proxy_augment
(
WP_PROXY
(
node
),
WP_PROXY_FEATURES_STANDARD
,
NULL
,
(
GAsyncReadyCallback
)
on
_proxy_augment
ed
,
f
);
(
GAsyncReadyCallback
)
test
_proxy_augment
_finish_cb
,
f
);
g_main_loop_run
(
f
->
base
.
loop
);
g_main_loop_run
(
f
->
base
.
loop
);
/* configure */
/* configure */
...
@@ -317,7 +285,8 @@ test_si_simple_node_endpoint_export (TestFixture * f, gconstpointer user_data)
...
@@ -317,7 +285,8 @@ test_si_simple_node_endpoint_export (TestFixture * f, gconstpointer user_data)
/* activate */
/* activate */
wp_session_item_activate
(
item
,
(
GAsyncReadyCallback
)
on_item_activated
,
f
);
wp_session_item_activate
(
item
,
(
GAsyncReadyCallback
)
test_si_activate_finish_cb
,
f
);
g_main_loop_run
(
f
->
base
.
loop
);
g_main_loop_run
(
f
->
base
.
loop
);
g_assert_cmpint
(
g_assert_cmpint
(
...
@@ -331,13 +300,13 @@ test_si_simple_node_endpoint_export (TestFixture * f, gconstpointer user_data)
...
@@ -331,13 +300,13 @@ test_si_simple_node_endpoint_export (TestFixture * f, gconstpointer user_data)
g_assert_nonnull
(
session
);
g_assert_nonnull
(
session
);
wp_proxy_augment
(
WP_PROXY
(
session
),
WP_SESSION_FEATURES_STANDARD
,
NULL
,
wp_proxy_augment
(
WP_PROXY
(
session
),
WP_SESSION_FEATURES_STANDARD
,
NULL
,
(
GAsyncReadyCallback
)
on
_proxy_augment
ed
,
f
);
(
GAsyncReadyCallback
)
test
_proxy_augment
_finish_cb
,
f
);
g_main_loop_run
(
f
->
base
.
loop
);
g_main_loop_run
(
f
->
base
.
loop
);
/* export */
/* export */
wp_session_item_export
(
item
,
session
,
wp_session_item_export
(
item
,
session
,
(
GAsyncReadyCallback
)
on_item_exported
,
f
);
(
GAsyncReadyCallback
)
test_si_export_finish_cb
,
f
);
g_main_loop_run
(
f
->
base
.
loop
);
g_main_loop_run
(
f
->
base
.
loop
);
g_assert_cmphex
(
wp_session_item_get_flags
(
item
),
==
,
g_assert_cmphex
(
wp_session_item_get_flags
(
item
),
==
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment