OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "chrome/browser/sync/engine/apply_updates_command.h" | 10 #include "chrome/browser/sync/engine/apply_updates_command.h" |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 | 705 |
706 sessions::StatusController* status = session()->mutable_status_controller(); | 706 sessions::StatusController* status = session()->mutable_status_controller(); |
707 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_PASSIVE); | 707 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_PASSIVE); |
708 ASSERT_TRUE(status->update_progress()); | 708 ASSERT_TRUE(status->update_progress()); |
709 EXPECT_EQ(1, status->update_progress()->AppliedUpdatesSize()) | 709 EXPECT_EQ(1, status->update_progress()->AppliedUpdatesSize()) |
710 << "All updates should have been attempted"; | 710 << "All updates should have been attempted"; |
711 ASSERT_TRUE(status->conflict_progress()); | 711 ASSERT_TRUE(status->conflict_progress()); |
712 EXPECT_EQ(0, status->conflict_progress()->ConflictingItemsSize()) | 712 EXPECT_EQ(0, status->conflict_progress()->ConflictingItemsSize()) |
713 << "The unsynced changes don't trigger a blocking conflict with the " | 713 << "The unsynced changes don't trigger a blocking conflict with the " |
714 << "nigori update."; | 714 << "nigori update."; |
715 EXPECT_EQ(1, status->conflict_progress()->NonblockingConflictingItemsSize()) | 715 EXPECT_EQ(0, status->conflict_progress()->NonblockingConflictingItemsSize()) |
716 << "The unsynced changes trigger a non-blocking conflict with the " | 716 << "The unsynced changes don't trigger a non-blocking conflict with the " |
717 << "nigori update."; | 717 << "nigori update."; |
718 EXPECT_EQ(0, status->update_progress()->SuccessfullyAppliedUpdateCount()) | 718 EXPECT_EQ(1, status->update_progress()->SuccessfullyAppliedUpdateCount()) |
719 << "The nigori update should not be applied"; | 719 << "The nigori update should be applied"; |
720 EXPECT_FALSE(cryptographer->is_ready()); | 720 EXPECT_FALSE(cryptographer->is_ready()); |
721 EXPECT_TRUE(cryptographer->has_pending_keys()); | 721 EXPECT_TRUE(cryptographer->has_pending_keys()); |
722 { | 722 { |
723 // Ensure the unsynced nodes are still not encrypted. | |
724 ScopedDirLookup dir(syncdb()->manager(), syncdb()->name()); | 723 ScopedDirLookup dir(syncdb()->manager(), syncdb()->name()); |
725 ASSERT_TRUE(dir.good()); | 724 ASSERT_TRUE(dir.good()); |
726 ReadTransaction trans(FROM_HERE, dir); | 725 ReadTransaction trans(FROM_HERE, dir); |
727 | 726 |
728 // Since we're in conflict, the specifics don't reflect the unapplied | 727 // Since we have pending keys, we would have failed to encrypt, but the |
729 // changes. | 728 // cryptographer should be updated. |
730 EXPECT_FALSE(VerifyUnsyncedChangesAreEncrypted(&trans, encrypted_types)); | 729 EXPECT_FALSE(VerifyUnsyncedChangesAreEncrypted(&trans, encrypted_types)); |
731 encrypted_types.Clear(); | 730 EXPECT_TRUE(cryptographer->GetEncryptedTypes().Equals( |
732 encrypted_types.Put(syncable::PASSWORDS); | 731 syncable::ModelTypeSet().All())); |
733 encrypted_types.Put(syncable::BOOKMARKS); | 732 EXPECT_FALSE(cryptographer->is_ready()); |
734 EXPECT_TRUE( | 733 EXPECT_TRUE(cryptographer->has_pending_keys()); |
735 cryptographer->GetEncryptedTypes().Equals( | |
736 syncable::ModelTypeSet().All())); | |
737 | 734 |
738 Syncer::UnsyncedMetaHandles handles; | 735 Syncer::UnsyncedMetaHandles handles; |
739 SyncerUtil::GetUnsyncedEntries(&trans, &handles); | 736 SyncerUtil::GetUnsyncedEntries(&trans, &handles); |
740 EXPECT_EQ(2*batch_s+1, handles.size()); | 737 EXPECT_EQ(2*batch_s+1, handles.size()); |
741 } | 738 } |
742 } | 739 } |
743 | 740 |
744 } // namespace browser_sync | 741 } // namespace browser_sync |
OLD | NEW |