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 // 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 // ... now use metadb_.directory() to get at syncable::Entry objects ... | 25 // ... now use metadb_.directory() to get at syncable::Entry objects ... |
26 // } | 26 // } |
27 // | 27 // |
28 | 28 |
29 #ifndef CHROME_BROWSER_SYNC_TEST_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ | 29 #ifndef SYNC_TEST_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ |
30 #define CHROME_BROWSER_SYNC_TEST_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ | 30 #define SYNC_TEST_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ |
31 #pragma once | 31 #pragma once |
32 | 32 |
33 #include <string> | 33 #include <string> |
34 | 34 |
35 #include "base/basictypes.h" | 35 #include "base/basictypes.h" |
36 #include "base/compiler_specific.h" | 36 #include "base/compiler_specific.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/internal_api/includes/test_unrecoverable_error_han
dler.h" | 39 #include "sync/util/test_unrecoverable_error_handler.h" |
40 #include "chrome/browser/sync/syncable/syncable.h" | 40 #include "sync/syncable/syncable.h" |
41 #include "chrome/browser/sync/test/fake_encryptor.h" | 41 #include "sync/test/fake_encryptor.h" |
42 #include "chrome/browser/sync/test/null_directory_change_delegate.h" | 42 #include "sync/test/null_directory_change_delegate.h" |
43 #include "testing/gmock/include/gmock/gmock.h" | 43 #include "testing/gmock/include/gmock/gmock.h" |
44 | 44 |
45 namespace browser_sync { | 45 namespace browser_sync { |
46 | 46 |
47 class TestDirectorySetterUpper { | 47 class TestDirectorySetterUpper { |
48 public: | 48 public: |
49 TestDirectorySetterUpper(); | 49 TestDirectorySetterUpper(); |
50 virtual ~TestDirectorySetterUpper(); | 50 virtual ~TestDirectorySetterUpper(); |
51 | 51 |
52 // Create a Directory instance open it. | 52 // Create a Directory instance open it. |
(...skipping 16 matching lines...) Expand all Loading... |
69 ScopedTempDir temp_dir_; | 69 ScopedTempDir temp_dir_; |
70 FakeEncryptor encryptor_; | 70 FakeEncryptor encryptor_; |
71 scoped_ptr<syncable::Directory> directory_; | 71 scoped_ptr<syncable::Directory> directory_; |
72 std::string name_; | 72 std::string name_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(TestDirectorySetterUpper); | 74 DISALLOW_COPY_AND_ASSIGN(TestDirectorySetterUpper); |
75 }; | 75 }; |
76 | 76 |
77 } // namespace browser_sync | 77 } // namespace browser_sync |
78 | 78 |
79 #endif // CHROME_BROWSER_SYNC_TEST_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ | 79 #endif // SYNC_TEST_ENGINE_TEST_DIRECTORY_SETTER_UPPER_H_ |
OLD | NEW |