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

Unified Diff: sync/syncable/directory_unittest.cc

Issue 1275743002: [Sync] Remove backend unrecoverable error handler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix leak Created 5 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
« no previous file with comments | « sync/syncable/directory_unittest.h ('k') | sync/syncable/syncable_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/directory_unittest.cc
diff --git a/sync/syncable/directory_unittest.cc b/sync/syncable/directory_unittest.cc
index 34e5af7891a142f2623bdbafe7c4e4713a677bb4..198e534999be4345f87d6bf310722d476234845d 100644
--- a/sync/syncable/directory_unittest.cc
+++ b/sync/syncable/directory_unittest.cc
@@ -4,6 +4,7 @@
#include "sync/syncable/directory_unittest.h"
+#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/values_test_util.h"
#include "sync/internal_api/public/base/attachment_id_proto.h"
@@ -73,9 +74,9 @@ DirOpenResult SyncableDirectoryTest::ReopenDirectory() {
// Use a TestDirectoryBackingStore and sql::Connection so we can have test
// data persist across Directory object lifetimes while getting the
// performance benefits of not writing to disk.
- dir_.reset(
- new Directory(new TestDirectoryBackingStore(kDirectoryName, &connection_),
- &handler_, base::Closure(), NULL, NULL));
+ dir_.reset(new Directory(
+ new TestDirectoryBackingStore(kDirectoryName, &connection_),
+ MakeWeakHandle(handler_.GetWeakPtr()), base::Closure(), NULL, NULL));
DirOpenResult open_result =
dir_->Open(kDirectoryName, &delegate_, NullTransactionObserver());
@@ -204,7 +205,8 @@ Encryptor* SyncableDirectoryTest::encryptor() {
return &encryptor_;
}
-UnrecoverableErrorHandler*
+
+TestUnrecoverableErrorHandler*
SyncableDirectoryTest::unrecoverable_error_handler() {
return &handler_;
}
@@ -2037,8 +2039,8 @@ TEST_F(SyncableDirectoryTest, SaveChangesSnapshot_HasUnsavedMetahandleChanges) {
TEST_F(SyncableDirectoryTest, CatastrophicError) {
MockUnrecoverableErrorHandler unrecoverable_error_handler;
Directory dir(new InMemoryDirectoryBackingStore("catastrophic_error"),
- &unrecoverable_error_handler, base::Closure(), nullptr,
- nullptr);
+ MakeWeakHandle(unrecoverable_error_handler.GetWeakPtr()),
+ base::Closure(), nullptr, nullptr);
ASSERT_EQ(OPENED, dir.Open(kDirectoryName, directory_change_delegate(),
NullTransactionObserver()));
ASSERT_EQ(0, unrecoverable_error_handler.invocation_count());
@@ -2048,6 +2050,8 @@ TEST_F(SyncableDirectoryTest, CatastrophicError) {
dir.OnCatastrophicError();
dir.OnCatastrophicError();
+ base::RunLoop().RunUntilIdle();
+
// See that the unrecoverable error handler has been invoked twice.
ASSERT_EQ(2, unrecoverable_error_handler.invocation_count());
}
« no previous file with comments | « sync/syncable/directory_unittest.h ('k') | sync/syncable/syncable_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698