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
3 // found in the LICENSE file.
5 #ifndef SYNC_TEST_TEST_DIRECTORY_BACKING_STORE_H_
6 #define SYNC_TEST_TEST_DIRECTORY_BACKING_STORE_H_
8 #include "base/gtest_prod_util.h"
9 #include "sync/syncable/directory_backing_store.h"
14 // This implementation of DirectoryBackingStore does not manage its own
15 // database. This makes it more flexible (and more complex) than the
16 // InMemoryDirectoryBackingStore.
17 class TestDirectoryBackingStore
: public DirectoryBackingStore
{
19 // This constructor takes a handle to a database. The caller maintains
20 // ownership of this handle.
22 // This is very brittle. You should not be using this class or this
23 // constructor unless you understand and intend to test the
24 // DirectoryBackingStore's internals.
25 TestDirectoryBackingStore(const std::string
& dir_name
,
26 sql::Connection
* connection
);
27 virtual ~TestDirectoryBackingStore();
28 virtual DirOpenResult
Load(
29 Directory::MetahandlesMap
* handles_map
,
30 JournalIndex
* delete_journals
,
31 Directory::KernelLoadInfo
* kernel_load_info
) OVERRIDE
;
33 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion67To68
);
34 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion68To69
);
35 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion69To70
);
36 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion70To71
);
37 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion71To72
);
38 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion72To73
);
39 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion73To74
);
40 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion74To75
);
41 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion75To76
);
42 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion76To77
);
43 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion77To78
);
44 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion78To79
);
45 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion79To80
);
46 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion80To81
);
47 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion81To82
);
48 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion82To83
);
49 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion83To84
);
50 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion84To85
);
51 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, MigrateVersion85To86
);
52 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, DetectInvalidPosition
);
53 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, ModelTypeIds
);
54 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, Corruption
);
55 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, DeleteEntries
);
56 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest
, GenerateCacheGUID
);
57 FRIEND_TEST_ALL_PREFIXES(MigrationTest
, ToCurrentVersion
);
58 friend class MigrationTest
;
61 } // namespace syncable
64 #endif // SYNC_TEST_TEST_DIRECTORY_BACKING_STORE_H_