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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 void StartFailingSaveChanges() { | 185 void StartFailingSaveChanges() { |
186 test_directory_->StartFailingSaveChanges(); | 186 test_directory_->StartFailingSaveChanges(); |
187 } | 187 } |
188 | 188 |
189 TestDirectory *test_directory_; // mirrors scoped_ptr<Directory> dir_ | 189 TestDirectory *test_directory_; // mirrors scoped_ptr<Directory> dir_ |
190 base::ScopedTempDir temp_dir_; | 190 base::ScopedTempDir temp_dir_; |
191 base::FilePath file_path_; | 191 base::FilePath file_path_; |
192 }; | 192 }; |
193 | 193 |
194 sync_pb::DataTypeProgressMarker BuildProgress(ModelType type) { | |
195 sync_pb::DataTypeProgressMarker progress; | |
196 progress.set_token("token"); | |
197 progress.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | |
198 return progress; | |
199 } | |
200 | |
201 sync_pb::DataTypeContext BuildContext(ModelType type) { | 194 sync_pb::DataTypeContext BuildContext(ModelType type) { |
202 sync_pb::DataTypeContext context; | 195 sync_pb::DataTypeContext context; |
203 context.set_context("context"); | 196 context.set_context("context"); |
204 context.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | 197 context.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); |
205 return context; | 198 return context; |
206 } | 199 } |
207 | 200 |
208 TEST_F(OnDiskSyncableDirectoryTest, TestPurgeEntriesWithTypeIn) { | 201 TEST_F(OnDiskSyncableDirectoryTest, TestPurgeEntriesWithTypeIn) { |
209 sync_pb::EntitySpecifics bookmark_specs; | 202 sync_pb::EntitySpecifics bookmark_specs; |
210 sync_pb::EntitySpecifics autofill_specs; | 203 sync_pb::EntitySpecifics autofill_specs; |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 ASSERT_TRUE(kids.good()); | 504 ASSERT_TRUE(kids.good()); |
512 EXPECT_TRUE(kids.GetKernelCopy().is_dirty()); | 505 EXPECT_TRUE(kids.GetKernelCopy().is_dirty()); |
513 EXPECT_TRUE(IsInDirtyMetahandles(handle2)); | 506 EXPECT_TRUE(IsInDirtyMetahandles(handle2)); |
514 EXPECT_TRUE(aguilera.is_dirty()); | 507 EXPECT_TRUE(aguilera.is_dirty()); |
515 EXPECT_TRUE(IsInDirtyMetahandles(handle1)); | 508 EXPECT_TRUE(IsInDirtyMetahandles(handle1)); |
516 } | 509 } |
517 } | 510 } |
518 | 511 |
519 TEST_F(OnDiskSyncableDirectoryTest, TestSaveChangesFailureWithPurge) { | 512 TEST_F(OnDiskSyncableDirectoryTest, TestSaveChangesFailureWithPurge) { |
520 int64 handle1 = 0; | 513 int64 handle1 = 0; |
521 // Set up an item using a regular, saveable directory. | 514 // Set up an item and progress marker using a regular, saveable directory. |
| 515 dir()->SetDownloadProgress(BOOKMARKS, BuildProgress(BOOKMARKS)); |
522 { | 516 { |
523 WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); | 517 WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); |
524 | 518 |
525 MutableEntry e1(&trans, CREATE, BOOKMARKS, trans.root_id(), "aguilera"); | 519 MutableEntry e1(&trans, CREATE, BOOKMARKS, trans.root_id(), "aguilera"); |
526 ASSERT_TRUE(e1.good()); | 520 ASSERT_TRUE(e1.good()); |
527 EXPECT_TRUE(e1.GetKernelCopy().is_dirty()); | 521 EXPECT_TRUE(e1.GetKernelCopy().is_dirty()); |
528 handle1 = e1.GetMetahandle(); | 522 handle1 = e1.GetMetahandle(); |
529 e1.PutBaseVersion(1); | 523 e1.PutBaseVersion(1); |
530 e1.PutIsDir(true); | 524 e1.PutIsDir(true); |
531 e1.PutId(TestIdFactory::FromNumber(101)); | 525 e1.PutId(TestIdFactory::FromNumber(101)); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) { | 668 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) { |
675 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); | 669 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); |
676 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); | 670 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); |
677 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); | 671 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); |
678 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); | 672 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); |
679 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); | 673 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); |
680 } | 674 } |
681 | 675 |
682 } // namespace syncable | 676 } // namespace syncable |
683 } // namespace syncer | 677 } // namespace syncer |
OLD | NEW |