summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 20:43:10 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 20:43:10 +0000
commit5bba4dd3a7ad928f6c8a58aea8d716605eec285a (patch)
treed0c0d09ac2c3a7fb4e018fb7a9ec27c604368014 /chrome/browser
parent3bec852e947f05de1516ef67c39e83881e3a8e2b (diff)
downloadchromium_src-5bba4dd3a7ad928f6c8a58aea8d716605eec285a.zip
chromium_src-5bba4dd3a7ad928f6c8a58aea8d716605eec285a.tar.gz
chromium_src-5bba4dd3a7ad928f6c8a58aea8d716605eec285a.tar.bz2
Fixed memory leak in sync notifier unit tests caused by my previous CL.
BUG=78786 TEST=Valgrind bots Review URL: http://codereview.chromium.org/6810039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80983 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/sync/glue/sync_backend_host_unittest.cc10
-rw-r--r--chrome/browser/sync/notifier/non_blocking_invalidation_notifier_unittest.cc8
-rw-r--r--chrome/browser/sync/profile_sync_service_autofill_unittest.cc7
-rw-r--r--chrome/browser/sync/profile_sync_service_password_unittest.cc7
-rw-r--r--chrome/browser/sync/profile_sync_service_preference_unittest.cc7
-rw-r--r--chrome/browser/sync/profile_sync_service_session_unittest.cc8
-rw-r--r--chrome/browser/sync/profile_sync_service_startup_unittest.cc8
-rw-r--r--chrome/browser/sync/profile_sync_service_typed_url_unittest.cc7
-rw-r--r--chrome/browser/sync/profile_sync_service_unittest.cc8
9 files changed, 62 insertions, 8 deletions
diff --git a/chrome/browser/sync/glue/sync_backend_host_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_unittest.cc
index 60d4ea3..77a0139 100644
--- a/chrome/browser/sync/glue/sync_backend_host_unittest.cc
+++ b/chrome/browser/sync/glue/sync_backend_host_unittest.cc
@@ -76,6 +76,16 @@ TEST_F(SyncBackendHostTest, InitShutdown) {
credentials,
true);
backend.Shutdown(false);
+ // Scoping for io_thread to get destroyed before other locals.
+ {
+ // The request context gets deleted on the I/O thread. To prevent a leak
+ // supply one here.
+ // TODO(sanjeevr): Investigate whether we can do this within
+ // ResetRequestContext
+ BrowserThread io_thread(BrowserThread::IO, MessageLoop::current());
+ profile.ResetRequestContext();
+ }
+ MessageLoop::current()->RunAllPending();
}
TEST_F(SyncBackendHostTest, MakePendingConfigModeState) {
diff --git a/chrome/browser/sync/notifier/non_blocking_invalidation_notifier_unittest.cc b/chrome/browser/sync/notifier/non_blocking_invalidation_notifier_unittest.cc
index 87405d9..5fec4ee 100644
--- a/chrome/browser/sync/notifier/non_blocking_invalidation_notifier_unittest.cc
+++ b/chrome/browser/sync/notifier/non_blocking_invalidation_notifier_unittest.cc
@@ -41,7 +41,13 @@ class NonBlockingInvalidationNotifierTest : public testing::Test {
virtual void TearDown() {
invalidation_notifier_->RemoveObserver(&mock_observer_);
invalidation_notifier_.reset();
- request_context_getter_ = NULL;
+ {
+ // The request context getter gets deleted on the I/O thread. To prevent a
+ // leak supply one here.
+ BrowserThread io_thread(BrowserThread::IO, MessageLoop::current());
+ request_context_getter_ = NULL;
+ }
+ MessageLoop::current()->RunAllPending();
}
MessageLoop message_loop_;
diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
index 889c33f..a7b0e36 100644
--- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
@@ -286,7 +286,12 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
service_.reset();
notification_service_->TearDown();
db_thread_.Stop();
- profile_.ResetRequestContext();
+ {
+ // The request context gets deleted on the I/O thread. To prevent a leak
+ // supply one here.
+ BrowserThread io_thread(BrowserThread::IO, MessageLoop::current());
+ profile_.ResetRequestContext();
+ }
MessageLoop::current()->RunAllPending();
}
diff --git a/chrome/browser/sync/profile_sync_service_password_unittest.cc b/chrome/browser/sync/profile_sync_service_password_unittest.cc
index c00ac4b..2e106c1 100644
--- a/chrome/browser/sync/profile_sync_service_password_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_password_unittest.cc
@@ -161,7 +161,12 @@ class ProfileSyncServicePasswordTest : public AbstractProfileSyncServiceTest {
service_.reset();
notification_service_->TearDown();
db_thread_.Stop();
- profile_.ResetRequestContext();
+ {
+ // The request context gets deleted on the I/O thread. To prevent a leak
+ // supply one here.
+ BrowserThread io_thread(BrowserThread::IO, MessageLoop::current());
+ profile_.ResetRequestContext();
+ }
MessageLoop::current()->RunAllPending();
}
diff --git a/chrome/browser/sync/profile_sync_service_preference_unittest.cc b/chrome/browser/sync/profile_sync_service_preference_unittest.cc
index 98ddfda..eaa1b01 100644
--- a/chrome/browser/sync/profile_sync_service_preference_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_preference_unittest.cc
@@ -61,7 +61,12 @@ class ProfileSyncServicePreferenceTest
virtual void TearDown() {
service_.reset();
- profile_.reset();
+ {
+ // The request context gets deleted on the I/O thread. To prevent a leak
+ // supply one here.
+ BrowserThread io_thread(BrowserThread::IO, MessageLoop::current());
+ profile_.reset();
+ }
MessageLoop::current()->RunAllPending();
}
diff --git a/chrome/browser/sync/profile_sync_service_session_unittest.cc b/chrome/browser/sync/profile_sync_service_session_unittest.cc
index 62ec5f2..87aa5ad 100644
--- a/chrome/browser/sync/profile_sync_service_session_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_session_unittest.cc
@@ -93,7 +93,13 @@ class ProfileSyncServiceSessionTest
helper_.set_service(NULL);
profile()->set_session_service(NULL);
sync_service_.reset();
- profile()->ResetRequestContext();
+ {
+ // The request context gets deleted on the I/O thread. To prevent a leak
+ // supply one here.
+ BrowserThread io_thread(BrowserThread::IO, MessageLoop::current());
+ profile()->ResetRequestContext();
+ }
+ MessageLoop::current()->RunAllPending();
}
bool StartSyncService(Task* task, bool will_fail_association) {
diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc
index 04b2b64..f8c9997 100644
--- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc
@@ -65,7 +65,13 @@ class ProfileSyncServiceStartupTest : public testing::Test {
virtual void TearDown() {
service_->RemoveObserver(&observer_);
- profile_.ResetRequestContext();
+ {
+ // The request context gets deleted on the I/O thread. To prevent a leak
+ // supply one here.
+ BrowserThread io_thread(BrowserThread::IO, MessageLoop::current());
+ profile_.ResetRequestContext();
+ }
+ MessageLoop::current()->RunAllPending();
}
protected:
diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
index e384a73..7125cce 100644
--- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
@@ -149,7 +149,12 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest {
service_.reset();
notification_service_->TearDown();
history_thread_.Stop();
- profile_.ResetRequestContext();
+ {
+ // The request context gets deleted on the I/O thread. To prevent a leak
+ // supply one here.
+ BrowserThread io_thread(BrowserThread::IO, MessageLoop::current());
+ profile_.ResetRequestContext();
+ }
MessageLoop::current()->RunAllPending();
}
diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc
index 5db3ea9..9d7406e 100644
--- a/chrome/browser/sync/profile_sync_service_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_unittest.cc
@@ -53,7 +53,13 @@ class ProfileSyncServiceTest : public testing::Test {
profile_->CreateRequestContext();
}
virtual void TearDown() {
- profile_->ResetRequestContext();
+ {
+ // The request context gets deleted on the I/O thread. To prevent a leak
+ // supply one here.
+ BrowserThread io_thread(BrowserThread::IO, MessageLoop::current());
+ profile_->ResetRequestContext();
+ }
+ MessageLoop::current()->RunAllPending();
}
// TODO(akalin): Refactor the StartSyncService*() functions below.