Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2109)

Unified Diff: dbus/bus_unittest.cc

Issue 9691025: dbus: allow unregistering of exported objects (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update doc from nit Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dbus/bus.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/bus_unittest.cc
diff --git a/dbus/bus_unittest.cc b/dbus/bus_unittest.cc
index 4e7e8fd73714a6499f2aba283b647f202890fcca..4011556b3f5a63d59345d9c9e2e5c270c503e0d0 100644
--- a/dbus/bus_unittest.cc
+++ b/dbus/bus_unittest.cc
@@ -108,6 +108,37 @@ TEST(BusTest, GetExportedObject) {
bus->ShutdownAndBlock();
}
+TEST(BusTest, UnregisterExportedObject) {
+ // Start the D-Bus thread.
+ base::Thread::Options thread_options;
+ thread_options.message_loop_type = MessageLoop::TYPE_IO;
+ base::Thread dbus_thread("D-Bus thread");
+ dbus_thread.StartWithOptions(thread_options);
+
+ // Create the bus.
+ dbus::Bus::Options options;
+ options.dbus_thread_message_loop_proxy = dbus_thread.message_loop_proxy();
+ scoped_refptr<dbus::Bus> bus = new dbus::Bus(options);
+ ASSERT_FALSE(bus->shutdown_completed());
+
+ dbus::ExportedObject* object_proxy1 =
+ bus->GetExportedObject(dbus::ObjectPath("/org/chromium/TestObject"));
+ ASSERT_TRUE(object_proxy1);
+
+ bus->UnregisterExportedObject(dbus::ObjectPath("/org/chromium/TestObject"));
+
+ // This should return a new object.
+ dbus::ExportedObject* object_proxy2 =
+ bus->GetExportedObject(dbus::ObjectPath("/org/chromium/TestObject"));
+ ASSERT_TRUE(object_proxy2);
+ EXPECT_NE(object_proxy1, object_proxy2);
+
+ // Shut down synchronously.
+ bus->ShutdownOnDBusThreadAndBlock();
+ EXPECT_TRUE(bus->shutdown_completed());
+ dbus_thread.Stop();
+}
+
TEST(BusTest, ShutdownAndBlock) {
dbus::Bus::Options options;
scoped_refptr<dbus::Bus> bus = new dbus::Bus(options);
« no previous file with comments | « dbus/bus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698