| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 { |
| 11 // public: | 11 // public: |
| 12 // virtual void SetUp() { | 12 // virtual void SetUp() { |
| 13 // metadb_.SetUp(); | 13 // metadb_.SetUp(); |
| 14 // } | 14 // } |
| 15 // virtual void TearDown() { | 15 // virtual void TearDown() { |
| 16 // metadb_.TearDown(); | 16 // metadb_.TearDown(); |
| 17 // } | 17 // } |
| 18 // protected: | 18 // protected: |
| 19 // TestDirectorySetterUpper metadb_; | 19 // TestDirectorySetterUpper metadb_; |
| 20 // }; | 20 // }; |
| 21 // | 21 // |
| 22 // Then, in your tests, get at the directory like so: | 22 // Then, in your tests, get at the directory like so: |
| 23 // | 23 // |
| 24 // TEST_F(AwesomenessTest, IsMaximal) { | 24 // TEST_F(AwesomenessTest, IsMaximal) { |
| 25 // ScopedDirLookup dir(metadb_.manager(), metadb_.name()); | 25 // ScopedDirLookup dir(metadb_.manager(), metadb_.name()); |
| 26 // ... now use |dir| to get at syncable::Entry objects ... | 26 // ... now use |dir| to get at syncable::Entry objects ... |
| 27 // } | 27 // } |
| 28 // | 28 // |
| 29 | 29 |
| 30 #ifndef CHROME_TEST_SYNC_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ | 30 #ifndef CHROME_BROWSER_SYNC_TEST_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ |
| 31 #define CHROME_TEST_SYNC_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ | 31 #define CHROME_BROWSER_SYNC_TEST_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ |
| 32 #pragma once | 32 #pragma once |
| 33 | 33 |
| 34 #include <string> | 34 #include <string> |
| 35 | 35 |
| 36 #include "base/basictypes.h" | 36 #include "base/basictypes.h" |
| 37 #include "base/memory/scoped_ptr.h" | 37 #include "base/memory/scoped_ptr.h" |
| 38 #include "base/scoped_temp_dir.h" | 38 #include "base/scoped_temp_dir.h" |
| 39 #include "chrome/browser/sync/syncable/directory_manager.h" | 39 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 40 #include "chrome/browser/sync/syncable/syncable.h" | 40 #include "chrome/browser/sync/syncable/syncable.h" |
| 41 #include "chrome/test/sync/null_directory_change_delegate.h" | 41 #include "chrome/browser/sync/test/null_directory_change_delegate.h" |
| 42 #include "testing/gmock/include/gmock/gmock.h" | 42 #include "testing/gmock/include/gmock/gmock.h" |
| 43 | 43 |
| 44 namespace syncable { | 44 namespace syncable { |
| 45 class DirectoryManager; | 45 class DirectoryManager; |
| 46 class ScopedDirLookup; | 46 class ScopedDirLookup; |
| 47 } // namespace syncable | 47 } // namespace syncable |
| 48 | 48 |
| 49 namespace browser_sync { | 49 namespace browser_sync { |
| 50 | 50 |
| 51 class TestDirectorySetterUpper { | 51 class TestDirectorySetterUpper { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 virtual void SetUp(); | 134 virtual void SetUp(); |
| 135 virtual void TearDown(); | 135 virtual void TearDown(); |
| 136 MockDirectory* directory() { return directory_.get(); } | 136 MockDirectory* directory() { return directory_.get(); } |
| 137 | 137 |
| 138 private: | 138 private: |
| 139 scoped_ptr<MockDirectory> directory_; | 139 scoped_ptr<MockDirectory> directory_; |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 } // namespace browser_sync | 142 } // namespace browser_sync |
| 143 | 143 |
| 144 #endif // CHROME_TEST_SYNC_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ | 144 #endif // CHROME_BROWSER_SYNC_TEST_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ |
| OLD | NEW |