| 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 "content/browser/storage_partition_impl.h" | 5 #include "content/browser/storage_partition_impl_map.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 namespace content { | 8 namespace content { |
| 9 | 9 |
| 10 class StoragePartitionConfigTest : public testing::Test { | 10 class StoragePartitionConfigTest : public testing::Test { |
| 11 }; | 11 }; |
| 12 | 12 |
| 13 // Test that the Less comparison function is implemented properly to uniquely | 13 // Test that the Less comparison function is implemented properly to uniquely |
| 14 // identify storage partitions used as keys in a std::map. | 14 // identify storage partitions used as keys in a std::map. |
| 15 TEST_F(StoragePartitionConfigTest, OperatorLess) { | 15 TEST_F(StoragePartitionConfigTest, OperatorLess) { |
| 16 StoragePartitionImpl::StoragePartitionConfig c1("", "", false); | 16 StoragePartitionImplMap::StoragePartitionConfig c1("", "", false); |
| 17 StoragePartitionImpl::StoragePartitionConfig c2("", "", false); | 17 StoragePartitionImplMap::StoragePartitionConfig c2("", "", false); |
| 18 StoragePartitionImpl::StoragePartitionConfig c3("", "", true); | 18 StoragePartitionImplMap::StoragePartitionConfig c3("", "", true); |
| 19 StoragePartitionImpl::StoragePartitionConfig c4("a", "", true); | 19 StoragePartitionImplMap::StoragePartitionConfig c4("a", "", true); |
| 20 StoragePartitionImpl::StoragePartitionConfig c5("b", "", true); | 20 StoragePartitionImplMap::StoragePartitionConfig c5("b", "", true); |
| 21 StoragePartitionImpl::StoragePartitionConfig c6("", "abc", false); | 21 StoragePartitionImplMap::StoragePartitionConfig c6("", "abc", false); |
| 22 StoragePartitionImpl::StoragePartitionConfig c7("", "abc", true); | 22 StoragePartitionImplMap::StoragePartitionConfig c7("", "abc", true); |
| 23 StoragePartitionImpl::StoragePartitionConfig c8("a", "abc", false); | 23 StoragePartitionImplMap::StoragePartitionConfig c8("a", "abc", false); |
| 24 StoragePartitionImpl::StoragePartitionConfig c9("a", "abc", true); | 24 StoragePartitionImplMap::StoragePartitionConfig c9("a", "abc", true); |
| 25 | 25 |
| 26 StoragePartitionImpl::StoragePartitionConfigLess less; | 26 StoragePartitionImplMap::StoragePartitionConfigLess less; |
| 27 | 27 |
| 28 // Let's ensure basic comparison works. | 28 // Let's ensure basic comparison works. |
| 29 EXPECT_TRUE(less(c1, c3)); | 29 EXPECT_TRUE(less(c1, c3)); |
| 30 EXPECT_TRUE(less(c1, c4)); | 30 EXPECT_TRUE(less(c1, c4)); |
| 31 EXPECT_TRUE(less(c3, c4)); | 31 EXPECT_TRUE(less(c3, c4)); |
| 32 EXPECT_TRUE(less(c4, c5)); | 32 EXPECT_TRUE(less(c4, c5)); |
| 33 EXPECT_TRUE(less(c4, c8)); | 33 EXPECT_TRUE(less(c4, c8)); |
| 34 EXPECT_TRUE(less(c6, c4)); | 34 EXPECT_TRUE(less(c6, c4)); |
| 35 EXPECT_TRUE(less(c6, c7)); | 35 EXPECT_TRUE(less(c6, c7)); |
| 36 EXPECT_TRUE(less(c8, c9)); | 36 EXPECT_TRUE(less(c8, c9)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 49 EXPECT_FALSE(less(c1, c1)); | 49 EXPECT_FALSE(less(c1, c1)); |
| 50 | 50 |
| 51 // Check for transitivity. | 51 // Check for transitivity. |
| 52 EXPECT_TRUE(less(c1, c4)); | 52 EXPECT_TRUE(less(c1, c4)); |
| 53 | 53 |
| 54 // Let's enforce that two identical elements obey strict weak ordering. | 54 // Let's enforce that two identical elements obey strict weak ordering. |
| 55 EXPECT_TRUE(!less(c1, c2) && !less(c2, c1)); | 55 EXPECT_TRUE(!less(c1, c2) && !less(c2, c1)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace content | 58 } // namespace content |
| OLD | NEW |