| Index: dbus/bus_unittest.cc
|
| diff --git a/dbus/bus_unittest.cc b/dbus/bus_unittest.cc
|
| index ca24041f86c309a07989cc379d6c6a197dc13059..c632d85a4c30af29b4da6e41c65b3b7b39ba8f59 100644
|
| --- a/dbus/bus_unittest.cc
|
| +++ b/dbus/bus_unittest.cc
|
| @@ -84,6 +84,38 @@ TEST(BusTest, GetObjectProxyIgnoreUnknownService) {
|
| bus->ShutdownAndBlock();
|
| }
|
|
|
| +TEST(BusTest, RemoveObjectProxy) {
|
| + dbus::Bus::Options options;
|
| + scoped_refptr<dbus::Bus> bus = new dbus::Bus(options);
|
| +
|
| + dbus::ObjectProxy* object_proxy1 =
|
| + bus->GetObjectProxy("org.chromium.TestService",
|
| + dbus::ObjectPath("/org/chromium/TestObject"));
|
| + ASSERT_TRUE(object_proxy1);
|
| +
|
| + // Increment the reference count to the object proxy to avoid destroying it
|
| + // while removing the object.
|
| + object_proxy1->AddRef();
|
| +
|
| + // Remove the object from the bus. This will invalidate any other usage of
|
| + // object_proxy1 other than destroy it.
|
| + bus->RemoveObjectProxy("org.chromium.TestService",
|
| + dbus::ObjectPath("/org/chromium/TestObject"));
|
| +
|
| + // This should return a different object because the first object still
|
| + // exists thanks to the increased reference.
|
| + dbus::ObjectProxy* object_proxy2 =
|
| + bus->GetObjectProxy("org.chromium.TestService",
|
| + dbus::ObjectPath("/org/chromium/TestObject"));
|
| + ASSERT_TRUE(object_proxy2);
|
| + EXPECT_NE(object_proxy1, object_proxy2);
|
| +
|
| + // Release object_proxy1.
|
| + object_proxy1->Release();
|
| +
|
| + bus->ShutdownAndBlock();
|
| +}
|
| +
|
| TEST(BusTest, GetExportedObject) {
|
| dbus::Bus::Options options;
|
| scoped_refptr<dbus::Bus> bus = new dbus::Bus(options);
|
|
|