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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 RegisterProperty("Name", &name); | 44 RegisterProperty("Name", &name); |
45 RegisterProperty("Version", &version); | 45 RegisterProperty("Version", &version); |
46 RegisterProperty("Methods", &methods); | 46 RegisterProperty("Methods", &methods); |
47 RegisterProperty("Objects", &objects); | 47 RegisterProperty("Objects", &objects); |
48 } | 48 } |
49 }; | 49 }; |
50 | 50 |
51 virtual PropertySet* CreateProperties( | 51 virtual PropertySet* CreateProperties( |
52 ObjectProxy* object_proxy, | 52 ObjectProxy* object_proxy, |
53 const ObjectPath& object_path, | 53 const ObjectPath& object_path, |
54 const std::string& interface_name) OVERRIDE { | 54 const std::string& interface_name) override { |
55 Properties* properties = new Properties( | 55 Properties* properties = new Properties( |
56 object_proxy, interface_name, | 56 object_proxy, interface_name, |
57 base::Bind(&ObjectManagerTest::OnPropertyChanged, | 57 base::Bind(&ObjectManagerTest::OnPropertyChanged, |
58 base::Unretained(this), object_path)); | 58 base::Unretained(this), object_path)); |
59 return static_cast<PropertySet*>(properties); | 59 return static_cast<PropertySet*>(properties); |
60 } | 60 } |
61 | 61 |
62 virtual void SetUp() { | 62 virtual void SetUp() { |
63 // Make the main thread not to allow IO. | 63 // Make the main thread not to allow IO. |
64 base::ThreadRestrictions::SetIOAllowed(false); | 64 base::ThreadRestrictions::SetIOAllowed(false); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void PropertiesChangedTestTimeout() { | 120 void PropertiesChangedTestTimeout() { |
121 timeout_expired_ = true; | 121 timeout_expired_ = true; |
122 run_loop_->Quit(); | 122 run_loop_->Quit(); |
123 | 123 |
124 FAIL() << "Never received PropertiesChanged"; | 124 FAIL() << "Never received PropertiesChanged"; |
125 } | 125 } |
126 | 126 |
127 protected: | 127 protected: |
128 // Called when an object is added. | 128 // Called when an object is added. |
129 virtual void ObjectAdded(const ObjectPath& object_path, | 129 virtual void ObjectAdded(const ObjectPath& object_path, |
130 const std::string& interface_name) OVERRIDE { | 130 const std::string& interface_name) override { |
131 added_objects_.push_back(std::make_pair(object_path, interface_name)); | 131 added_objects_.push_back(std::make_pair(object_path, interface_name)); |
132 run_loop_->Quit(); | 132 run_loop_->Quit(); |
133 } | 133 } |
134 | 134 |
135 // Called when an object is removed. | 135 // Called when an object is removed. |
136 virtual void ObjectRemoved(const ObjectPath& object_path, | 136 virtual void ObjectRemoved(const ObjectPath& object_path, |
137 const std::string& interface_name) OVERRIDE { | 137 const std::string& interface_name) override { |
138 removed_objects_.push_back(std::make_pair(object_path, interface_name)); | 138 removed_objects_.push_back(std::make_pair(object_path, interface_name)); |
139 run_loop_->Quit(); | 139 run_loop_->Quit(); |
140 } | 140 } |
141 | 141 |
142 // Called when a property value is updated. | 142 // Called when a property value is updated. |
143 void OnPropertyChanged(const ObjectPath& object_path, | 143 void OnPropertyChanged(const ObjectPath& object_path, |
144 const std::string& name) { | 144 const std::string& name) { |
145 // Store the value of the "Name" property if that's the one that | 145 // Store the value of the "Name" property if that's the one that |
146 // changed. | 146 // changed. |
147 Properties* properties = static_cast<Properties*>( | 147 Properties* properties = static_cast<Properties*>( |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 base::Unretained(this)), | 409 base::Unretained(this)), |
410 base::TimeDelta::FromSeconds(2)); | 410 base::TimeDelta::FromSeconds(2)); |
411 | 411 |
412 while (last_name_value_ != "ChangedTestServiceName" && !timeout_expired_) { | 412 while (last_name_value_ != "ChangedTestServiceName" && !timeout_expired_) { |
413 run_loop_.reset(new base::RunLoop); | 413 run_loop_.reset(new base::RunLoop); |
414 run_loop_->Run(); | 414 run_loop_->Run(); |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 } // namespace dbus | 418 } // namespace dbus |
OLD | NEW |