| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "dbus/bus.h" | 5 #include "dbus/bus.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 TEST(BusTest, ShutdownAndBlockWithDBusThread) { | 74 TEST(BusTest, ShutdownAndBlockWithDBusThread) { |
| 75 // Start the D-Bus thread. | 75 // Start the D-Bus thread. |
| 76 base::Thread::Options thread_options; | 76 base::Thread::Options thread_options; |
| 77 thread_options.message_loop_type = MessageLoop::TYPE_IO; | 77 thread_options.message_loop_type = MessageLoop::TYPE_IO; |
| 78 base::Thread dbus_thread("D-Bus thread"); | 78 base::Thread dbus_thread("D-Bus thread"); |
| 79 dbus_thread.StartWithOptions(thread_options); | 79 dbus_thread.StartWithOptions(thread_options); |
| 80 | 80 |
| 81 // Create the bus. | 81 // Create the bus. |
| 82 dbus::Bus::Options options; | 82 dbus::Bus::Options options; |
| 83 options.dbus_thread = &dbus_thread; | 83 options.dbus_thread_message_loop_proxy = dbus_thread.message_loop_proxy(); |
| 84 scoped_refptr<dbus::Bus> bus = new dbus::Bus(options); | 84 scoped_refptr<dbus::Bus> bus = new dbus::Bus(options); |
| 85 ASSERT_FALSE(bus->shutdown_completed()); | 85 ASSERT_FALSE(bus->shutdown_completed()); |
| 86 | 86 |
| 87 // Shut down synchronously. | 87 // Shut down synchronously. |
| 88 bus->ShutdownOnDBusThreadAndBlock(); | 88 bus->ShutdownOnDBusThreadAndBlock(); |
| 89 EXPECT_TRUE(bus->shutdown_completed()); | 89 EXPECT_TRUE(bus->shutdown_completed()); |
| 90 dbus_thread.Stop(); | 90 dbus_thread.Stop(); |
| 91 } | 91 } |
| OLD | NEW |