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

Side by Side Diff: sync/internal_api/sync_encryption_handler_impl_unittest.cc

Issue 925783002: Split ValueSerializer into separate Serializer and Deserializer classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cpplint warnings. Created 5 years, 9 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 "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"
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 VerifyMigratedNigori(KEYSTORE_PASSPHRASE, kKeystoreKey); 658 VerifyMigratedNigori(KEYSTORE_PASSPHRASE, kKeystoreKey);
659 659
660 // Ensure the bootstrap is encoded properly (a base64 encoded encrypted blob 660 // Ensure the bootstrap is encoded properly (a base64 encoded encrypted blob
661 // of list values containing the keystore keys). 661 // of list values containing the keystore keys).
662 std::string decoded_bootstrap; 662 std::string decoded_bootstrap;
663 ASSERT_TRUE(base::Base64Decode(keystore_bootstrap, &decoded_bootstrap)); 663 ASSERT_TRUE(base::Base64Decode(keystore_bootstrap, &decoded_bootstrap));
664 std::string decrypted_bootstrap; 664 std::string decrypted_bootstrap;
665 ASSERT_TRUE( 665 ASSERT_TRUE(
666 GetCryptographer()->encryptor()->DecryptString(decoded_bootstrap, 666 GetCryptographer()->encryptor()->DecryptString(decoded_bootstrap,
667 &decrypted_bootstrap)); 667 &decrypted_bootstrap));
668 JSONStringValueSerializer json(decrypted_bootstrap); 668 JSONStringValueDeserializer json(decrypted_bootstrap);
669 scoped_ptr<base::Value> deserialized_keystore_keys( 669 scoped_ptr<base::Value> deserialized_keystore_keys(
670 json.Deserialize(NULL, NULL)); 670 json.Deserialize(NULL, NULL));
671 ASSERT_TRUE(deserialized_keystore_keys.get()); 671 ASSERT_TRUE(deserialized_keystore_keys.get());
672 base::ListValue* keystore_list = NULL; 672 base::ListValue* keystore_list = NULL;
673 deserialized_keystore_keys->GetAsList(&keystore_list); 673 deserialized_keystore_keys->GetAsList(&keystore_list);
674 ASSERT_TRUE(keystore_list); 674 ASSERT_TRUE(keystore_list);
675 ASSERT_EQ(2U, keystore_list->GetSize()); 675 ASSERT_EQ(2U, keystore_list->GetSize());
676 std::string test_string; 676 std::string test_string;
677 keystore_list->GetString(0, &test_string); 677 keystore_list->GetString(0, &test_string);
678 ASSERT_EQ(old_keystore_key, test_string); 678 ASSERT_EQ(old_keystore_key, test_string);
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « sync/internal_api/sync_encryption_handler_impl.cc ('k') | ui/app_list/search/dictionary_data_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698