| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 return static_cast<dbus::PropertySet*>(properties); | 57 return static_cast<dbus::PropertySet*>(properties); |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void SetUp() { | 60 virtual void SetUp() { |
| 61 // Make the main thread not to allow IO. | 61 // Make the main thread not to allow IO. |
| 62 base::ThreadRestrictions::SetIOAllowed(false); | 62 base::ThreadRestrictions::SetIOAllowed(false); |
| 63 | 63 |
| 64 // Start the D-Bus thread. | 64 // Start the D-Bus thread. |
| 65 dbus_thread_.reset(new base::Thread("D-Bus Thread")); | 65 dbus_thread_.reset(new base::Thread("D-Bus Thread")); |
| 66 base::Thread::Options thread_options; | 66 base::Thread::Options thread_options; |
| 67 thread_options.message_loop_type = MessageLoop::TYPE_IO; | 67 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 68 ASSERT_TRUE(dbus_thread_->StartWithOptions(thread_options)); | 68 ASSERT_TRUE(dbus_thread_->StartWithOptions(thread_options)); |
| 69 | 69 |
| 70 // Start the test service, using the D-Bus thread. | 70 // Start the test service, using the D-Bus thread. |
| 71 dbus::TestService::Options options; | 71 dbus::TestService::Options options; |
| 72 options.dbus_task_runner = dbus_thread_->message_loop_proxy(); | 72 options.dbus_task_runner = dbus_thread_->message_loop_proxy(); |
| 73 test_service_.reset(new dbus::TestService(options)); | 73 test_service_.reset(new dbus::TestService(options)); |
| 74 ASSERT_TRUE(test_service_->StartService()); | 74 ASSERT_TRUE(test_service_->StartService()); |
| 75 ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); | 75 ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); |
| 76 ASSERT_TRUE(test_service_->HasDBusThread()); | 76 ASSERT_TRUE(test_service_->HasDBusThread()); |
| 77 | 77 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 writer.AppendString(action); | 169 writer.AppendString(action); |
| 170 writer.AppendObjectPath(object_path); | 170 writer.AppendObjectPath(object_path); |
| 171 | 171 |
| 172 object_proxy->CallMethod(&method_call, | 172 object_proxy->CallMethod(&method_call, |
| 173 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 173 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 174 base::Bind(&ObjectManagerTest::MethodCallback, | 174 base::Bind(&ObjectManagerTest::MethodCallback, |
| 175 base::Unretained(this))); | 175 base::Unretained(this))); |
| 176 WaitForMethodCallback(); | 176 WaitForMethodCallback(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 MessageLoop message_loop_; | 179 base::MessageLoop message_loop_; |
| 180 scoped_ptr<base::Thread> dbus_thread_; | 180 scoped_ptr<base::Thread> dbus_thread_; |
| 181 scoped_refptr<dbus::Bus> bus_; | 181 scoped_refptr<dbus::Bus> bus_; |
| 182 dbus::ObjectManager* object_manager_; | 182 dbus::ObjectManager* object_manager_; |
| 183 scoped_ptr<dbus::TestService> test_service_; | 183 scoped_ptr<dbus::TestService> test_service_; |
| 184 | 184 |
| 185 std::vector<std::pair<dbus::ObjectPath, std::string> > added_objects_; | 185 std::vector<std::pair<dbus::ObjectPath, std::string> > added_objects_; |
| 186 std::vector<std::pair<dbus::ObjectPath, std::string> > removed_objects_; | 186 std::vector<std::pair<dbus::ObjectPath, std::string> > removed_objects_; |
| 187 std::vector<std::string> updated_properties_; | 187 std::vector<std::string> updated_properties_; |
| 188 | 188 |
| 189 bool method_callback_called_; | 189 bool method_callback_called_; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 object_paths = object_manager_->GetObjects(); | 331 object_paths = object_manager_->GetObjects(); |
| 332 ASSERT_EQ(1U, object_paths.size()); | 332 ASSERT_EQ(1U, object_paths.size()); |
| 333 EXPECT_EQ(dbus::ObjectPath("/org/chromium/TestObject"), object_paths[0]); | 333 EXPECT_EQ(dbus::ObjectPath("/org/chromium/TestObject"), object_paths[0]); |
| 334 | 334 |
| 335 object_paths = | 335 object_paths = |
| 336 object_manager_->GetObjectsWithInterface("org.chromium.TestInterface"); | 336 object_manager_->GetObjectsWithInterface("org.chromium.TestInterface"); |
| 337 ASSERT_EQ(1U, object_paths.size()); | 337 ASSERT_EQ(1U, object_paths.size()); |
| 338 EXPECT_EQ(dbus::ObjectPath("/org/chromium/TestObject"), object_paths[0]); | 338 EXPECT_EQ(dbus::ObjectPath("/org/chromium/TestObject"), object_paths[0]); |
| 339 } | 339 } |
| OLD | NEW |