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

Unified Diff: dbus/signal_sender_verification_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: remove MessageLoop::Run() calls everywhere Created 6 years, 4 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
« dbus/end_to_end_async_unittest.cc ('K') | « dbus/property_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/signal_sender_verification_unittest.cc
diff --git a/dbus/signal_sender_verification_unittest.cc b/dbus/signal_sender_verification_unittest.cc
index 9eae3a5638cbe5e0ac266ae2adb7d003fe06b36d..b4b7d4a19001fb14befcf0f2a0f4dbbfccb106ac 100644
--- a/dbus/signal_sender_verification_unittest.cc
+++ b/dbus/signal_sender_verification_unittest.cc
@@ -8,6 +8,7 @@
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_samples.h"
#include "base/metrics/statistics_recorder.h"
+#include "base/run_loop.h"
#include "base/test/test_timeouts.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
@@ -65,7 +66,7 @@ class SignalSenderVerificationTest : public testing::Test {
base::Bind(&SignalSenderVerificationTest::OnConnected,
base::Unretained(this)));
// Wait until the object proxy is connected to the signal.
- message_loop_.Run();
+ base::RunLoop().Run();
// Start the test service, using the D-Bus thread.
TestService::Options options;
@@ -86,7 +87,7 @@ class SignalSenderVerificationTest : public testing::Test {
// The name should be owned and known at this point.
if (!on_name_owner_changed_called_)
- message_loop_.Run();
+ base::RunLoop().Run();
ASSERT_FALSE(latest_name_owner_.empty());
}
@@ -148,7 +149,7 @@ class SignalSenderVerificationTest : public testing::Test {
// Wait for the hey signal to be received.
void WaitForTestSignal() {
// OnTestSignal() will quit the message loop.
- message_loop_.Run();
+ base::RunLoop().Run();
}
// Stopping a thread is considered an IO operation, so we need to fiddle with
@@ -224,7 +225,7 @@ TEST_F(SignalSenderVerificationTest, TestOwnerChanged) {
ASSERT_FALSE(latest_name_owner_.empty());
test_service_->ShutdownAndBlock();
// OnNameOwnerChanged will PostTask to quit the message loop.
- message_loop_.Run();
+ base::RunLoop().Run();
// latest_name_owner_ should be empty as the owner is gone.
ASSERT_TRUE(latest_name_owner_.empty());
@@ -236,9 +237,9 @@ TEST_F(SignalSenderVerificationTest, TestOwnerChanged) {
base::Unretained(this), true));
// Both of OnNameOwnerChanged() and OnOwnership() should quit the MessageLoop,
// but there's no expected order of those 2 event.
- message_loop_.Run();
+ base::RunLoop().Run();
if (!on_name_owner_changed_called_ || !on_ownership_called_)
- message_loop_.Run();
+ base::RunLoop().Run();
ASSERT_TRUE(on_name_owner_changed_called_);
ASSERT_TRUE(on_ownership_called_);
@@ -259,7 +260,7 @@ TEST_F(SignalSenderVerificationTest, TestOwnerStealing) {
ASSERT_FALSE(latest_name_owner_.empty());
test_service_->ShutdownAndBlock();
// OnNameOwnerChanged will PostTask to quit the message loop.
- message_loop_.Run();
+ base::RunLoop().Run();
// latest_name_owner_ should be empty as the owner is gone.
ASSERT_TRUE(latest_name_owner_.empty());
// Reset the flag as NameOwnerChanged is already received in setup.
@@ -276,7 +277,7 @@ TEST_F(SignalSenderVerificationTest, TestOwnerStealing) {
ASSERT_TRUE(stealable_test_service.has_ownership());
// OnNameOwnerChanged will PostTask to quit the message loop.
- message_loop_.Run();
+ base::RunLoop().Run();
// Send a signal to check that the service is correctly owned.
const char kMessage[] = "hello, world";
@@ -295,9 +296,9 @@ TEST_F(SignalSenderVerificationTest, TestOwnerStealing) {
base::Unretained(this), true));
// Both of OnNameOwnerChanged() and OnOwnership() should quit the MessageLoop,
// but there's no expected order of those 2 event.
- message_loop_.Run();
+ base::RunLoop().Run();
if (!on_name_owner_changed_called_ || !on_ownership_called_)
- message_loop_.Run();
+ base::RunLoop().Run();
ASSERT_TRUE(on_name_owner_changed_called_);
ASSERT_TRUE(on_ownership_called_);
@@ -335,7 +336,7 @@ TEST_F(SignalSenderVerificationTest, DISABLED_TestMultipleObjects) {
base::Bind(&SignalSenderVerificationTest::OnConnected,
base::Unretained(this)));
// Wait until the object proxy is connected to the signal.
- message_loop_.Run();
+ base::RunLoop().Run();
// Send the test signal from the exported object.
test_service_->SendTestSignal(kMessage);
@@ -349,7 +350,7 @@ TEST_F(SignalSenderVerificationTest, DISABLED_TestMultipleObjects) {
ASSERT_FALSE(latest_name_owner_.empty());
test_service_->ShutdownAndBlock();
// OnNameOwnerChanged will PostTask to quit the message loop.
- message_loop_.Run();
+ base::RunLoop().Run();
// latest_name_owner_ should be empty as the owner is gone.
ASSERT_TRUE(latest_name_owner_.empty());
@@ -363,7 +364,7 @@ TEST_F(SignalSenderVerificationTest, DISABLED_TestMultipleObjects) {
// but there's no expected order of those 2 event.
while (!on_name_owner_changed_called_ || !second_name_owner_changed_called ||
!on_ownership_called_)
- message_loop_.Run();
+ base::RunLoop().Run();
ASSERT_TRUE(on_name_owner_changed_called_);
ASSERT_TRUE(second_name_owner_changed_called);
ASSERT_TRUE(on_ownership_called_);
« dbus/end_to_end_async_unittest.cc ('K') | « dbus/property_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698