Pepper: Fix crash on allocation failure.
[chromium-blink-merge.git] / chromeos / dbus / introspectable_client_unittest.cc
blob5e98b1cdf7d96665b4c8bd6eba8881ee14c79554
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"
9 namespace {
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"
15 "<node>\n"
16 " <interface name=\"org.freedesktop.DBus.Introspectable\">\n"
17 " <method name=\"Introspect\">\n"
18 " <arg type=\"s\" direction=\"out\"/>\n"
19 " </method>\n"
20 " </interface>\n"
21 " <interface name=\"org.bluez.Device\">\n"
22 " <method name=\"GetProperties\">\n"
23 " <arg type=\"a{sv}\" direction=\"out\"/>\n"
24 " </method>\n"
25 " <method name=\"SetProperty\">\n"
26 " <arg type=\"s\" direction=\"in\"/>\n"
27 " <arg type=\"v\" direction=\"in\"/>\n"
28 " </method>\n"
29 " <method name=\"DiscoverServices\">\n"
30 " <arg type=\"s\" direction=\"in\"/>\n"
31 " <arg type=\"a{us}\" direction=\"out\"/>\n"
32 " </method>\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"
38 " </signal>\n"
39 " <signal name=\"DisconnectRequested\"/>\n"
40 " </interface>\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"
46 " </method>\n"
47 " <signal name=\"PropertyChanged\">\n"
48 " <arg type=\"s\"/>\n"
49 " <arg type=\"v\"/>\n"
50 " </signal>\n"
51 " </interface>\n"
52 "</node>";
54 } // namespace
56 namespace chromeos {
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