| 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 #include <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <fstream> | 9 #include <fstream> |
| 10 | 10 |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 | 785 |
| 786 // First group. Because number of entries is small enough no trimming occurs. | 786 // First group. Because number of entries is small enough no trimming occurs. |
| 787 { | 787 { |
| 788 auto ids = GetHistoryIdsUpTo(item_groups[0].max_id); | 788 auto ids = GetHistoryIdsUpTo(item_groups[0].max_id); |
| 789 EXPECT_FALSE(GetPrivateData()->TrimHistoryIdsPool(&ids)); | 789 EXPECT_FALSE(GetPrivateData()->TrimHistoryIdsPool(&ids)); |
| 790 EXPECT_EQ(kAlmostLimit, ids.size()); | 790 EXPECT_EQ(kAlmostLimit, ids.size()); |
| 791 } | 791 } |
| 792 | 792 |
| 793 // Each next group should fill almost everything, while the previous group | 793 // Each next group should fill almost everything, while the previous group |
| 794 // should occupy what's left. | 794 // should occupy what's left. |
| 795 auto error_position = std::adjacent_find( | 795 auto* error_position = std::adjacent_find( |
| 796 std::begin(item_groups), std::end(item_groups), | 796 std::begin(item_groups), std::end(item_groups), |
| 797 [&](const ItemGroup& previous, const ItemGroup& current) { | 797 [&](const ItemGroup& previous, const ItemGroup& current) { |
| 798 auto ids = GetHistoryIdsUpTo(current.max_id); | 798 auto ids = GetHistoryIdsUpTo(current.max_id); |
| 799 EXPECT_TRUE(GetPrivateData()->TrimHistoryIdsPool(&ids)); | 799 EXPECT_TRUE(GetPrivateData()->TrimHistoryIdsPool(&ids)); |
| 800 | 800 |
| 801 size_t current_count = CountGroupElementsInIds(current, ids); | 801 size_t current_count = CountGroupElementsInIds(current, ids); |
| 802 EXPECT_EQ(kAlmostLimit, current_count); | 802 EXPECT_EQ(kAlmostLimit, current_count); |
| 803 if (current_count != kAlmostLimit) | 803 if (current_count != kAlmostLimit) |
| 804 return true; | 804 return true; |
| 805 | 805 |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 ASSERT_TRUE(GetCacheFilePath(&full_file_path)); | 1442 ASSERT_TRUE(GetCacheFilePath(&full_file_path)); |
| 1443 std::vector<base::FilePath::StringType> actual_parts; | 1443 std::vector<base::FilePath::StringType> actual_parts; |
| 1444 full_file_path.GetComponents(&actual_parts); | 1444 full_file_path.GetComponents(&actual_parts); |
| 1445 ASSERT_EQ(expected_parts.size(), actual_parts.size()); | 1445 ASSERT_EQ(expected_parts.size(), actual_parts.size()); |
| 1446 size_t count = expected_parts.size(); | 1446 size_t count = expected_parts.size(); |
| 1447 for (size_t i = 0; i < count; ++i) | 1447 for (size_t i = 0; i < count; ++i) |
| 1448 EXPECT_EQ(expected_parts[i], actual_parts[i]); | 1448 EXPECT_EQ(expected_parts[i], actual_parts[i]); |
| 1449 // Must clear the history_dir_ to satisfy the dtor's DCHECK. | 1449 // Must clear the history_dir_ to satisfy the dtor's DCHECK. |
| 1450 set_history_dir(base::FilePath()); | 1450 set_history_dir(base::FilePath()); |
| 1451 } | 1451 } |
| OLD | NEW |