From 6c44d97b042569347b95e2ae94cfdfecb84fc8fb Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 19 Dec 2016 13:18:05 +0200 Subject: [PATCH] tests: D-Bus P2P discovery on a specific non-social channel Signed-off-by: Jouni Malinen --- tests/hwsim/test_dbus.py | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py index 7233a6da5..25332ed7b 100644 --- a/tests/hwsim/test_dbus.py +++ b/tests/hwsim/test_dbus.py @@ -2876,6 +2876,47 @@ def test_dbus_p2p_discovery(dev, apdev): p2p.ExtendedListen(dbus.Dictionary({})) dev[0].global_request("P2P_EXT_LISTEN") +def test_dbus_p2p_discovery_freq(dev, apdev): + """D-Bus P2P discovery on a specific non-social channel""" + (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0]) + p2p = dbus.Interface(if_obj, WPAS_DBUS_IFACE_P2PDEVICE) + + addr1 = dev[1].p2p_dev_addr() + autogo(dev[1], freq=2422) + + class TestDbusP2p(TestDbus): + def __init__(self, bus): + TestDbus.__init__(self, bus) + self.found = False + + def __enter__(self): + gobject.timeout_add(1, self.run_test) + gobject.timeout_add(5000, self.timeout) + self.add_signal(self.deviceFound, WPAS_DBUS_IFACE_P2PDEVICE, + "DeviceFound") + self.loop.run() + return self + + def deviceFound(self, path): + logger.debug("deviceFound: path=%s" % path) + self.found = True + self.loop.quit() + + def run_test(self, *args): + logger.debug("run_test") + p2p.Find(dbus.Dictionary({'freq': 2422})) + return False + + def success(self): + return self.found + + with TestDbusP2p(bus) as t: + if not t.success(): + raise Exception("Expected signals not seen") + + dev[1].remove_group() + p2p.StopFind() + def test_dbus_p2p_service_discovery(dev, apdev): """D-Bus P2P service discovery""" (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0])