OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/sync/test/engine/test_directory_setter_upper.h" | 5 #include "components/sync/test/engine/test_directory_setter_upper.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "components/sync/syncable/directory.h" | 10 #include "components/sync/syncable/directory.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 directory_.reset(new syncable::Directory( | 29 directory_.reset(new syncable::Directory( |
30 new syncable::InMemoryDirectoryBackingStore(name_), | 30 new syncable::InMemoryDirectoryBackingStore(name_), |
31 MakeWeakHandle(handler_.GetWeakPtr()), base::Closure(), | 31 MakeWeakHandle(handler_.GetWeakPtr()), base::Closure(), |
32 &encryption_handler_, encryption_handler_.cryptographer())); | 32 &encryption_handler_, encryption_handler_.cryptographer())); |
33 ASSERT_EQ(syncable::OPENED, | 33 ASSERT_EQ(syncable::OPENED, |
34 directory_->Open(name_, &delegate_, transaction_observer)); | 34 directory_->Open(name_, &delegate_, transaction_observer)); |
35 } | 35 } |
36 | 36 |
37 void TestDirectorySetterUpper::SetUpWith( | 37 void TestDirectorySetterUpper::SetUpWith( |
38 syncer::syncable::DirectoryBackingStore* directory_store) { | 38 syncable::DirectoryBackingStore* directory_store) { |
39 CHECK(directory_store); | 39 CHECK(directory_store); |
40 test_transaction_observer_.reset(new syncable::TestTransactionObserver()); | 40 test_transaction_observer_.reset(new syncable::TestTransactionObserver()); |
41 WeakHandle<syncable::TransactionObserver> transaction_observer = | 41 WeakHandle<syncable::TransactionObserver> transaction_observer = |
42 MakeWeakHandle(test_transaction_observer_->AsWeakPtr()); | 42 MakeWeakHandle(test_transaction_observer_->AsWeakPtr()); |
43 | 43 |
44 directory_.reset(new syncable::Directory( | 44 directory_.reset(new syncable::Directory( |
45 directory_store, MakeWeakHandle(handler_.GetWeakPtr()), base::Closure(), | 45 directory_store, MakeWeakHandle(handler_.GetWeakPtr()), base::Closure(), |
46 &encryption_handler_, encryption_handler_.cryptographer())); | 46 &encryption_handler_, encryption_handler_.cryptographer())); |
47 ASSERT_EQ(syncable::OPENED, | 47 ASSERT_EQ(syncable::OPENED, |
48 directory_->Open(name_, &delegate_, transaction_observer)); | 48 directory_->Open(name_, &delegate_, transaction_observer)); |
(...skipping 14 matching lines...) Expand all Loading... |
63 void TestDirectorySetterUpper::RunInvariantCheck() { | 63 void TestDirectorySetterUpper::RunInvariantCheck() { |
64 // Check invariants for all items. | 64 // Check invariants for all items. |
65 syncable::ReadTransaction trans(FROM_HERE, directory()); | 65 syncable::ReadTransaction trans(FROM_HERE, directory()); |
66 | 66 |
67 // The TestUnrecoverableErrorHandler that this directory was constructed with | 67 // The TestUnrecoverableErrorHandler that this directory was constructed with |
68 // will handle error reporting, so we can safely ignore the return value. | 68 // will handle error reporting, so we can safely ignore the return value. |
69 directory()->FullyCheckTreeInvariants(&trans); | 69 directory()->FullyCheckTreeInvariants(&trans); |
70 } | 70 } |
71 | 71 |
72 } // namespace syncer | 72 } // namespace syncer |
OLD | NEW |