[tracker-miners/sam/test-removable-devices: 4/4] WIP: set up devices




commit 2348f251f50d3fd3a78d2032af0a96f3c28be259
Author: Sam Thursfield <sam afuera me uk>
Date:   Tue Aug 17 19:30:49 2021 +0200

    WIP: set up devices
    
    some bits missing

 .../mockvolumemonitor/mock-volume-monitor.c        | 29 +++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/tests/functional-tests/mockvolumemonitor/mock-volume-monitor.c 
b/tests/functional-tests/mockvolumemonitor/mock-volume-monitor.c
index 88b217b1f..2cc3c4eba 100644
--- a/tests/functional-tests/mockvolumemonitor/mock-volume-monitor.c
+++ b/tests/functional-tests/mockvolumemonitor/mock-volume-monitor.c
@@ -1,4 +1,7 @@
 #include "mock-volume-monitor.h"
+#include "mock-drive.h"
+#include "mock-volume.h"
+#include "mock-mount.h"
 
 struct _MockVolumeMonitor {
        GNativeVolumeMonitor parent;
@@ -6,6 +9,10 @@ struct _MockVolumeMonitor {
        GDBusNodeInfo *node_info;
        guint bus_token;
        guint object_token;
+
+       GList *drives;
+       GList *volumes;
+       GList *mounts;
 };
 
 G_DEFINE_TYPE (MockVolumeMonitor, mock_volume_monitor, G_TYPE_NATIVE_VOLUME_MONITOR);
@@ -116,19 +123,22 @@ is_supported (void)
 static GList *
 get_connected_drives (GVolumeMonitor *volume_monitor)
 {
-       return NULL;
+       MockVolumeMonitor *self = MOCK_VOLUME_MONITOR (volume_monitor);
+       return self->drives;
 }
 
 static GList *
 get_volumes (GVolumeMonitor *volume_monitor)
 {
-       return NULL;
+       MockVolumeMonitor *self = MOCK_VOLUME_MONITOR (volume_monitor);
+       return self->volumes;
 }
 
 static GList *
 get_mounts (GVolumeMonitor *volume_monitor)
 {
-       return NULL;
+       MockVolumeMonitor *self = MOCK_VOLUME_MONITOR (volume_monitor);
+       return self->mounts;
 }
 
 static GVolume *
@@ -173,6 +183,19 @@ static void mock_volume_monitor_init (MockVolumeMonitor *self) {
                                          on_bus_name_lost,
                                          g_object_ref (self),
                                          g_object_unref);
+
+
+       MockDrive *drive;
+       drive = mock_drive_new (self, "MockDrive1");
+       self->drives = g_list_prepend (self->drives, drive);
+
+       MockVolume *volume;
+       volume = mock_volume_new (self, NULL, drive, "MockVol1");
+       self->volumes = g_list_prepend (self->volumes, volume);
+
+       MockMount *mount;
+       mount = mock_mount_new (self, NULL, volume);
+       self->mounts = g_list_prepend (self->mounts, mount);
 }
 
 static void mock_volume_monitor_class_init (MockVolumeMonitorClass *klass) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]