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

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

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. 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/engine_impl/sync_encryption_handler_impl.h" 5 #include "components/sync/engine_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 10
11 #include "base/base64.h" 11 #include "base/base64.h"
12 #include "base/json/json_string_value_serializer.h" 12 #include "base/json/json_string_value_serializer.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/run_loop.h" 14 #include "base/run_loop.h"
14 #include "base/tracked_objects.h" 15 #include "base/tracked_objects.h"
15 #include "components/sync/base/fake_encryptor.h" 16 #include "components/sync/base/fake_encryptor.h"
16 #include "components/sync/base/model_type_test_util.h" 17 #include "components/sync/base/model_type_test_util.h"
17 #include "components/sync/protocol/nigori_specifics.pb.h" 18 #include "components/sync/protocol/nigori_specifics.pb.h"
18 #include "components/sync/protocol/sync.pb.h" 19 #include "components/sync/protocol/sync.pb.h"
19 #include "components/sync/syncable/entry.h" 20 #include "components/sync/syncable/entry.h"
20 #include "components/sync/syncable/mutable_entry.h" 21 #include "components/sync/syncable/mutable_entry.h"
21 #include "components/sync/syncable/read_node.h" 22 #include "components/sync/syncable/read_node.h"
22 #include "components/sync/syncable/read_transaction.h" 23 #include "components/sync/syncable/read_transaction.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 test_user_share_.TearDown(); 89 test_user_share_.TearDown();
89 } 90 }
90 91
91 protected: 92 protected:
92 void SetUpEncryption() { 93 void SetUpEncryption() {
93 SetUpEncryptionWithKeyForBootstrapping(std::string()); 94 SetUpEncryptionWithKeyForBootstrapping(std::string());
94 } 95 }
95 96
96 void SetUpEncryptionWithKeyForBootstrapping( 97 void SetUpEncryptionWithKeyForBootstrapping(
97 const std::string& key_for_bootstrapping) { 98 const std::string& key_for_bootstrapping) {
98 encryption_handler_.reset(new SyncEncryptionHandlerImpl( 99 encryption_handler_ = base::MakeUnique<SyncEncryptionHandlerImpl>(
99 user_share(), &encryptor_, key_for_bootstrapping, 100 user_share(), &encryptor_, key_for_bootstrapping,
100 std::string() /* keystore key for bootstrapping */)); 101 std::string() /* keystore key for bootstrapping */);
101 encryption_handler_->AddObserver(&observer_); 102 encryption_handler_->AddObserver(&observer_);
102 } 103 }
103 104
104 void CreateRootForType(ModelType model_type) { 105 void CreateRootForType(ModelType model_type) {
105 syncable::Directory* directory = user_share()->directory.get(); 106 syncable::Directory* directory = user_share()->directory.get();
106 107
107 std::string tag_name = ModelTypeToRootTag(model_type); 108 std::string tag_name = ModelTypeToRootTag(model_type);
108 109
109 syncable::WriteTransaction wtrans(FROM_HERE, syncable::UNITTEST, directory); 110 syncable::WriteTransaction wtrans(FROM_HERE, syncable::UNITTEST, directory);
110 syncable::MutableEntry node(&wtrans, syncable::CREATE, model_type, 111 syncable::MutableEntry node(&wtrans, syncable::CREATE, model_type,
(...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after
2296 EXPECT_CALL(*observer(), 2297 EXPECT_CALL(*observer(),
2297 OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); 2298 OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN));
2298 { 2299 {
2299 ReadTransaction trans(FROM_HERE, user_share()); 2300 ReadTransaction trans(FROM_HERE, user_share());
2300 encryption_handler()->SetKeystoreKeys( 2301 encryption_handler()->SetKeystoreKeys(
2301 BuildEncryptionKeyProto(kRawKeystoreKey), trans.GetWrappedTrans()); 2302 BuildEncryptionKeyProto(kRawKeystoreKey), trans.GetWrappedTrans());
2302 } 2303 }
2303 } 2304 }
2304 2305
2305 } // namespace syncer 2306 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine_impl/model_type_worker_unittest.cc ('k') | components/sync/engine_impl/sync_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698