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 #include "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/files/scoped_temp_dir.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/scoped_temp_dir.h" | |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "sql/connection.h" | 15 #include "sql/connection.h" |
16 #include "sql/statement.h" | 16 #include "sql/statement.h" |
17 #include "sync/internal_api/public/base/node_ordinal.h" | 17 #include "sync/internal_api/public/base/node_ordinal.h" |
18 #include "sync/protocol/bookmark_specifics.pb.h" | 18 #include "sync/protocol/bookmark_specifics.pb.h" |
19 #include "sync/protocol/sync.pb.h" | 19 #include "sync/protocol/sync.pb.h" |
20 #include "sync/syncable/directory_backing_store.h" | 20 #include "sync/syncable/directory_backing_store.h" |
21 #include "sync/syncable/on_disk_directory_backing_store.h" | 21 #include "sync/syncable/on_disk_directory_backing_store.h" |
22 #include "sync/syncable/syncable-inl.h" | 22 #include "sync/syncable/syncable-inl.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 SetUpVersion77Database(connection); // Prepopulates data. | 72 SetUpVersion77Database(connection); // Prepopulates data. |
73 scoped_ptr<TestDirectoryBackingStore> dbs( | 73 scoped_ptr<TestDirectoryBackingStore> dbs( |
74 new TestDirectoryBackingStore(GetUsername(), connection)); | 74 new TestDirectoryBackingStore(GetUsername(), connection)); |
75 | 75 |
76 ASSERT_TRUE(LoadAndIgnoreReturnedData(dbs.get())); | 76 ASSERT_TRUE(LoadAndIgnoreReturnedData(dbs.get())); |
77 ASSERT_FALSE(dbs->needs_column_refresh_); | 77 ASSERT_FALSE(dbs->needs_column_refresh_); |
78 ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion()); | 78 ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion()); |
79 } | 79 } |
80 | 80 |
81 private: | 81 private: |
82 ScopedTempDir temp_dir_; | 82 base::ScopedTempDir temp_dir_; |
83 }; | 83 }; |
84 | 84 |
85 class DirectoryBackingStoreTest : public MigrationTest {}; | 85 class DirectoryBackingStoreTest : public MigrationTest {}; |
86 | 86 |
87 #if defined(OS_WIN) | 87 #if defined(OS_WIN) |
88 | 88 |
89 // On Windows, we used to store timestamps in FILETIME format. | 89 // On Windows, we used to store timestamps in FILETIME format. |
90 #define LEGACY_META_PROTO_TIMES_1 129079956640320000LL | 90 #define LEGACY_META_PROTO_TIMES_1 129079956640320000LL |
91 #define LEGACY_META_PROTO_TIMES_2 128976886618480000LL | 91 #define LEGACY_META_PROTO_TIMES_2 128976886618480000LL |
92 #define LEGACY_META_PROTO_TIMES_4 129002163642690000LL | 92 #define LEGACY_META_PROTO_TIMES_4 129002163642690000LL |
(...skipping 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2897 const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID(); | 2897 const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID(); |
2898 EXPECT_EQ(24U, guid1.size()); | 2898 EXPECT_EQ(24U, guid1.size()); |
2899 EXPECT_EQ(24U, guid2.size()); | 2899 EXPECT_EQ(24U, guid2.size()); |
2900 // In theory this test can fail, but it won't before the universe | 2900 // In theory this test can fail, but it won't before the universe |
2901 // dies of heat death. | 2901 // dies of heat death. |
2902 EXPECT_NE(guid1, guid2); | 2902 EXPECT_NE(guid1, guid2); |
2903 } | 2903 } |
2904 | 2904 |
2905 } // namespace syncable | 2905 } // namespace syncable |
2906 } // namespace syncer | 2906 } // namespace syncer |
OLD | NEW |