| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 public: | 109 public: |
| 110 class Manager : public syncable::DirectoryManager { | 110 class Manager : public syncable::DirectoryManager { |
| 111 public: | 111 public: |
| 112 Manager(const FilePath& root_path, syncable::Directory* dir); | 112 Manager(const FilePath& root_path, syncable::Directory* dir); |
| 113 virtual ~Manager() { managed_directory_ = NULL; } | 113 virtual ~Manager() { managed_directory_ = NULL; } |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 class MockDirectory : public syncable::Directory { | 116 class MockDirectory : public syncable::Directory { |
| 117 public: | 117 public: |
| 118 explicit MockDirectory(const std::string& name); | 118 explicit MockDirectory(const std::string& name); |
| 119 virtual ~MockDirectory() {} | 119 virtual ~MockDirectory(); |
| 120 MOCK_METHOD1(PurgeEntriesWithTypeIn, void(const syncable::ModelTypeSet&)); | 120 MOCK_METHOD1(PurgeEntriesWithTypeIn, void(const syncable::ModelTypeSet&)); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 MockDirectorySetterUpper(); | 123 MockDirectorySetterUpper(); |
| 124 | 124 |
| 125 virtual void SetUp(); | 125 virtual void SetUp(); |
| 126 virtual void TearDown(); | 126 virtual void TearDown(); |
| 127 MockDirectory* directory() { return directory_.get(); } | 127 MockDirectory* directory() { return directory_.get(); } |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 scoped_ptr<MockDirectory> directory_; | 130 scoped_ptr<MockDirectory> directory_; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 } // namespace browser_sync | 133 } // namespace browser_sync |
| 134 | 134 |
| 135 #endif // CHROME_TEST_SYNC_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ | 135 #endif // CHROME_TEST_SYNC_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ |
| OLD | NEW |