diff options
author | earthdok <earthdok@chromium.org> | 2014-09-03 03:32:36 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-03 10:43:13 +0000 |
commit | 9562caf1ec60d2e6f1c4c64b84ffddcd5a0ca029 (patch) | |
tree | 02557441ec2c52073c602b9c796c5f151530228d /dbus/property_unittest.cc | |
parent | 6047562c6cd816727b7a78a0def63cc30f0999a5 (diff) | |
download | chromium_src-9562caf1ec60d2e6f1c4c64b84ffddcd5a0ca029.zip chromium_src-9562caf1ec60d2e6f1c4c64b84ffddcd5a0ca029.tar.gz chromium_src-9562caf1ec60d2e6f1c4c64b84ffddcd5a0ca029.tar.bz2 |
Plug some of the leaks in dbus_unittests.
Also, remove the deprecated base::MessageLoop::Run() calls
everywhere in dbus unittests.
BUG=365669
R=armansito@chromium.org
Review URL: https://codereview.chromium.org/523623003
Cr-Commit-Position: refs/heads/master@{#293113}
Diffstat (limited to 'dbus/property_unittest.cc')
-rw-r--r-- | dbus/property_unittest.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/dbus/property_unittest.cc b/dbus/property_unittest.cc index e078c00..879a9a6 100644 --- a/dbus/property_unittest.cc +++ b/dbus/property_unittest.cc @@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" +#include "base/run_loop.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" #include "dbus/bus.h" @@ -105,20 +106,22 @@ class PropertyTest : public testing::Test { // waited for. void PropertyCallback(const std::string& id, bool success) { last_callback_ = id; - message_loop_.Quit(); + run_loop_->Quit(); } protected: // Called when a property value is updated. void OnPropertyChanged(const std::string& name) { updated_properties_.push_back(name); - message_loop_.Quit(); + run_loop_->Quit(); } // Waits for the given number of updates. void WaitForUpdates(size_t num_updates) { - while (updated_properties_.size() < num_updates) - message_loop_.Run(); + while (updated_properties_.size() < num_updates) { + run_loop_.reset(new base::RunLoop); + run_loop_->Run(); + } for (size_t i = 0; i < num_updates; ++i) updated_properties_.erase(updated_properties_.begin()); } @@ -136,11 +139,13 @@ class PropertyTest : public testing::Test { // other; you can set this to whatever you wish. void WaitForCallback(const std::string& id) { while (last_callback_ != id) { - message_loop_.Run(); + run_loop_.reset(new base::RunLoop); + run_loop_->Run(); } } base::MessageLoop message_loop_; + scoped_ptr<base::RunLoop> run_loop_; scoped_ptr<base::Thread> dbus_thread_; scoped_refptr<Bus> bus_; ObjectProxy* object_proxy_; |