| 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());
|
| }
|
|
|