| 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 17 matching lines...) Expand all Loading... |
| 28 // | 28 // |
| 29 | 29 |
| 30 #ifndef SYNC_INTERNAL_API_PUBLIC_TEST_TEST_USER_SHARE_H_ | 30 #ifndef SYNC_INTERNAL_API_PUBLIC_TEST_TEST_USER_SHARE_H_ |
| 31 #define SYNC_INTERNAL_API_PUBLIC_TEST_TEST_USER_SHARE_H_ | 31 #define SYNC_INTERNAL_API_PUBLIC_TEST_TEST_USER_SHARE_H_ |
| 32 | 32 |
| 33 #include "base/basictypes.h" | 33 #include "base/basictypes.h" |
| 34 #include "sync/internal_api/public/user_share.h" | 34 #include "sync/internal_api/public/user_share.h" |
| 35 | 35 |
| 36 namespace syncer { | 36 namespace syncer { |
| 37 | 37 |
| 38 class SyncEncryptionHandler; |
| 39 |
| 38 class TestDirectorySetterUpper; | 40 class TestDirectorySetterUpper; |
| 39 | 41 |
| 40 class TestUserShare { | 42 class TestUserShare { |
| 41 public: | 43 public: |
| 42 TestUserShare(); | 44 TestUserShare(); |
| 43 ~TestUserShare(); | 45 ~TestUserShare(); |
| 44 | 46 |
| 45 // Sets up the UserShare instance. Clears any existing database | 47 // Sets up the UserShare instance. Clears any existing database |
| 46 // backing files that might exist on disk. | 48 // backing files that might exist on disk. |
| 47 void SetUp(); | 49 void SetUp(); |
| 48 | 50 |
| 49 // Undo everything done by SetUp(): closes the UserShare and deletes | 51 // Undo everything done by SetUp(): closes the UserShare and deletes |
| 50 // the backing files. Before closing the directory, this will run | 52 // the backing files. Before closing the directory, this will run |
| 51 // the directory invariant checks and perform the SaveChanges action | 53 // the directory invariant checks and perform the SaveChanges action |
| 52 // on the user share's directory. | 54 // on the user share's directory. |
| 53 void TearDown(); | 55 void TearDown(); |
| 54 | 56 |
| 55 // Non-NULL iff called between a call to SetUp() and TearDown(). | 57 // Non-NULL iff called between a call to SetUp() and TearDown(). |
| 56 UserShare* user_share(); | 58 UserShare* user_share(); |
| 57 | 59 |
| 60 // Sync's encryption handler. Used by tests to invoke the sync encryption |
| 61 // methods normally handled via the SyncBackendHost |
| 62 SyncEncryptionHandler* encryption_handler(); |
| 63 |
| 58 private: | 64 private: |
| 59 scoped_ptr<TestDirectorySetterUpper> dir_maker_; | 65 scoped_ptr<TestDirectorySetterUpper> dir_maker_; |
| 60 scoped_ptr<UserShare> user_share_; | 66 scoped_ptr<UserShare> user_share_; |
| 61 | 67 |
| 62 DISALLOW_COPY_AND_ASSIGN(TestUserShare); | 68 DISALLOW_COPY_AND_ASSIGN(TestUserShare); |
| 63 }; | 69 }; |
| 64 | 70 |
| 65 } // namespace syncer | 71 } // namespace syncer |
| 66 | 72 |
| 67 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_TEST_USER_SHARE_H_ | 73 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_TEST_USER_SHARE_H_ |
| OLD | NEW |