[Pkg-telepathy-commits] [telepathy-mission-control-6] 44/280: already-has-channel test: alter how we delay preparation

Simon McVittie smcv at debian.org
Thu Mar 27 20:07:03 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository telepathy-mission-control-6.

commit a3b0355bf0f7f4fb5d17eca056d6d3c6c2caf058
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Thu Oct 3 18:03:18 2013 +0100

    already-has-channel test: alter how we delay preparation
    
    We used to delay GetInterfaces and Get(CONNECTION, Interfaces), but in
    recent telepathy-glib, we just use GetAll(CONNECTION), so this was
    not effective. However, this was masked by the fact that the
    ServicePoints code redundantly calls GetInterfaces. :-(
    
    GetAll is also what we use to replace GetStatus, so connection won't
    proceed if we delay that. However, we can also set up the situation
    we're trying to test by making GetAll(CONNECTION) return promptly,
    and delaying GetAll(REQUESTS) instead.
    
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54879
    Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
---
 tests/twisted/dispatcher/already-has-channel.py | 25 ++++++++-----------------
 tests/twisted/mctest.py                         | 25 +++++++++++++------------
 2 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/tests/twisted/dispatcher/already-has-channel.py b/tests/twisted/dispatcher/already-has-channel.py
index 7c55d41..9c033af 100644
--- a/tests/twisted/dispatcher/already-has-channel.py
+++ b/tests/twisted/dispatcher/already-has-channel.py
@@ -68,29 +68,20 @@ def test(q, bus, mc):
             interface=cs.tp_name_prefix + '.ConnectionManager',
             handled=False)
 
-    # Don't allow the Connection to become ready until we want it to, by
-    # avoiding a return from Get(Interfaces) or GetInterfaces.
+    # Don't allow the Connection to have its list of channels
+    # until we want it to, by avoiding a return from GetAll(Requests).
     conn = SimulatedConnection(q, bus, 'fakecm', 'fakeprotocol', '_',
-            'myself', implement_get_interfaces=False)
+            'myself', implement_get_channels=False)
 
     q.dbus_return(e.message, conn.bus_name, conn.object_path, signature='so')
 
-    # This is the pre-Connect one, from Mission Control.
-    e = q.expect('dbus-method-call', method='Get',
-            args=[cs.CONN, 'Interfaces'],
-            path=conn.object_path, handled=False)
-    q.dbus_raise(e.message, cs.DISCONNECTED, 'Not connected yet')
+    get_all_requests_call = q.expect('dbus-method-call',
+            method='GetAll', args=[cs.CONN_IFACE_REQUESTS])
 
     q.expect('dbus-method-call', method='Connect',
             path=conn.object_path, handled=True)
     conn.StatusChanged(cs.CONN_STATUS_CONNECTED, cs.CSR_NONE_SPECIFIED)
 
-    # This is from TpConnection. It's an implementation detail that it calls
-    # GetInterfaces at this point; in 'next' it will call GetAll.
-    get_interfaces_call = q.expect('dbus-method-call', method='GetInterfaces',
-            args=[],
-            path=conn.object_path, handled=False)
-
     # subscribe to the OperationList interface (MC assumes that until this
     # property has been retrieved once, nobody cares)
 
@@ -98,7 +89,7 @@ def test(q, bus, mc):
     cd_props = dbus.Interface(cd, cs.PROPERTIES_IFACE)
     assert cd_props.Get(cs.CD_IFACE_OP_LIST, 'DispatchOperations') == []
 
-    # Before returning from Get(Interfaces), make a Channel spring into
+    # Before returning from GetAll(Requests), make a Channel spring into
     # existence
 
     channel_properties = dbus.Dictionary(text_fixed_properties,
@@ -115,8 +106,8 @@ def test(q, bus, mc):
     chan = SimulatedChannel(conn, channel_properties)
     chan.announce()
 
-    # Now reply to Get(Interfaces) and say we have Requests
-    conn.Get_Interfaces(get_interfaces_call)
+    # Now reply to GetAll(Requests)
+    conn.GetAll_Requests(get_all_requests_call)
 
     # A channel dispatch operation is created for the channel we already had
 
diff --git a/tests/twisted/mctest.py b/tests/twisted/mctest.py
index a814082..9bcd287 100644
--- a/tests/twisted/mctest.py
+++ b/tests/twisted/mctest.py
@@ -222,7 +222,7 @@ class SimulatedConnection(object):
 
     def __init__(self, q, bus, cmname, protocol, account_part, self_ident,
             self_alias=None,
-            implement_get_interfaces=True, has_requests=True,
+            implement_get_channels=True, has_requests=True,
             has_presence=False, has_aliasing=False, has_avatars=False,
             avatars_persist=True, extra_interfaces=[], has_hidden=False,
             implement_get_aliases=True, initial_avatar=None,
@@ -292,13 +292,12 @@ class SimulatedConnection(object):
                 interface=cs.PROPERTIES_IFACE, method='GetAll',
                 args=[cs.CONN])
 
-        if implement_get_interfaces:
-            q.add_dbus_method_impl(self.GetInterfaces,
-                    path=self.object_path, interface=cs.CONN,
-                    method='GetInterfaces')
-            q.add_dbus_method_impl(self.Get_Interfaces,
-                    path=self.object_path, interface=cs.PROPERTIES_IFACE,
-                    method='Get', args=[cs.CONN, 'Interfaces'])
+        q.add_dbus_method_impl(self.GetInterfaces,
+                path=self.object_path, interface=cs.CONN,
+                method='GetInterfaces')
+        q.add_dbus_method_impl(self.Get_Interfaces,
+                path=self.object_path, interface=cs.PROPERTIES_IFACE,
+                method='Get', args=[cs.CONN, 'Interfaces'])
 
         q.add_dbus_method_impl(self.RequestHandles,
                 path=self.object_path, interface=cs.CONN,
@@ -309,10 +308,12 @@ class SimulatedConnection(object):
         q.add_dbus_method_impl(self.HoldHandles,
                 path=self.object_path, interface=cs.CONN,
                 method='HoldHandles')
-        q.add_dbus_method_impl(self.GetAll_Requests,
-                path=self.object_path,
-                interface=cs.PROPERTIES_IFACE, method='GetAll',
-                args=[cs.CONN_IFACE_REQUESTS])
+
+        if implement_get_channels and has_requests:
+            q.add_dbus_method_impl(self.GetAll_Requests,
+                    path=self.object_path,
+                    interface=cs.PROPERTIES_IFACE, method='GetAll',
+                    args=[cs.CONN_IFACE_REQUESTS])
 
         q.add_dbus_method_impl(self.GetContactAttributes,
                 path=self.object_path,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-mission-control-6.git



More information about the Pkg-telepathy-commits mailing list