1# Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import dbus 6 7from autotest_lib.client.bin import test 8from autotest_lib.client.common_lib import error 9 10class platform_DebugDaemonPing(test.test): 11 version = 1 12 13 def run_once(self, *args, **kwargs): 14 bus = dbus.SystemBus() 15 proxy = bus.get_object('org.chromium.debugd', '/org/chromium/debugd') 16 self.iface = dbus.Interface(proxy, 17 dbus_interface='org.chromium.debugd') 18 handle = self.iface.PingStart(1, "127.0.0.1", {}, signature="hsa{sv}") 19 self.iface.PingStop(handle) 20 got_exception = False 21 try: 22 self.iface.PingStop(handle) 23 except dbus.DBusException as e: 24 if e.get_dbus_name() == 'org.chromium.debugd.error.NoSuchProcess': 25 got_exception = True 26 else: 27 print "Unexpected exception %s" % e.get_dbus_name() 28 if not got_exception: 29 raise error.TestFail("Didn't get expected exception.") 30