Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1172)

Unified Diff: dbus/mock_unittest.cc

Issue 523623003: Plug some of the leaks in dbus_unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: run_loop_->Quit() Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dbus/end_to_end_async_unittest.cc ('k') | dbus/object_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/mock_unittest.cc
diff --git a/dbus/mock_unittest.cc b/dbus/mock_unittest.cc
index bede2740d407d536858074f5088ed74e68d33247..c1e0f9b3f6b3bfce9c3f95f474f70f03e01ca627 100644
--- a/dbus/mock_unittest.cc
+++ b/dbus/mock_unittest.cc
@@ -7,6 +7,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
#include "dbus/message.h"
#include "dbus/mock_bus.h"
#include "dbus/mock_exported_object.h"
@@ -72,12 +73,13 @@ class MockTest : public testing::Test {
MessageReader reader(response);
ASSERT_TRUE(reader.PopString(&response_string_));
}
- message_loop_.Quit();
+ run_loop_->Quit();
};
protected:
std::string response_string_;
base::MessageLoop message_loop_;
+ scoped_ptr<base::RunLoop> run_loop_;
scoped_refptr<MockBus> mock_bus_;
scoped_refptr<MockObjectProxy> mock_proxy_;
@@ -169,12 +171,13 @@ TEST_F(MockTest, CallMethod) {
writer.AppendString(kHello);
// Call the method.
+ run_loop_.reset(new base::RunLoop);
proxy->CallMethod(&method_call,
ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&MockTest::OnResponse,
base::Unretained(this)));
// Run the message loop to let OnResponse be called.
- message_loop_.Run();
+ run_loop_->Run();
EXPECT_EQ(kHello, response_string_);
}
« no previous file with comments | « dbus/end_to_end_async_unittest.cc ('k') | dbus/object_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698