| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // A handy class that takes care of setting up and destroying a | 5 // A handy class that takes care of setting up and destroying a |
| 6 // UserShare instance for unit tests that require one. | 6 // UserShare instance for unit tests that require one. |
| 7 // | 7 // |
| 8 // The expected usage is to make this a component of your test fixture: | 8 // The expected usage is to make this a component of your test fixture: |
| 9 // | 9 // |
| 10 // class AwesomenessTest : public testing::Test { | 10 // class AwesomenessTest : public testing::Test { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 // Undo everything done by SetUp(): closes the UserShare and deletes | 59 // Undo everything done by SetUp(): closes the UserShare and deletes |
| 60 // the backing files. Before closing the directory, this will run | 60 // the backing files. Before closing the directory, this will run |
| 61 // the directory invariant checks and perform the SaveChanges action | 61 // the directory invariant checks and perform the SaveChanges action |
| 62 // on the user share's directory. | 62 // on the user share's directory. |
| 63 void TearDown(); | 63 void TearDown(); |
| 64 | 64 |
| 65 // Save and reload Directory to clear out temporary data in memory. | 65 // Save and reload Directory to clear out temporary data in memory. |
| 66 bool Reload(); | 66 bool Reload(); |
| 67 | 67 |
| 68 // Non-NULL iff called between a call to SetUp() and TearDown(). | 68 // Non-null iff called between a call to SetUp() and TearDown(). |
| 69 UserShare* user_share(); | 69 UserShare* user_share(); |
| 70 | 70 |
| 71 // Sync's encryption handler. Used by tests to invoke the sync encryption | 71 // Sync's encryption handler. Used by tests to invoke the sync encryption |
| 72 // methods normally handled via the SyncBackendHost | 72 // methods normally handled via the SyncBackendHost |
| 73 SyncEncryptionHandler* encryption_handler(); | 73 SyncEncryptionHandler* encryption_handler(); |
| 74 | 74 |
| 75 // Returns the directory's transaction observer. This transaction observer | 75 // Returns the directory's transaction observer. This transaction observer |
| 76 // has methods which can be helpful when writing test assertions. | 76 // has methods which can be helpful when writing test assertions. |
| 77 syncable::TestTransactionObserver* transaction_observer(); | 77 syncable::TestTransactionObserver* transaction_observer(); |
| 78 | 78 |
| 79 // A helper function to pretend to download this type's root node. | 79 // A helper function to pretend to download this type's root node. |
| 80 static bool CreateRoot(ModelType model_type, UserShare* service); | 80 static bool CreateRoot(ModelType model_type, UserShare* service); |
| 81 | 81 |
| 82 size_t GetDeleteJournalSize() const; | 82 size_t GetDeleteJournalSize() const; |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 std::unique_ptr<TestDirectorySetterUpper> dir_maker_; | 85 std::unique_ptr<TestDirectorySetterUpper> dir_maker_; |
| 86 std::unique_ptr<UserShare> user_share_; | 86 std::unique_ptr<UserShare> user_share_; |
| 87 | 87 |
| 88 DISALLOW_COPY_AND_ASSIGN(TestUserShare); | 88 DISALLOW_COPY_AND_ASSIGN(TestUserShare); |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 } // namespace syncer | 91 } // namespace syncer |
| 92 | 92 |
| 93 #endif // COMPONENTS_SYNC_SYNCABLE_TEST_USER_SHARE_H_ | 93 #endif // COMPONENTS_SYNC_SYNCABLE_TEST_USER_SHARE_H_ |
| OLD | NEW |