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 // Unit tests for the SyncApi. Note that a lot of the underlying | 5 // Unit tests for the SyncApi. Note that a lot of the underlying |
6 // functionality is provided by the Syncable layer, which has its own | 6 // functionality is provided by the Syncable layer, which has its own |
7 // unit tests. We'll test SyncApi specific things in this harness. | 7 // unit tests. We'll test SyncApi specific things in this harness. |
8 | 8 |
9 #include <cstddef> | 9 #include <cstddef> |
10 #include <map> | 10 #include <map> |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 GetIdForDataType(BOOKMARKS), | 1550 GetIdForDataType(BOOKMARKS), |
1551 NULL); | 1551 NULL); |
1552 // First batch_size nodes are children of folder. | 1552 // First batch_size nodes are children of folder. |
1553 size_t i; | 1553 size_t i; |
1554 for (i = 0; i < batch_size; ++i) { | 1554 for (i = 0; i < batch_size; ++i) { |
1555 MakeBookmarkWithParent(sync_manager_.GetUserShare(), folder, NULL); | 1555 MakeBookmarkWithParent(sync_manager_.GetUserShare(), folder, NULL); |
1556 } | 1556 } |
1557 // Next batch_size nodes are a different type and on their own. | 1557 // Next batch_size nodes are a different type and on their own. |
1558 for (; i < 2*batch_size; ++i) { | 1558 for (; i < 2*batch_size; ++i) { |
1559 MakeNode(sync_manager_.GetUserShare(), SESSIONS, | 1559 MakeNode(sync_manager_.GetUserShare(), SESSIONS, |
1560 base::StringPrintf("%"PRIuS"", i)); | 1560 base::StringPrintf("%" PRIuS "", i)); |
1561 } | 1561 } |
1562 // Last batch_size nodes are a third type that will not need encryption. | 1562 // Last batch_size nodes are a third type that will not need encryption. |
1563 for (; i < 3*batch_size; ++i) { | 1563 for (; i < 3*batch_size; ++i) { |
1564 MakeNode(sync_manager_.GetUserShare(), THEMES, | 1564 MakeNode(sync_manager_.GetUserShare(), THEMES, |
1565 base::StringPrintf("%"PRIuS"", i)); | 1565 base::StringPrintf("%" PRIuS "", i)); |
1566 } | 1566 } |
1567 | 1567 |
1568 { | 1568 { |
1569 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); | 1569 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
1570 EXPECT_TRUE(GetEncryptedTypesWithTrans(&trans).Equals( | 1570 EXPECT_TRUE(GetEncryptedTypesWithTrans(&trans).Equals( |
1571 SyncEncryptionHandler::SensitiveTypes())); | 1571 SyncEncryptionHandler::SensitiveTypes())); |
1572 EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( | 1572 EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( |
1573 trans.GetWrappedTrans(), | 1573 trans.GetWrappedTrans(), |
1574 BOOKMARKS, | 1574 BOOKMARKS, |
1575 false /* not encrypted */)); | 1575 false /* not encrypted */)); |
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3363 size_t folder_b_pos = | 3363 size_t folder_b_pos = |
3364 FindChangeInList(folder_b_id, ChangeRecord::ACTION_DELETE); | 3364 FindChangeInList(folder_b_id, ChangeRecord::ACTION_DELETE); |
3365 size_t child_pos = FindChangeInList(child_id, ChangeRecord::ACTION_DELETE); | 3365 size_t child_pos = FindChangeInList(child_id, ChangeRecord::ACTION_DELETE); |
3366 | 3366 |
3367 // Deletes should appear before updates. | 3367 // Deletes should appear before updates. |
3368 EXPECT_LT(child_pos, folder_a_pos); | 3368 EXPECT_LT(child_pos, folder_a_pos); |
3369 EXPECT_LT(folder_b_pos, folder_a_pos); | 3369 EXPECT_LT(folder_b_pos, folder_a_pos); |
3370 } | 3370 } |
3371 | 3371 |
3372 } // namespace | 3372 } // namespace |
OLD | NEW |