Revert "Remove polkit tests"

This reverts commit bddc559713.

Changes:
- Removed Makefile
- Removed test for UpWakeups
This commit is contained in:
Kate Hsuan 2024-08-22 20:43:43 +08:00
parent b26c8c79c9
commit f55641cd43
2 changed files with 27 additions and 0 deletions

1
README
View file

@ -8,6 +8,7 @@ Requirements:
gio-2.0 >= 2.16.1
gudev-1.0 >= 235 (Linux)
libimobiledevice-1.0 >= 0.9.7 (optional)
polkit-gobject-1 >= 124
UPower is an abstraction for enumerating power devices,
listening to device events and querying history and statistics.

View file

@ -33,6 +33,7 @@
#include "up-device-list.h"
#include "up-history.h"
#include "up-native.h"
#include "up-polkit.h"
gchar *history_dir = NULL;
@ -64,6 +65,12 @@ up_test_daemon_func (void)
{
UpDaemon *daemon;
/* needs polkit, which only listens to the system bus */
if (!g_file_test (DBUS_SYSTEM_SOCKET, G_FILE_TEST_EXISTS)) {
puts("No system D-BUS running, skipping test");
return;
}
daemon = up_daemon_new ();
g_assert (daemon != NULL);
@ -274,6 +281,24 @@ up_test_history_func (void)
rmdir (history_dir);
}
static void
up_test_polkit_func (void)
{
UpPolkit *polkit;
/* polkit only listens to the system bus */
if (!g_file_test (DBUS_SYSTEM_SOCKET, G_FILE_TEST_EXISTS)) {
puts("No system D-BUS running, skipping test");
return;
}
polkit = up_polkit_new ();
g_assert (polkit != NULL);
/* unref */
g_object_unref (polkit);
}
int
main (int argc, char **argv)
{
@ -290,6 +315,7 @@ main (int argc, char **argv)
g_test_add_func ("/power/device_list", up_test_device_list_func);
g_test_add_func ("/power/history", up_test_history_func);
g_test_add_func ("/power/native", up_test_native_func);
g_test_add_func ("/power/polkit", up_test_polkit_func);
g_test_add_func ("/power/daemon", up_test_daemon_func);
return g_test_run ();