Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2020 The Chromium Authors |
Yann Dago | de0c6d1 | 2020-05-28 16:41:54 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/downgrade/snapshot_manager.h" |
| 6 | |
| 7 | #include "base/containers/flat_set.h" |
| 8 | #include "chrome/browser/downgrade/snapshot_file_collector.h" |
| 9 | #include "testing/gtest/include/gtest/gtest.h" |
| 10 | |
| 11 | namespace downgrade { |
| 12 | |
| 13 | // Tests that ids are not duplicated across the lists of snapshot items. |
| 14 | TEST(SnapshotFileCollector, SnapshotFileIds) { |
| 15 | auto profile_items = CollectProfileItems(); |
| 16 | auto user_data_items = CollectUserDataItems(); |
| 17 | base::flat_set<SnapshotItemId> ids; |
| 18 | for (const auto& item : profile_items) |
| 19 | EXPECT_TRUE(ids.insert(item.id).second) << static_cast<int>(item.id); |
| 20 | for (const auto& item : user_data_items) |
| 21 | EXPECT_TRUE(ids.insert(item.id).second) << static_cast<int>(item.id); |
| 22 | } |
| 23 | |
| 24 | } // namespace downgrade |