1 // Copyright (c) 2012 The Chromium 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.
5 #include "chromeos/dbus/introspectable_client.h"
7 #include "testing/gtest/include/gtest/gtest.h"
11 const char kXmlData
[] =
12 "<!DOCTYPE node PUBLIC "
13 "\"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\" "
14 "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"
16 " <interface name=\"org.freedesktop.DBus.Introspectable\">\n"
17 " <method name=\"Introspect\">\n"
18 " <arg type=\"s\" direction=\"out\"/>\n"
21 " <interface name=\"org.bluez.Device\">\n"
22 " <method name=\"GetProperties\">\n"
23 " <arg type=\"a{sv}\" direction=\"out\"/>\n"
25 " <method name=\"SetProperty\">\n"
26 " <arg type=\"s\" direction=\"in\"/>\n"
27 " <arg type=\"v\" direction=\"in\"/>\n"
29 " <method name=\"DiscoverServices\">\n"
30 " <arg type=\"s\" direction=\"in\"/>\n"
31 " <arg type=\"a{us}\" direction=\"out\"/>\n"
33 " <method name=\"CancelDiscovery\"/>\n"
34 " <method name=\"Disconnect\"/>\n"
35 " <signal name=\"PropertyChanged\">\n"
36 " <arg type=\"s\"/>\n"
37 " <arg type=\"v\"/>\n"
39 " <signal name=\"DisconnectRequested\"/>\n"
41 " <interface name=\"org.bluez.Input\">\n"
42 " <method name=\"Connect\"/>\n"
43 " <method name=\"Disconnect\"/>\n"
44 " <method name=\"GetProperties\">\n"
45 " <arg type=\"a{sv}\" direction=\"out\"/>\n"
47 " <signal name=\"PropertyChanged\">\n"
48 " <arg type=\"s\"/>\n"
49 " <arg type=\"v\"/>\n"
58 TEST(IntrospectableClientTest
, GetInterfacesFromIntrospectResult
) {
59 std::vector
<std::string
> interfaces
=
60 IntrospectableClient::GetInterfacesFromIntrospectResult(kXmlData
);
62 ASSERT_EQ(3U, interfaces
.size());
63 EXPECT_EQ("org.freedesktop.DBus.Introspectable", interfaces
[0]);
64 EXPECT_EQ("org.bluez.Device", interfaces
[1]);
65 EXPECT_EQ("org.bluez.Input", interfaces
[2]);
68 } // namespace chromeos