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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Sets up the UserShare instance. Clears any existing database | 51 // Sets up the UserShare instance. Clears any existing database |
52 // backing files that might exist on disk. | 52 // backing files that might exist on disk. |
53 void SetUp(); | 53 void SetUp(); |
54 | 54 |
55 // Undo everything done by SetUp(): closes the UserShare and deletes | 55 // Undo everything done by SetUp(): closes the UserShare and deletes |
56 // the backing files. Before closing the directory, this will run | 56 // the backing files. Before closing the directory, this will run |
57 // the directory invariant checks and perform the SaveChanges action | 57 // the directory invariant checks and perform the SaveChanges action |
58 // on the user share's directory. | 58 // on the user share's directory. |
59 void TearDown(); | 59 void TearDown(); |
60 | 60 |
| 61 // Save and reload Directory to clear out temporary data in memory. |
| 62 bool Reload(); |
| 63 |
61 // Non-NULL iff called between a call to SetUp() and TearDown(). | 64 // Non-NULL iff called between a call to SetUp() and TearDown(). |
62 UserShare* user_share(); | 65 UserShare* user_share(); |
63 | 66 |
64 // Sync's encryption handler. Used by tests to invoke the sync encryption | 67 // Sync's encryption handler. Used by tests to invoke the sync encryption |
65 // methods normally handled via the SyncBackendHost | 68 // methods normally handled via the SyncBackendHost |
66 SyncEncryptionHandler* encryption_handler(); | 69 SyncEncryptionHandler* encryption_handler(); |
67 | 70 |
68 // Returns the directory's transaction observer. This transaction observer | 71 // Returns the directory's transaction observer. This transaction observer |
69 // has methods which can be helpful when writing test assertions. | 72 // has methods which can be helpful when writing test assertions. |
70 syncable::TestTransactionObserver* transaction_observer(); | 73 syncable::TestTransactionObserver* transaction_observer(); |
71 | 74 |
72 // A helper function to pretend to download this type's root node. | 75 // A helper function to pretend to download this type's root node. |
73 static bool CreateRoot(syncer::ModelType model_type, | 76 static bool CreateRoot(syncer::ModelType model_type, |
74 syncer::UserShare* service); | 77 syncer::UserShare* service); |
75 | 78 |
| 79 size_t GetDeleteJournalSize() const; |
| 80 |
76 private: | 81 private: |
77 scoped_ptr<TestDirectorySetterUpper> dir_maker_; | 82 scoped_ptr<TestDirectorySetterUpper> dir_maker_; |
78 scoped_ptr<UserShare> user_share_; | 83 scoped_ptr<UserShare> user_share_; |
79 | 84 |
80 DISALLOW_COPY_AND_ASSIGN(TestUserShare); | 85 DISALLOW_COPY_AND_ASSIGN(TestUserShare); |
81 }; | 86 }; |
82 | 87 |
83 } // namespace syncer | 88 } // namespace syncer |
84 | 89 |
85 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_TEST_USER_SHARE_H_ | 90 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_TEST_USER_SHARE_H_ |
OLD | NEW |