OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // Syncer unit tests. Unfortunately a lot of these tests | 5 // Syncer unit tests. Unfortunately a lot of these tests |
6 // are outdated and need to be reworked and updated. | 6 // are outdated and need to be reworked and updated. |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <limits> | 9 #include <limits> |
10 #include <list> | 10 #include <list> |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 EXPECT_TRUE(cryptographer(&wtrans)->encrypt_everything()); | 1020 EXPECT_TRUE(cryptographer(&wtrans)->encrypt_everything()); |
1021 EXPECT_TRUE(specifics.nigori().sync_tabs()); | 1021 EXPECT_TRUE(specifics.nigori().sync_tabs()); |
1022 // Supply the pending keys. Afterwards, we should be able to decrypt both | 1022 // Supply the pending keys. Afterwards, we should be able to decrypt both |
1023 // our own encrypted data and data encrypted by the other cryptographer, | 1023 // our own encrypted data and data encrypted by the other cryptographer, |
1024 // but the key provided by the other cryptographer should be the default. | 1024 // but the key provided by the other cryptographer should be the default. |
1025 EXPECT_TRUE(cryptographer(&wtrans)->DecryptPendingKeys(other_key_params)); | 1025 EXPECT_TRUE(cryptographer(&wtrans)->DecryptPendingKeys(other_key_params)); |
1026 EXPECT_FALSE(cryptographer(&wtrans)->has_pending_keys()); | 1026 EXPECT_FALSE(cryptographer(&wtrans)->has_pending_keys()); |
1027 sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori(); | 1027 sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori(); |
1028 cryptographer(&wtrans)->GetKeys(nigori->mutable_encrypted()); | 1028 cryptographer(&wtrans)->GetKeys(nigori->mutable_encrypted()); |
1029 cryptographer(&wtrans)->UpdateNigoriFromEncryptedTypes(nigori); | 1029 cryptographer(&wtrans)->UpdateNigoriFromEncryptedTypes(nigori); |
1030 // Normally this would be written as part of SetDecryptionPassphrase, but we | 1030 // Normally this would be written as part of SetPassphrase, but we do it |
1031 // do it manually for the test. | 1031 // manually for the test. |
1032 nigori_entry.Put(SPECIFICS, specifics); | 1032 nigori_entry.Put(SPECIFICS, specifics); |
1033 nigori_entry.Put(IS_UNSYNCED, true); | 1033 nigori_entry.Put(IS_UNSYNCED, true); |
1034 } | 1034 } |
1035 | 1035 |
1036 SyncShareAsDelegate(); | 1036 SyncShareAsDelegate(); |
1037 { | 1037 { |
1038 // Ensure everything is committed and stable now. The cryptographer | 1038 // Ensure everything is committed and stable now. The cryptographer |
1039 // should be able to decrypt both sets of keys, sync_tabs should be true, | 1039 // should be able to decrypt both sets of keys, sync_tabs should be true, |
1040 // and the encrypted types should have been unioned. | 1040 // and the encrypted types should have been unioned. |
1041 WriteTransaction wtrans(FROM_HERE, UNITTEST, directory()); | 1041 WriteTransaction wtrans(FROM_HERE, UNITTEST, directory()); |
(...skipping 3472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4514 | 4514 |
4515 TEST_F(SyncerPositionTiebreakingTest, MidLowHigh) { | 4515 TEST_F(SyncerPositionTiebreakingTest, MidLowHigh) { |
4516 Add(mid_id_); | 4516 Add(mid_id_); |
4517 Add(low_id_); | 4517 Add(low_id_); |
4518 Add(high_id_); | 4518 Add(high_id_); |
4519 SyncShareAsDelegate(); | 4519 SyncShareAsDelegate(); |
4520 ExpectLocalOrderIsByServerId(); | 4520 ExpectLocalOrderIsByServerId(); |
4521 } | 4521 } |
4522 | 4522 |
4523 } // namespace browser_sync | 4523 } // namespace browser_sync |
OLD | NEW |