OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/object_manager.h" | 5 #include "dbus/object_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 base::ThreadRestrictions::SetIOAllowed(false); | 63 base::ThreadRestrictions::SetIOAllowed(false); |
64 | 64 |
65 // Start the D-Bus thread. | 65 // Start the D-Bus thread. |
66 dbus_thread_.reset(new base::Thread("D-Bus Thread")); | 66 dbus_thread_.reset(new base::Thread("D-Bus Thread")); |
67 base::Thread::Options thread_options; | 67 base::Thread::Options thread_options; |
68 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; | 68 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; |
69 ASSERT_TRUE(dbus_thread_->StartWithOptions(thread_options)); | 69 ASSERT_TRUE(dbus_thread_->StartWithOptions(thread_options)); |
70 | 70 |
71 // Start the test service, using the D-Bus thread. | 71 // Start the test service, using the D-Bus thread. |
72 TestService::Options options; | 72 TestService::Options options; |
73 options.dbus_task_runner = dbus_thread_->message_loop_proxy(); | 73 options.dbus_task_runner = dbus_thread_->task_runner(); |
74 test_service_.reset(new TestService(options)); | 74 test_service_.reset(new TestService(options)); |
75 ASSERT_TRUE(test_service_->StartService()); | 75 ASSERT_TRUE(test_service_->StartService()); |
76 ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); | 76 ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); |
77 ASSERT_TRUE(test_service_->HasDBusThread()); | 77 ASSERT_TRUE(test_service_->HasDBusThread()); |
78 | 78 |
79 // Create the client, using the D-Bus thread. | 79 // Create the client, using the D-Bus thread. |
80 Bus::Options bus_options; | 80 Bus::Options bus_options; |
81 bus_options.bus_type = Bus::SESSION; | 81 bus_options.bus_type = Bus::SESSION; |
82 bus_options.connection_type = Bus::PRIVATE; | 82 bus_options.connection_type = Bus::PRIVATE; |
83 bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy(); | 83 bus_options.dbus_task_runner = dbus_thread_->task_runner(); |
84 bus_ = new Bus(bus_options); | 84 bus_ = new Bus(bus_options); |
85 ASSERT_TRUE(bus_->HasDBusThread()); | 85 ASSERT_TRUE(bus_->HasDBusThread()); |
86 | 86 |
87 object_manager_ = bus_->GetObjectManager( | 87 object_manager_ = bus_->GetObjectManager( |
88 "org.chromium.TestService", | 88 "org.chromium.TestService", |
89 ObjectPath("/org/chromium/TestService")); | 89 ObjectPath("/org/chromium/TestService")); |
90 object_manager_->RegisterInterface("org.chromium.TestInterface", this); | 90 object_manager_->RegisterInterface("org.chromium.TestInterface", this); |
91 | 91 |
92 WaitForObject(); | 92 WaitForObject(); |
93 } | 93 } |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 base::Unretained(this)), | 408 base::Unretained(this)), |
409 base::TimeDelta::FromSeconds(2)); | 409 base::TimeDelta::FromSeconds(2)); |
410 | 410 |
411 while (last_name_value_ != "ChangedTestServiceName" && !timeout_expired_) { | 411 while (last_name_value_ != "ChangedTestServiceName" && !timeout_expired_) { |
412 run_loop_.reset(new base::RunLoop); | 412 run_loop_.reset(new base::RunLoop); |
413 run_loop_->Run(); | 413 run_loop_->Run(); |
414 } | 414 } |
415 } | 415 } |
416 | 416 |
417 } // namespace dbus | 417 } // namespace dbus |
OLD | NEW |