| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 // saving) to verify that disk does not still have the data. | 1576 // saving) to verify that disk does not still have the data. |
| 1577 CheckPurgeEntriesWithTypeInSucceeded(types_to_purge, true); | 1577 CheckPurgeEntriesWithTypeInSucceeded(types_to_purge, true); |
| 1578 SaveAndReloadDir(); | 1578 SaveAndReloadDir(); |
| 1579 CheckPurgeEntriesWithTypeInSucceeded(types_to_purge, false); | 1579 CheckPurgeEntriesWithTypeInSucceeded(types_to_purge, false); |
| 1580 } | 1580 } |
| 1581 | 1581 |
| 1582 TEST_F(OnDiskSyncableDirectoryTest, TestShareInfo) { | 1582 TEST_F(OnDiskSyncableDirectoryTest, TestShareInfo) { |
| 1583 dir_->set_initial_sync_ended_for_type(AUTOFILL, true); | 1583 dir_->set_initial_sync_ended_for_type(AUTOFILL, true); |
| 1584 dir_->set_store_birthday("Jan 31st"); | 1584 dir_->set_store_birthday("Jan 31st"); |
| 1585 dir_->SetNotificationState("notification_state"); | 1585 dir_->SetNotificationState("notification_state"); |
| 1586 const char* const bag_of_chips_array = "\0bag of chips"; |
| 1587 const std::string bag_of_chips_string = |
| 1588 std::string(bag_of_chips_array, sizeof(bag_of_chips_array)); |
| 1589 dir_->set_bag_of_chips(bag_of_chips_string); |
| 1586 { | 1590 { |
| 1587 ReadTransaction trans(FROM_HERE, dir_.get()); | 1591 ReadTransaction trans(FROM_HERE, dir_.get()); |
| 1588 EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL)); | 1592 EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL)); |
| 1589 EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS)); | 1593 EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS)); |
| 1590 EXPECT_EQ("Jan 31st", dir_->store_birthday()); | 1594 EXPECT_EQ("Jan 31st", dir_->store_birthday()); |
| 1591 EXPECT_EQ("notification_state", dir_->GetNotificationState()); | 1595 EXPECT_EQ("notification_state", dir_->GetNotificationState()); |
| 1596 EXPECT_EQ(bag_of_chips_string, dir_->bag_of_chips()); |
| 1592 } | 1597 } |
| 1593 dir_->set_store_birthday("April 10th"); | 1598 dir_->set_store_birthday("April 10th"); |
| 1594 dir_->SetNotificationState("notification_state2"); | 1599 dir_->SetNotificationState("notification_state2"); |
| 1600 const char* const bag_of_chips2_array = "\0bag of chips2"; |
| 1601 const std::string bag_of_chips2_string = |
| 1602 std::string(bag_of_chips2_array, sizeof(bag_of_chips2_array)); |
| 1603 dir_->set_bag_of_chips(bag_of_chips2_string); |
| 1595 dir_->SaveChanges(); | 1604 dir_->SaveChanges(); |
| 1596 { | 1605 { |
| 1597 ReadTransaction trans(FROM_HERE, dir_.get()); | 1606 ReadTransaction trans(FROM_HERE, dir_.get()); |
| 1598 EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL)); | 1607 EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL)); |
| 1599 EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS)); | 1608 EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS)); |
| 1600 EXPECT_EQ("April 10th", dir_->store_birthday()); | 1609 EXPECT_EQ("April 10th", dir_->store_birthday()); |
| 1601 EXPECT_EQ("notification_state2", dir_->GetNotificationState()); | 1610 EXPECT_EQ("notification_state2", dir_->GetNotificationState()); |
| 1611 EXPECT_EQ(bag_of_chips2_string, dir_->bag_of_chips()); |
| 1602 } | 1612 } |
| 1603 dir_->SetNotificationState("notification_state2"); | 1613 dir_->SetNotificationState("notification_state2"); |
| 1604 // Restore the directory from disk. Make sure that nothing's changed. | 1614 // Restore the directory from disk. Make sure that nothing's changed. |
| 1605 SaveAndReloadDir(); | 1615 SaveAndReloadDir(); |
| 1606 { | 1616 { |
| 1607 ReadTransaction trans(FROM_HERE, dir_.get()); | 1617 ReadTransaction trans(FROM_HERE, dir_.get()); |
| 1608 EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL)); | 1618 EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL)); |
| 1609 EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS)); | 1619 EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS)); |
| 1610 EXPECT_EQ("April 10th", dir_->store_birthday()); | 1620 EXPECT_EQ("April 10th", dir_->store_birthday()); |
| 1611 EXPECT_EQ("notification_state2", dir_->GetNotificationState()); | 1621 EXPECT_EQ("notification_state2", dir_->GetNotificationState()); |
| 1622 EXPECT_EQ(bag_of_chips2_string, dir_->bag_of_chips()); |
| 1612 } | 1623 } |
| 1613 } | 1624 } |
| 1614 | 1625 |
| 1615 TEST_F(OnDiskSyncableDirectoryTest, | 1626 TEST_F(OnDiskSyncableDirectoryTest, |
| 1616 TestSimpleFieldsPreservedDuringSaveChanges) { | 1627 TestSimpleFieldsPreservedDuringSaveChanges) { |
| 1617 Id update_id = TestIdFactory::FromNumber(1); | 1628 Id update_id = TestIdFactory::FromNumber(1); |
| 1618 Id create_id; | 1629 Id create_id; |
| 1619 EntryKernel create_pre_save, update_pre_save; | 1630 EntryKernel create_pre_save, update_pre_save; |
| 1620 EntryKernel create_post_save, update_post_save; | 1631 EntryKernel create_post_save, update_post_save; |
| 1621 std::string create_name = "Create"; | 1632 std::string create_name = "Create"; |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2079 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); | 2090 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); |
| 2080 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); | 2091 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); |
| 2081 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); | 2092 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); |
| 2082 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); | 2093 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); |
| 2083 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); | 2094 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); |
| 2084 } | 2095 } |
| 2085 | 2096 |
| 2086 } // namespace | 2097 } // namespace |
| 2087 } // namespace syncable | 2098 } // namespace syncable |
| 2088 } // namespace syncer | 2099 } // namespace syncer |
| OLD | NEW |