Turn providers into plugins courtesy of libpeas
This is an initial, static implementation of plugins. The CallsApplication has a plugin name which can be changed with a new --provider command line option. This plugin name is used to instantiate the appropriate plugin when the application is activated. From then on, the plugin cannot change. In future, we can expand this support to include loading multiple plugins at once, configurable through some UI. This will have far-reaching implications though, and complicate things like enumerating the provider hierarchy. There is also no practical benefit right now; the mm and ofono plugins can't be used at the same time because ModemManager and oFono don't play nice together, and the whole raison d'être of the dummy plugin is undermined if you can make use of one of the others. So for now, we just implement one static plugin.
This commit is contained in:
@@ -11,6 +11,7 @@ test_env = [
|
||||
|
||||
test_cflags = [
|
||||
'-fPIE',
|
||||
'-DFOR_TESTING'
|
||||
]
|
||||
|
||||
test_link_args = [
|
||||
@@ -38,13 +39,16 @@ foreach test : tests
|
||||
'common.h' ]
|
||||
|
||||
t = executable(name, test_sources,
|
||||
calls_sources, calls_dummy_sources, calls_enum_sources, calls_resources,
|
||||
calls_sources, dummy_sources, calls_enum_sources, calls_resources,
|
||||
c_args : test_cflags,
|
||||
link_args: test_link_args,
|
||||
link_with : gdbofono_lib,
|
||||
dependencies: calls_deps,
|
||||
include_directories : include_directories('..',
|
||||
join_paths('..', 'src')),
|
||||
include_directories : [
|
||||
top_include,
|
||||
src_include,
|
||||
dummy_include
|
||||
]
|
||||
)
|
||||
test(name, t, env: test_env)
|
||||
endforeach
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "setup-provider.h"
|
||||
#include "calls-dummy-origin.h"
|
||||
|
||||
#define TEST_ORIGIN_NAME "Test origin"
|
||||
#define TEST_ORIGIN_NAME "Dummy origin"
|
||||
|
||||
#define TEST_CALL_NUMBER "0123456789"
|
||||
|
||||
|
||||
@@ -43,14 +43,9 @@ test_dummy_provider_origins (ProviderFixture *fixture,
|
||||
{
|
||||
GList *origins;
|
||||
|
||||
calls_dummy_provider_add_origin (fixture->dummy_provider,
|
||||
"Test origin 1");
|
||||
calls_dummy_provider_add_origin (fixture->dummy_provider,
|
||||
"Test origin 2");
|
||||
|
||||
origins = calls_provider_get_origins
|
||||
(CALLS_PROVIDER (fixture->dummy_provider));
|
||||
g_assert_cmpuint (g_list_length (origins), ==, 2);
|
||||
g_assert_cmpuint (g_list_length (origins), ==, 1);
|
||||
g_list_free (origins);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user