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

Side by Side Diff: sync/engine/syncer_unittest.cc

Issue 10878015: [Sync] Move keystore key handling to SyncEncryptionHandlerImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
« no previous file with comments | « sync/engine/download_updates_command.cc ('k') | sync/internal_api/debug_info_event_listener.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Syncer unit tests. Unfortunately a lot of these tests 5 // Syncer unit tests. Unfortunately a lot of these tests
6 // are outdated and need to be reworked and updated. 6 // are outdated and need to be reworked and updated.
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <limits> 9 #include <limits>
10 #include <list> 10 #include <list>
(...skipping 4076 matching lines...) Expand 10 before | Expand all | Expand 10 after
4087 4087
4088 // One update remains undownloaded. 4088 // One update remains undownloaded.
4089 mock_server_->ClearUpdatesQueue(); 4089 mock_server_->ClearUpdatesQueue();
4090 4090
4091 EXPECT_FALSE(initial_sync_ended_for_type(BOOKMARKS)); 4091 EXPECT_FALSE(initial_sync_ended_for_type(BOOKMARKS));
4092 } 4092 }
4093 4093
4094 TEST_F(SyncerTest, GetKeySuccess) { 4094 TEST_F(SyncerTest, GetKeySuccess) {
4095 { 4095 {
4096 syncable::ReadTransaction rtrans(FROM_HERE, directory()); 4096 syncable::ReadTransaction rtrans(FROM_HERE, directory());
4097 EXPECT_FALSE(GetCryptographer(&rtrans)->HasKeystoreKey()); 4097 EXPECT_TRUE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans));
4098 } 4098 }
4099 4099
4100 SyncShareConfigure(); 4100 SyncShareConfigure();
4101 4101
4102 EXPECT_EQ(session_->status_controller().last_get_key_result(), SYNCER_OK); 4102 EXPECT_EQ(session_->status_controller().last_get_key_result(), SYNCER_OK);
4103 { 4103 {
4104 syncable::ReadTransaction rtrans(FROM_HERE, directory()); 4104 syncable::ReadTransaction rtrans(FROM_HERE, directory());
4105 EXPECT_TRUE(GetCryptographer(&rtrans)->HasKeystoreKey()); 4105 EXPECT_FALSE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans));
4106 } 4106 }
4107 } 4107 }
4108 4108
4109 TEST_F(SyncerTest, GetKeyEmpty) { 4109 TEST_F(SyncerTest, GetKeyEmpty) {
4110 { 4110 {
4111 syncable::ReadTransaction rtrans(FROM_HERE, directory()); 4111 syncable::ReadTransaction rtrans(FROM_HERE, directory());
4112 EXPECT_FALSE(GetCryptographer(&rtrans)->HasKeystoreKey()); 4112 EXPECT_TRUE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans));
4113 } 4113 }
4114 4114
4115 mock_server_->SetKeystoreKey(""); 4115 mock_server_->SetKeystoreKey("");
4116 SyncShareConfigure(); 4116 SyncShareConfigure();
4117 4117
4118 EXPECT_NE(session_->status_controller().last_get_key_result(), SYNCER_OK); 4118 EXPECT_NE(session_->status_controller().last_get_key_result(), SYNCER_OK);
4119 { 4119 {
4120 syncable::ReadTransaction rtrans(FROM_HERE, directory()); 4120 syncable::ReadTransaction rtrans(FROM_HERE, directory());
4121 EXPECT_FALSE(GetCryptographer(&rtrans)->HasKeystoreKey()); 4121 EXPECT_TRUE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans));
4122 } 4122 }
4123 } 4123 }
4124 4124
4125 // Test what happens if a client deletes, then recreates, an object very 4125 // Test what happens if a client deletes, then recreates, an object very
4126 // quickly. It is possible that the deletion gets sent as a commit, and 4126 // quickly. It is possible that the deletion gets sent as a commit, and
4127 // the undelete happens during the commit request. The principle here 4127 // the undelete happens during the commit request. The principle here
4128 // is that with a single committing client, conflicts should never 4128 // is that with a single committing client, conflicts should never
4129 // be encountered, and a client encountering its past actions during 4129 // be encountered, and a client encountering its past actions during
4130 // getupdates should never feed back to override later actions. 4130 // getupdates should never feed back to override later actions.
4131 // 4131 //
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
4779 4779
4780 TEST_F(SyncerPositionTiebreakingTest, MidLowHigh) { 4780 TEST_F(SyncerPositionTiebreakingTest, MidLowHigh) {
4781 Add(mid_id_); 4781 Add(mid_id_);
4782 Add(low_id_); 4782 Add(low_id_);
4783 Add(high_id_); 4783 Add(high_id_);
4784 SyncShareNudge(); 4784 SyncShareNudge();
4785 ExpectLocalOrderIsByServerId(); 4785 ExpectLocalOrderIsByServerId();
4786 } 4786 }
4787 4787
4788 } // namespace syncer 4788 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/download_updates_command.cc ('k') | sync/internal_api/debug_info_event_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698