Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: sync/syncable/syncable_unittest.cc

Issue 10916174: Implement a bag of chips for sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moving persistence Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 dir_->set_bag_of_chips("bag of chips");
1586 { 1587 {
1587 ReadTransaction trans(FROM_HERE, dir_.get()); 1588 ReadTransaction trans(FROM_HERE, dir_.get());
1588 EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL)); 1589 EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL));
1589 EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS)); 1590 EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS));
1590 EXPECT_EQ("Jan 31st", dir_->store_birthday()); 1591 EXPECT_EQ("Jan 31st", dir_->store_birthday());
1591 EXPECT_EQ("notification_state", dir_->GetNotificationState()); 1592 EXPECT_EQ("notification_state", dir_->GetNotificationState());
1593 EXPECT_EQ("bag of chips", dir_->bag_of_chips());
1592 } 1594 }
1593 dir_->set_store_birthday("April 10th"); 1595 dir_->set_store_birthday("April 10th");
1594 dir_->SetNotificationState("notification_state2"); 1596 dir_->SetNotificationState("notification_state2");
1597 dir_->set_bag_of_chips("bag of chips2");
1595 dir_->SaveChanges(); 1598 dir_->SaveChanges();
1596 { 1599 {
1597 ReadTransaction trans(FROM_HERE, dir_.get()); 1600 ReadTransaction trans(FROM_HERE, dir_.get());
1598 EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL)); 1601 EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL));
1599 EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS)); 1602 EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS));
1600 EXPECT_EQ("April 10th", dir_->store_birthday()); 1603 EXPECT_EQ("April 10th", dir_->store_birthday());
1601 EXPECT_EQ("notification_state2", dir_->GetNotificationState()); 1604 EXPECT_EQ("notification_state2", dir_->GetNotificationState());
1605 EXPECT_EQ("bag of chips2", dir_->bag_of_chips());
1602 } 1606 }
1603 dir_->SetNotificationState("notification_state2"); 1607 dir_->SetNotificationState("notification_state2");
1604 // Restore the directory from disk. Make sure that nothing's changed. 1608 // Restore the directory from disk. Make sure that nothing's changed.
1605 SaveAndReloadDir(); 1609 SaveAndReloadDir();
1606 { 1610 {
1607 ReadTransaction trans(FROM_HERE, dir_.get()); 1611 ReadTransaction trans(FROM_HERE, dir_.get());
1608 EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL)); 1612 EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL));
1609 EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS)); 1613 EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS));
1610 EXPECT_EQ("April 10th", dir_->store_birthday()); 1614 EXPECT_EQ("April 10th", dir_->store_birthday());
1611 EXPECT_EQ("notification_state2", dir_->GetNotificationState()); 1615 EXPECT_EQ("notification_state2", dir_->GetNotificationState());
1616 EXPECT_EQ("bag of chips2", dir_->bag_of_chips());
1612 } 1617 }
1613 } 1618 }
1614 1619
1615 TEST_F(OnDiskSyncableDirectoryTest, 1620 TEST_F(OnDiskSyncableDirectoryTest,
1616 TestSimpleFieldsPreservedDuringSaveChanges) { 1621 TestSimpleFieldsPreservedDuringSaveChanges) {
1617 Id update_id = TestIdFactory::FromNumber(1); 1622 Id update_id = TestIdFactory::FromNumber(1);
1618 Id create_id; 1623 Id create_id;
1619 EntryKernel create_pre_save, update_pre_save; 1624 EntryKernel create_pre_save, update_pre_save;
1620 EntryKernel create_post_save, update_post_save; 1625 EntryKernel create_post_save, update_post_save;
1621 std::string create_name = "Create"; 1626 std::string create_name = "Create";
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); 2084 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true));
2080 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); 2085 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true));
2081 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); 2086 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false));
2082 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); 2087 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false));
2083 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); 2088 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true));
2084 } 2089 }
2085 2090
2086 } // namespace 2091 } // namespace
2087 } // namespace syncable 2092 } // namespace syncable
2088 } // namespace syncer 2093 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698