gio/tests/tls-certificates: fix
authorDan Winship <danw@gnome.org>
Wed, 15 Oct 2014 21:49:09 +0000 (17:49 -0400)
committerDan Winship <danw@gnome.org>
Sat, 25 Oct 2014 12:52:54 +0000 (08:52 -0400)
da053e34 broke the tls-certificates test by requiring the backend to
implement g_tls_certificate_verify() (which the test TLS backend
didn't). Add a trivial implementation to make the test pass again;
we'll need something more complicated when we add tests that are
supposed to get errors.

gio/tests/gtesttlsbackend.c

index d08e2aa..d5417fd 100644 (file)
@@ -92,6 +92,15 @@ G_DEFINE_TYPE_WITH_CODE (GTestTlsCertificate, g_test_tls_certificate, G_TYPE_TLS
                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
                                                g_test_tls_certificate_initable_iface_init);)
 
+static GTlsCertificateFlags
+g_test_tls_certificate_verify (GTlsCertificate     *cert,
+                               GSocketConnectable  *identity,
+                               GTlsCertificate     *trusted_ca)
+{
+  /* For now, all of the tests expect the certificate to verify */
+  return 0;
+}
+
 static void
 g_test_tls_certificate_get_property (GObject    *object,
                                      guint       prop_id,
@@ -151,14 +160,17 @@ g_test_tls_certificate_finalize (GObject *object)
 }
 
 static void
-g_test_tls_certificate_class_init (GTestTlsCertificateClass *certificate_class)
+g_test_tls_certificate_class_init (GTestTlsCertificateClass *test_class)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS (certificate_class);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (test_class);
+  GTlsCertificateClass *certificate_class = G_TLS_CERTIFICATE_CLASS (test_class);
 
   gobject_class->get_property = g_test_tls_certificate_get_property;
   gobject_class->set_property = g_test_tls_certificate_set_property;
   gobject_class->finalize = g_test_tls_certificate_finalize;
 
+  certificate_class->verify = g_test_tls_certificate_verify;
+
   g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE, "certificate");
   g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE_PEM, "certificate-pem");
   g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY, "private-key");