Autopilot does not honor the object cache when creating the root introspection object

Bug #1348399 reported by Thomi Richards
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Autopilot
Fix Released
High
Unassigned
autopilot (Ubuntu)
Fix Released
Undecided
Unassigned
Vivid
New
Undecided
Unassigned

Bug Description

Currently, if a user defines a custom proxy class for the node at the root of the introspection tree, it does not get returned by the launch_* methods.

The reason for this is that, in _search.py, the _get_proxy_bases_from_introspection_xml does this:

---
def _get_proxy_bases_from_introspection_xml(introspection_xml):
    bases = [ApplicationProxyObject]
---

and ApplicationProxyObject is defined (just a few lines further down) as:

---
class ApplicationProxyObject(ap_dbus.DBusIntrospectionObject):
---

So, the root proxy object will never pick up any CPC's in the object registry. To fix this, let's make ApplicationProxyObject a simple mixin class:

---
class ApplicationProxyObject(object):
    """A class that better supports query data from an application."""

    def __init__(self):
        self._process = None
---

and then use the existing methods defined in autopilot.introspection._object_registry to get the appropriate proxy class:

---
def _get_proxy_bases_from_introspection_xml(introspection_xml):
    bases = [ call_to_get_proxy_class(...), ApplicationProxyObject]
---

I'm too lazy to figure out what the exact call should be, but I'm sure it exists in the _object_registry module. This will probably involve changing the _get_proxy_bases_from_introspection_xml function to take some additional parameters, or some refactoring to pass in the base class.

The test case for this should be:

Write a simple Qml app script, and define a custom proxy class for the root node. Assert that:

* When launching the app, we get an instance of the CPC, not a generated class.
* When calling the get_root_instance call on any other proxy object, we get an instance of the CPC, not a generated class.

Related branches

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:autopilot at revision 511, scheduled for release in autopilot, milestone 1.4

Changed in autopilot:
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package autopilot - 1.5.0+14.10.20140812-0ubuntu1

---------------
autopilot (1.5.0+14.10.20140812-0ubuntu1) utopic; urgency=low

  [ Thomi Richards ]
  * Release of Autopilot. Bugfix for lp:1306330 & lp:1348399 (LP:
    #1306330, #1078732, #1348399)
 -- Ubuntu daily release <email address hidden> Tue, 12 Aug 2014 09:53:34 +0000

Changed in autopilot (Ubuntu):
status: New → Fix Released
Changed in autopilot:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.