| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); | 337 WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); |
| 338 MutableEntry create( | 338 MutableEntry create( |
| 339 &trans, CREATE, BOOKMARKS, trans.root_id(), create_name); | 339 &trans, CREATE, BOOKMARKS, trans.root_id(), create_name); |
| 340 MutableEntry update(&trans, CREATE_NEW_UPDATE_ITEM, update_id); | 340 MutableEntry update(&trans, CREATE_NEW_UPDATE_ITEM, update_id); |
| 341 create.PutIsUnsynced(true); | 341 create.PutIsUnsynced(true); |
| 342 update.PutIsUnappliedUpdate(true); | 342 update.PutIsUnappliedUpdate(true); |
| 343 sync_pb::EntitySpecifics specifics; | 343 sync_pb::EntitySpecifics specifics; |
| 344 specifics.mutable_bookmark()->set_favicon("PNG"); | 344 specifics.mutable_bookmark()->set_favicon("PNG"); |
| 345 specifics.mutable_bookmark()->set_url("http://nowhere"); | 345 specifics.mutable_bookmark()->set_url("http://nowhere"); |
| 346 create.PutSpecifics(specifics); | 346 create.PutSpecifics(specifics); |
| 347 update.PutSpecifics(specifics); | 347 update.PutServerSpecifics(specifics); |
| 348 create_pre_save = create.GetKernelCopy(); | 348 create_pre_save = create.GetKernelCopy(); |
| 349 update_pre_save = update.GetKernelCopy(); | 349 update_pre_save = update.GetKernelCopy(); |
| 350 create_id = create.GetId(); | 350 create_id = create.GetId(); |
| 351 } | 351 } |
| 352 | 352 |
| 353 dir()->SaveChanges(); | 353 dir()->SaveChanges(); |
| 354 dir().reset( | 354 dir().reset( |
| 355 new Directory(new OnDiskDirectoryBackingStore(kDirectoryName, file_path_), | 355 new Directory(new OnDiskDirectoryBackingStore(kDirectoryName, file_path_), |
| 356 unrecoverable_error_handler(), | 356 unrecoverable_error_handler(), |
| 357 NULL, | 357 NULL, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 372 Entry update(&trans, GET_BY_ID, update_id); | 372 Entry update(&trans, GET_BY_ID, update_id); |
| 373 create_post_save = create.GetKernelCopy(); | 373 create_post_save = create.GetKernelCopy(); |
| 374 update_post_save = update.GetKernelCopy(); | 374 update_post_save = update.GetKernelCopy(); |
| 375 } | 375 } |
| 376 int i = BEGIN_FIELDS; | 376 int i = BEGIN_FIELDS; |
| 377 for ( ; i < INT64_FIELDS_END ; ++i) { | 377 for ( ; i < INT64_FIELDS_END ; ++i) { |
| 378 EXPECT_EQ(create_pre_save.ref((Int64Field)i) + | 378 EXPECT_EQ(create_pre_save.ref((Int64Field)i) + |
| 379 (i == TRANSACTION_VERSION ? 1 : 0), | 379 (i == TRANSACTION_VERSION ? 1 : 0), |
| 380 create_post_save.ref((Int64Field)i)) | 380 create_post_save.ref((Int64Field)i)) |
| 381 << "int64 field #" << i << " changed during save/load"; | 381 << "int64 field #" << i << " changed during save/load"; |
| 382 EXPECT_EQ(update_pre_save.ref((Int64Field)i) + | 382 EXPECT_EQ(update_pre_save.ref((Int64Field)i), |
| 383 (i == TRANSACTION_VERSION ? 1 : 0), | |
| 384 update_post_save.ref((Int64Field)i)) | 383 update_post_save.ref((Int64Field)i)) |
| 385 << "int64 field #" << i << " changed during save/load"; | 384 << "int64 field #" << i << " changed during save/load"; |
| 386 } | 385 } |
| 387 for ( ; i < TIME_FIELDS_END ; ++i) { | 386 for ( ; i < TIME_FIELDS_END ; ++i) { |
| 388 EXPECT_EQ(create_pre_save.ref((TimeField)i), | 387 EXPECT_EQ(create_pre_save.ref((TimeField)i), |
| 389 create_post_save.ref((TimeField)i)) | 388 create_post_save.ref((TimeField)i)) |
| 390 << "time field #" << i << " changed during save/load"; | 389 << "time field #" << i << " changed during save/load"; |
| 391 EXPECT_EQ(update_pre_save.ref((TimeField)i), | 390 EXPECT_EQ(update_pre_save.ref((TimeField)i), |
| 392 update_post_save.ref((TimeField)i)) | 391 update_post_save.ref((TimeField)i)) |
| 393 << "time field #" << i << " changed during save/load"; | 392 << "time field #" << i << " changed during save/load"; |
| 394 } | 393 } |
| 395 for ( ; i < ID_FIELDS_END ; ++i) { | 394 for ( ; i < ID_FIELDS_END ; ++i) { |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) { | 673 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) { |
| 675 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); | 674 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); |
| 676 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); | 675 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); |
| 677 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); | 676 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); |
| 678 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); | 677 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); |
| 679 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); | 678 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); |
| 680 } | 679 } |
| 681 | 680 |
| 682 } // namespace syncable | 681 } // namespace syncable |
| 683 } // namespace syncer | 682 } // namespace syncer |
| OLD | NEW |