OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/sync/syncable/directory_backing_store.h" | 5 #include "components/sync/syncable/directory_backing_store.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/files/scoped_temp_dir.h" | 15 #include "base/files/scoped_temp_dir.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
22 #include "components/sync/base/node_ordinal.h" | 22 #include "components/sync/base/node_ordinal.h" |
23 #include "components/sync/base/sync_export.h" | |
24 #include "components/sync/base/time.h" | 23 #include "components/sync/base/time.h" |
25 #include "components/sync/protocol/bookmark_specifics.pb.h" | 24 #include "components/sync/protocol/bookmark_specifics.pb.h" |
26 #include "components/sync/protocol/sync.pb.h" | 25 #include "components/sync/protocol/sync.pb.h" |
27 #include "components/sync/syncable/directory.h" | 26 #include "components/sync/syncable/directory.h" |
28 #include "components/sync/syncable/on_disk_directory_backing_store.h" | 27 #include "components/sync/syncable/on_disk_directory_backing_store.h" |
29 #include "components/sync/syncable/syncable-inl.h" | 28 #include "components/sync/syncable/syncable-inl.h" |
30 #include "components/sync/test/directory_backing_store_corruption_testing.h" | 29 #include "components/sync/test/directory_backing_store_corruption_testing.h" |
31 #include "components/sync/test/test_directory_backing_store.h" | 30 #include "components/sync/test/test_directory_backing_store.h" |
32 #include "sql/connection.h" | 31 #include "sql/connection.h" |
33 #include "sql/statement.h" | 32 #include "sql/statement.h" |
(...skipping 15 matching lines...) Expand all Loading... |
49 std::unique_ptr<EntryKernel> entry(new EntryKernel()); | 48 std::unique_ptr<EntryKernel> entry(new EntryKernel()); |
50 std::string id_string = base::Int64ToString(id) + id_suffix; | 49 std::string id_string = base::Int64ToString(id) + id_suffix; |
51 entry->put(ID, Id::CreateFromClientString(id_string)); | 50 entry->put(ID, Id::CreateFromClientString(id_string)); |
52 entry->put(META_HANDLE, id); | 51 entry->put(META_HANDLE, id); |
53 entry->mark_dirty(NULL); | 52 entry->mark_dirty(NULL); |
54 return entry; | 53 return entry; |
55 } | 54 } |
56 | 55 |
57 } // namespace | 56 } // namespace |
58 | 57 |
59 SYNC_EXPORT extern const int32_t kCurrentPageSizeKB; | 58 extern const int32_t kCurrentPageSizeKB; |
60 SYNC_EXPORT extern const int32_t kCurrentDBVersion; | 59 extern const int32_t kCurrentDBVersion; |
61 | 60 |
62 class MigrationTest : public testing::TestWithParam<int> { | 61 class MigrationTest : public testing::TestWithParam<int> { |
63 public: | 62 public: |
64 void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } | 63 void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } |
65 | 64 |
66 protected: | 65 protected: |
67 std::string GetUsername() { | 66 std::string GetUsername() { |
68 return "nick@chromium.org"; | 67 return "nick@chromium.org"; |
69 } | 68 } |
70 | 69 |
(...skipping 4193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4264 ASSERT_FALSE(dbs->SaveChanges(snapshot)); | 4263 ASSERT_FALSE(dbs->SaveChanges(snapshot)); |
4265 // At this point the handler has been posted but not executed. | 4264 // At this point the handler has been posted but not executed. |
4266 ASSERT_FALSE(was_called); | 4265 ASSERT_FALSE(was_called); |
4267 // Pump the message loop and see that it is executed. | 4266 // Pump the message loop and see that it is executed. |
4268 base::RunLoop().RunUntilIdle(); | 4267 base::RunLoop().RunUntilIdle(); |
4269 ASSERT_TRUE(was_called); | 4268 ASSERT_TRUE(was_called); |
4270 } | 4269 } |
4271 | 4270 |
4272 } // namespace syncable | 4271 } // namespace syncable |
4273 } // namespace syncer | 4272 } // namespace syncer |
OLD | NEW |