| 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 "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 |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 | 648 |
| 649 // Ensure the bootstrap is encoded properly (a base64 encoded encrypted blob | 649 // Ensure the bootstrap is encoded properly (a base64 encoded encrypted blob |
| 650 // of list values containing the keystore keys). | 650 // of list values containing the keystore keys). |
| 651 std::string decoded_bootstrap; | 651 std::string decoded_bootstrap; |
| 652 ASSERT_TRUE(base::Base64Decode(keystore_bootstrap, &decoded_bootstrap)); | 652 ASSERT_TRUE(base::Base64Decode(keystore_bootstrap, &decoded_bootstrap)); |
| 653 std::string decrypted_bootstrap; | 653 std::string decrypted_bootstrap; |
| 654 ASSERT_TRUE(GetCryptographer()->encryptor()->DecryptString( | 654 ASSERT_TRUE(GetCryptographer()->encryptor()->DecryptString( |
| 655 decoded_bootstrap, &decrypted_bootstrap)); | 655 decoded_bootstrap, &decrypted_bootstrap)); |
| 656 JSONStringValueDeserializer json(decrypted_bootstrap); | 656 JSONStringValueDeserializer json(decrypted_bootstrap); |
| 657 std::unique_ptr<base::Value> deserialized_keystore_keys( | 657 std::unique_ptr<base::Value> deserialized_keystore_keys( |
| 658 json.Deserialize(NULL, NULL)); | 658 json.Deserialize(nullptr, nullptr)); |
| 659 ASSERT_TRUE(deserialized_keystore_keys.get()); | 659 ASSERT_TRUE(deserialized_keystore_keys.get()); |
| 660 base::ListValue* keystore_list = NULL; | 660 base::ListValue* keystore_list = nullptr; |
| 661 deserialized_keystore_keys->GetAsList(&keystore_list); | 661 deserialized_keystore_keys->GetAsList(&keystore_list); |
| 662 ASSERT_TRUE(keystore_list); | 662 ASSERT_TRUE(keystore_list); |
| 663 ASSERT_EQ(2U, keystore_list->GetSize()); | 663 ASSERT_EQ(2U, keystore_list->GetSize()); |
| 664 std::string test_string; | 664 std::string test_string; |
| 665 keystore_list->GetString(0, &test_string); | 665 keystore_list->GetString(0, &test_string); |
| 666 ASSERT_EQ(old_keystore_key, test_string); | 666 ASSERT_EQ(old_keystore_key, test_string); |
| 667 keystore_list->GetString(1, &test_string); | 667 keystore_list->GetString(1, &test_string); |
| 668 ASSERT_EQ(kKeystoreKey, test_string); | 668 ASSERT_EQ(kKeystoreKey, test_string); |
| 669 | 669 |
| 670 // Now make sure a new encryption handler can correctly parse the bootstrap | 670 // Now make sure a new encryption handler can correctly parse the bootstrap |
| (...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2297 EXPECT_CALL(*observer(), | 2297 EXPECT_CALL(*observer(), |
| 2298 OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); | 2298 OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); |
| 2299 { | 2299 { |
| 2300 ReadTransaction trans(FROM_HERE, user_share()); | 2300 ReadTransaction trans(FROM_HERE, user_share()); |
| 2301 encryption_handler()->SetKeystoreKeys( | 2301 encryption_handler()->SetKeystoreKeys( |
| 2302 BuildEncryptionKeyProto(kRawKeystoreKey), trans.GetWrappedTrans()); | 2302 BuildEncryptionKeyProto(kRawKeystoreKey), trans.GetWrappedTrans()); |
| 2303 } | 2303 } |
| 2304 } | 2304 } |
| 2305 | 2305 |
| 2306 } // namespace syncer | 2306 } // namespace syncer |
| OLD | NEW |