| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // syncable::Directory instance for unit tests that require one. | 6 // syncable::Directory 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 protected: | 61 protected: |
| 62 // Subclasses may want to use a different directory name. | 62 // Subclasses may want to use a different directory name. |
| 63 explicit TestDirectorySetterUpper(const PathString& name); | 63 explicit TestDirectorySetterUpper(const PathString& name); |
| 64 virtual void Init(); | 64 virtual void Init(); |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 void RunInvariantCheck(const syncable::ScopedDirLookup& dir); | 67 void RunInvariantCheck(const syncable::ScopedDirLookup& dir); |
| 68 | 68 |
| 69 scoped_ptr<syncable::DirectoryManager> manager_; | 69 scoped_ptr<syncable::DirectoryManager> manager_; |
| 70 const PathString name_; | 70 const PathString name_; |
| 71 PathString file_path_; | 71 FilePath file_path_; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 // A variant of the above where SetUp does not actually open the directory. | 74 // A variant of the above where SetUp does not actually open the directory. |
| 75 // You must manually invoke Open(). This is useful if you are writing a test | 75 // You must manually invoke Open(). This is useful if you are writing a test |
| 76 // that depends on the DirectoryManager::OPENED event. | 76 // that depends on the DirectoryManager::OPENED event. |
| 77 class ManuallyOpenedTestDirectorySetterUpper : public TestDirectorySetterUpper { | 77 class ManuallyOpenedTestDirectorySetterUpper : public TestDirectorySetterUpper { |
| 78 public: | 78 public: |
| 79 ManuallyOpenedTestDirectorySetterUpper() : was_opened_(false) {} | 79 ManuallyOpenedTestDirectorySetterUpper() : was_opened_(false) {} |
| 80 virtual void SetUp(); | 80 virtual void SetUp(); |
| 81 virtual void TearDown(); | 81 virtual void TearDown(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 92 // as in "real life". In this case, the name that will be used should be | 92 // as in "real life". In this case, the name that will be used should be |
| 93 // deterministically known at construction, and is passed in |name|. | 93 // deterministically known at construction, and is passed in |name|. |
| 94 TriggeredOpenTestDirectorySetterUpper(const std::string& name); | 94 TriggeredOpenTestDirectorySetterUpper(const std::string& name); |
| 95 virtual void SetUp(); | 95 virtual void SetUp(); |
| 96 virtual void TearDown(); | 96 virtual void TearDown(); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 } // namespace browser_sync | 99 } // namespace browser_sync |
| 100 | 100 |
| 101 #endif // CHROME_TEST_SYNC_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ | 101 #endif // CHROME_TEST_SYNC_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ |
| OLD | NEW |