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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 test_service_->Stop(); | 106 test_service_->Stop(); |
107 } | 107 } |
108 | 108 |
109 void MethodCallback(dbus::Response* response) { | 109 void MethodCallback(dbus::Response* response) { |
110 method_callback_called_ = true; | 110 method_callback_called_ = true; |
111 message_loop_.Quit(); | 111 message_loop_.Quit(); |
112 } | 112 } |
113 | 113 |
114 protected: | 114 protected: |
115 // Called when an object is added. | 115 // Called when an object is added. |
116 void ObjectAdded(const dbus::ObjectPath& object_path, | 116 virtual void ObjectAdded(const dbus::ObjectPath& object_path, |
117 const std::string& interface_name) OVERRIDE { | 117 const std::string& interface_name) OVERRIDE { |
118 added_objects_.push_back(std::make_pair(object_path, interface_name)); | 118 added_objects_.push_back(std::make_pair(object_path, interface_name)); |
119 message_loop_.Quit(); | 119 message_loop_.Quit(); |
120 } | 120 } |
121 | 121 |
122 // Called when an object is removed. | 122 // Called when an object is removed. |
123 void ObjectRemoved(const dbus::ObjectPath& object_path, | 123 virtual void ObjectRemoved(const dbus::ObjectPath& object_path, |
124 const std::string& interface_name) OVERRIDE { | 124 const std::string& interface_name) OVERRIDE { |
125 removed_objects_.push_back(std::make_pair(object_path, interface_name)); | 125 removed_objects_.push_back(std::make_pair(object_path, interface_name)); |
126 message_loop_.Quit(); | 126 message_loop_.Quit(); |
127 } | 127 } |
128 | 128 |
129 // Called when a property value is updated. | 129 // Called when a property value is updated. |
130 void OnPropertyChanged(const dbus::ObjectPath& object_path, | 130 void OnPropertyChanged(const dbus::ObjectPath& object_path, |
131 const std::string& name) { | 131 const std::string& name) { |
132 updated_properties_.push_back(name); | 132 updated_properties_.push_back(name); |
133 message_loop_.Quit(); | 133 message_loop_.Quit(); |
134 } | 134 } |
(...skipping 195 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 |