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

Side by Side Diff: components/sync/core_impl/sync_encryption_handler_impl_unittest.cc

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Rebase. Created 4 years, 2 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
OLDNEW
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 "components/sync/core_impl/sync_encryption_handler_impl.h" 5 #include "components/sync/core_impl/sync_encryption_handler_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 void SetUpEncryptionWithKeyForBootstrapping( 98 void SetUpEncryptionWithKeyForBootstrapping(
99 const std::string& key_for_bootstrapping) { 99 const std::string& key_for_bootstrapping) {
100 encryption_handler_.reset(new SyncEncryptionHandlerImpl( 100 encryption_handler_.reset(new SyncEncryptionHandlerImpl(
101 user_share(), &encryptor_, key_for_bootstrapping, 101 user_share(), &encryptor_, key_for_bootstrapping,
102 std::string() /* keystore key for bootstrapping */)); 102 std::string() /* keystore key for bootstrapping */));
103 encryption_handler_->AddObserver(&observer_); 103 encryption_handler_->AddObserver(&observer_);
104 } 104 }
105 105
106 void CreateRootForType(ModelType model_type) { 106 void CreateRootForType(ModelType model_type) {
107 syncer::syncable::Directory* directory = user_share()->directory.get(); 107 syncable::Directory* directory = user_share()->directory.get();
108 108
109 std::string tag_name = ModelTypeToRootTag(model_type); 109 std::string tag_name = ModelTypeToRootTag(model_type);
110 110
111 syncable::WriteTransaction wtrans(FROM_HERE, syncable::UNITTEST, directory); 111 syncable::WriteTransaction wtrans(FROM_HERE, syncable::UNITTEST, directory);
112 syncable::MutableEntry node(&wtrans, syncable::CREATE, model_type, 112 syncable::MutableEntry node(&wtrans, syncable::CREATE, model_type,
113 wtrans.root_id(), tag_name); 113 wtrans.root_id(), tag_name);
114 node.PutUniqueServerTag(tag_name); 114 node.PutUniqueServerTag(tag_name);
115 node.PutIsDir(true); 115 node.PutIsDir(true);
116 node.PutServerIsDir(false); 116 node.PutServerIsDir(false);
117 node.PutIsUnsynced(false); 117 node.PutIsUnsynced(false);
118 node.PutIsUnappliedUpdate(false); 118 node.PutIsUnappliedUpdate(false);
119 node.PutServerVersion(20); 119 node.PutServerVersion(20);
120 node.PutBaseVersion(20); 120 node.PutBaseVersion(20);
121 node.PutIsDel(false); 121 node.PutIsDel(false);
122 node.PutId(ids_.MakeServer(tag_name)); 122 node.PutId(ids_.MakeServer(tag_name));
123 sync_pb::EntitySpecifics specifics; 123 sync_pb::EntitySpecifics specifics;
124 syncer::AddDefaultFieldValue(model_type, &specifics); 124 AddDefaultFieldValue(model_type, &specifics);
125 node.PutSpecifics(specifics); 125 node.PutSpecifics(specifics);
126 } 126 }
127 127
128 void PumpLoop() { base::RunLoop().RunUntilIdle(); } 128 void PumpLoop() { base::RunLoop().RunUntilIdle(); }
129 129
130 // Getters for tests. 130 // Getters for tests.
131 UserShare* user_share() { return test_user_share_.user_share(); } 131 UserShare* user_share() { return test_user_share_.user_share(); }
132 SyncEncryptionHandlerImpl* encryption_handler() { 132 SyncEncryptionHandlerImpl* encryption_handler() {
133 return encryption_handler_.get(); 133 return encryption_handler_.get();
134 } 134 }
(...skipping 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2298 EXPECT_CALL(*observer(), 2298 EXPECT_CALL(*observer(),
2299 OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); 2299 OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN));
2300 { 2300 {
2301 ReadTransaction trans(FROM_HERE, user_share()); 2301 ReadTransaction trans(FROM_HERE, user_share());
2302 encryption_handler()->SetKeystoreKeys( 2302 encryption_handler()->SetKeystoreKeys(
2303 BuildEncryptionKeyProto(kRawKeystoreKey), trans.GetWrappedTrans()); 2303 BuildEncryptionKeyProto(kRawKeystoreKey), trans.GetWrappedTrans());
2304 } 2304 }
2305 } 2305 }
2306 2306
2307 } // namespace syncer 2307 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/core_impl/model_type_connector_proxy_unittest.cc ('k') | components/sync/core_impl/sync_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698