OLD | NEW |
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 "sync/internal_api/sync_encryption_handler_impl.h" | 5 #include "sync/internal_api/sync_encryption_handler_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/tracked_objects.h" | 13 #include "base/tracked_objects.h" |
14 #include "sync/internal_api/public/base/model_type_test_util.h" | 14 #include "sync/internal_api/public/base/model_type_test_util.h" |
15 #include "sync/internal_api/public/read_node.h" | 15 #include "sync/internal_api/public/read_node.h" |
16 #include "sync/internal_api/public/read_transaction.h" | 16 #include "sync/internal_api/public/read_transaction.h" |
17 #include "sync/internal_api/public/test/test_user_share.h" | 17 #include "sync/internal_api/public/test/test_user_share.h" |
18 #include "sync/internal_api/public/write_node.h" | 18 #include "sync/internal_api/public/write_node.h" |
19 #include "sync/internal_api/public/write_transaction.h" | 19 #include "sync/internal_api/public/write_transaction.h" |
20 #include "sync/protocol/nigori_specifics.pb.h" | 20 #include "sync/protocol/nigori_specifics.pb.h" |
21 #include "sync/protocol/sync.pb.h" | 21 #include "sync/protocol/sync.pb.h" |
22 #include "sync/syncable/entry.h" | 22 #include "sync/syncable/entry.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 node.PutServerVersion(20); | 115 node.PutServerVersion(20); |
116 node.PutBaseVersion(20); | 116 node.PutBaseVersion(20); |
117 node.PutIsDel(false); | 117 node.PutIsDel(false); |
118 node.PutId(ids_.MakeServer(tag_name)); | 118 node.PutId(ids_.MakeServer(tag_name)); |
119 sync_pb::EntitySpecifics specifics; | 119 sync_pb::EntitySpecifics specifics; |
120 syncer::AddDefaultFieldValue(model_type, &specifics); | 120 syncer::AddDefaultFieldValue(model_type, &specifics); |
121 node.PutSpecifics(specifics); | 121 node.PutSpecifics(specifics); |
122 } | 122 } |
123 | 123 |
124 void PumpLoop() { | 124 void PumpLoop() { |
125 message_loop_.RunUntilIdle(); | 125 base::RunLoop().RunUntilIdle(); |
126 } | 126 } |
127 | 127 |
128 // Getters for tests. | 128 // Getters for tests. |
129 UserShare* user_share() { return test_user_share_.user_share(); } | 129 UserShare* user_share() { return test_user_share_.user_share(); } |
130 SyncEncryptionHandlerImpl* encryption_handler() { | 130 SyncEncryptionHandlerImpl* encryption_handler() { |
131 return encryption_handler_.get(); | 131 return encryption_handler_.get(); |
132 } | 132 } |
133 SyncEncryptionHandlerObserverMock* observer() { return &observer_; } | 133 SyncEncryptionHandlerObserverMock* observer() { return &observer_; } |
134 Cryptographer* GetCryptographer() { | 134 Cryptographer* GetCryptographer() { |
135 return encryption_handler_->GetCryptographerUnsafe(); | 135 return encryption_handler_->GetCryptographerUnsafe(); |
(...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2277 encryption_handler()->SetKeystoreKeys(keys, | 2277 encryption_handler()->SetKeystoreKeys(keys, |
2278 trans.GetWrappedTrans()); | 2278 trans.GetWrappedTrans()); |
2279 } | 2279 } |
2280 PumpLoop(); | 2280 PumpLoop(); |
2281 Mock::VerifyAndClearExpectations(observer()); | 2281 Mock::VerifyAndClearExpectations(observer()); |
2282 | 2282 |
2283 VerifyMigratedNigoriWithTimestamp(1, CUSTOM_PASSPHRASE, kCustomPass); | 2283 VerifyMigratedNigoriWithTimestamp(1, CUSTOM_PASSPHRASE, kCustomPass); |
2284 } | 2284 } |
2285 | 2285 |
2286 } // namespace syncer | 2286 } // namespace syncer |
OLD | NEW |