| 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> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/single_thread_task_runner.h" |
| 16 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 17 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 18 #include "dbus/bus.h" | 19 #include "dbus/bus.h" |
| 19 #include "dbus/object_path.h" | 20 #include "dbus/object_path.h" |
| 20 #include "dbus/object_proxy.h" | 21 #include "dbus/object_proxy.h" |
| 21 #include "dbus/property.h" | 22 #include "dbus/property.h" |
| 22 #include "dbus/test_service.h" | 23 #include "dbus/test_service.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 25 |
| 25 namespace dbus { | 26 namespace dbus { |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 398 |
| 398 object_manager_ = bus_->GetObjectManager( | 399 object_manager_ = bus_->GetObjectManager( |
| 399 test_service_->service_name(), | 400 test_service_->service_name(), |
| 400 ObjectPath("/org/chromium/TestService")); | 401 ObjectPath("/org/chromium/TestService")); |
| 401 object_manager_->RegisterInterface("org.chromium.TestInterface", this); | 402 object_manager_->RegisterInterface("org.chromium.TestInterface", this); |
| 402 | 403 |
| 403 // The newly created object manager should call GetManagedObjects immediately | 404 // The newly created object manager should call GetManagedObjects immediately |
| 404 // after setting up the match rule for PropertiesChanged. We should process | 405 // after setting up the match rule for PropertiesChanged. We should process |
| 405 // the PropertiesChanged event right after that. If we don't receive it within | 406 // the PropertiesChanged event right after that. If we don't receive it within |
| 406 // 2 seconds, then fail the test. | 407 // 2 seconds, then fail the test. |
| 407 message_loop_.PostDelayedTask( | 408 message_loop_.task_runner()->PostDelayedTask( |
| 408 FROM_HERE, | 409 FROM_HERE, base::Bind(&ObjectManagerTest::PropertiesChangedTestTimeout, |
| 409 base::Bind(&ObjectManagerTest::PropertiesChangedTestTimeout, | 410 base::Unretained(this)), |
| 410 base::Unretained(this)), | |
| 411 base::TimeDelta::FromSeconds(2)); | 411 base::TimeDelta::FromSeconds(2)); |
| 412 | 412 |
| 413 while (last_name_value_ != "ChangedTestServiceName" && !timeout_expired_) { | 413 while (last_name_value_ != "ChangedTestServiceName" && !timeout_expired_) { |
| 414 run_loop_.reset(new base::RunLoop); | 414 run_loop_.reset(new base::RunLoop); |
| 415 run_loop_->Run(); | 415 run_loop_->Run(); |
| 416 } | 416 } |
| 417 } | 417 } |
| 418 | 418 |
| 419 } // namespace dbus | 419 } // namespace dbus |
| OLD | NEW |