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 <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <string> | 10 #include <string> |
8 #include <vector> | 11 #include <vector> |
9 | 12 |
10 #include "base/basictypes.h" | |
11 #include "base/bind.h" | 13 #include "base/bind.h" |
12 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
14 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
15 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
16 #include "dbus/bus.h" | 18 #include "dbus/bus.h" |
17 #include "dbus/object_path.h" | 19 #include "dbus/object_path.h" |
18 #include "dbus/object_proxy.h" | 20 #include "dbus/object_proxy.h" |
19 #include "dbus/property.h" | 21 #include "dbus/property.h" |
20 #include "dbus/test_service.h" | 22 #include "dbus/test_service.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
22 | 24 |
23 namespace dbus { | 25 namespace dbus { |
24 | 26 |
25 // The object manager test exercises the asynchronous APIs in ObjectManager, | 27 // The object manager test exercises the asynchronous APIs in ObjectManager, |
26 // and by extension PropertySet and Property<>. | 28 // and by extension PropertySet and Property<>. |
27 class ObjectManagerTest | 29 class ObjectManagerTest |
28 : public testing::Test, | 30 : public testing::Test, |
29 public ObjectManager::Interface { | 31 public ObjectManager::Interface { |
30 public: | 32 public: |
31 ObjectManagerTest() : timeout_expired_(false) { | 33 ObjectManagerTest() : timeout_expired_(false) { |
32 } | 34 } |
33 | 35 |
34 struct Properties : public PropertySet { | 36 struct Properties : public PropertySet { |
35 Property<std::string> name; | 37 Property<std::string> name; |
36 Property<int16> version; | 38 Property<int16_t> version; |
37 Property<std::vector<std::string> > methods; | 39 Property<std::vector<std::string> > methods; |
38 Property<std::vector<ObjectPath> > objects; | 40 Property<std::vector<ObjectPath> > objects; |
39 | 41 |
40 Properties(ObjectProxy* object_proxy, | 42 Properties(ObjectProxy* object_proxy, |
41 const std::string& interface_name, | 43 const std::string& interface_name, |
42 PropertyChangedCallback property_changed_callback) | 44 PropertyChangedCallback property_changed_callback) |
43 : PropertySet(object_proxy, interface_name, property_changed_callback) { | 45 : PropertySet(object_proxy, interface_name, property_changed_callback) { |
44 RegisterProperty("Name", &name); | 46 RegisterProperty("Name", &name); |
45 RegisterProperty("Version", &version); | 47 RegisterProperty("Version", &version); |
46 RegisterProperty("Methods", &methods); | 48 RegisterProperty("Methods", &methods); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 base::Unretained(this)), | 410 base::Unretained(this)), |
409 base::TimeDelta::FromSeconds(2)); | 411 base::TimeDelta::FromSeconds(2)); |
410 | 412 |
411 while (last_name_value_ != "ChangedTestServiceName" && !timeout_expired_) { | 413 while (last_name_value_ != "ChangedTestServiceName" && !timeout_expired_) { |
412 run_loop_.reset(new base::RunLoop); | 414 run_loop_.reset(new base::RunLoop); |
413 run_loop_->Run(); | 415 run_loop_->Run(); |
414 } | 416 } |
415 } | 417 } |
416 | 418 |
417 } // namespace dbus | 419 } // namespace dbus |
OLD | NEW |