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 "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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3155 TEST_F(DirectoryBackingStoreTest, MigrateVersion76To77) { | 3155 TEST_F(DirectoryBackingStoreTest, MigrateVersion76To77) { |
3156 sql::Connection connection; | 3156 sql::Connection connection; |
3157 ASSERT_TRUE(connection.OpenInMemory()); | 3157 ASSERT_TRUE(connection.OpenInMemory()); |
3158 SetUpVersion76Database(&connection); | 3158 SetUpVersion76Database(&connection); |
3159 | 3159 |
3160 scoped_ptr<TestDirectoryBackingStore> dbs( | 3160 scoped_ptr<TestDirectoryBackingStore> dbs( |
3161 new TestDirectoryBackingStore(GetUsername(), &connection)); | 3161 new TestDirectoryBackingStore(GetUsername(), &connection)); |
3162 ASSERT_FALSE(dbs->needs_column_refresh()); | 3162 ASSERT_FALSE(dbs->needs_column_refresh()); |
3163 | 3163 |
3164 EXPECT_EQ(GetExpectedLegacyMetaProtoTimes(INCLUDE_DELETED_ITEMS), | 3164 EXPECT_EQ(GetExpectedLegacyMetaProtoTimes(INCLUDE_DELETED_ITEMS), |
3165 GetMetaProtoTimes(dbs->db_.get())); | 3165 GetMetaProtoTimes(&connection)); |
3166 // Since the proto times are expected to be in a legacy format, they may not | 3166 // Since the proto times are expected to be in a legacy format, they may not |
3167 // be compatible with ProtoTimeToTime, so we don't call ExpectTimes(). | 3167 // be compatible with ProtoTimeToTime, so we don't call ExpectTimes(). |
3168 | 3168 |
3169 ASSERT_TRUE(dbs->MigrateVersion76To77()); | 3169 ASSERT_TRUE(dbs->MigrateVersion76To77()); |
3170 ASSERT_EQ(77, dbs->GetVersion()); | 3170 ASSERT_EQ(77, dbs->GetVersion()); |
3171 | 3171 |
3172 EXPECT_EQ(GetExpectedMetaProtoTimes(INCLUDE_DELETED_ITEMS), | 3172 EXPECT_EQ(GetExpectedMetaProtoTimes(INCLUDE_DELETED_ITEMS), |
3173 GetMetaProtoTimes(dbs->db_.get())); | 3173 GetMetaProtoTimes(&connection)); |
3174 // Cannot actually load entries due to version 77 not having all required | 3174 // Cannot actually load entries due to version 77 not having all required |
3175 // columns. | 3175 // columns. |
3176 ASSERT_FALSE(dbs->needs_column_refresh()); | 3176 ASSERT_FALSE(dbs->needs_column_refresh()); |
3177 } | 3177 } |
3178 | 3178 |
3179 TEST_F(DirectoryBackingStoreTest, MigrateVersion77To78) { | 3179 TEST_F(DirectoryBackingStoreTest, MigrateVersion77To78) { |
3180 sql::Connection connection; | 3180 sql::Connection connection; |
3181 ASSERT_TRUE(connection.OpenInMemory()); | 3181 ASSERT_TRUE(connection.OpenInMemory()); |
3182 SetUpVersion77Database(&connection); | 3182 SetUpVersion77Database(&connection); |
3183 | 3183 |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4076 | 4076 |
4077 // At this point the handler has been posted but not executed. | 4077 // At this point the handler has been posted but not executed. |
4078 ASSERT_FALSE(was_called); | 4078 ASSERT_FALSE(was_called); |
4079 // Pump the message loop and see that it is executed. | 4079 // Pump the message loop and see that it is executed. |
4080 base::RunLoop().RunUntilIdle(); | 4080 base::RunLoop().RunUntilIdle(); |
4081 ASSERT_TRUE(was_called); | 4081 ASSERT_TRUE(was_called); |
4082 } | 4082 } |
4083 | 4083 |
4084 } // namespace syncable | 4084 } // namespace syncable |
4085 } // namespace syncer | 4085 } // namespace syncer |
OLD | NEW |