Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: content/browser/storage_partition_impl_unittest.cc

Issue 11366140: Fix on-disk structure for persistent storage in webview tags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address Charlie's comments Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/storage_partition_impl_map_unittest.cc ('k') | content/content_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/storage_partition_impl.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 namespace content {
9
10 class StoragePartitionConfigTest : public testing::Test {
11 };
12
13 // Test that the Less comparison function is implemented properly to uniquely
14 // identify storage partitions used as keys in a std::map.
15 TEST_F(StoragePartitionConfigTest, OperatorLess) {
16 StoragePartitionImpl::StoragePartitionConfig c1("", "", false);
17 StoragePartitionImpl::StoragePartitionConfig c2("", "", false);
18 StoragePartitionImpl::StoragePartitionConfig c3("", "", true);
19 StoragePartitionImpl::StoragePartitionConfig c4("a", "", true);
20 StoragePartitionImpl::StoragePartitionConfig c5("b", "", true);
21 StoragePartitionImpl::StoragePartitionConfig c6("", "abc", false);
22 StoragePartitionImpl::StoragePartitionConfig c7("", "abc", true);
23 StoragePartitionImpl::StoragePartitionConfig c8("a", "abc", false);
24 StoragePartitionImpl::StoragePartitionConfig c9("a", "abc", true);
25
26 StoragePartitionImpl::StoragePartitionConfigLess less;
27
28 // Let's ensure basic comparison works.
29 EXPECT_TRUE(less(c1, c3));
30 EXPECT_TRUE(less(c1, c4));
31 EXPECT_TRUE(less(c3, c4));
32 EXPECT_TRUE(less(c4, c5));
33 EXPECT_TRUE(less(c4, c8));
34 EXPECT_TRUE(less(c6, c4));
35 EXPECT_TRUE(less(c6, c7));
36 EXPECT_TRUE(less(c8, c9));
37
38 // Now, ensure antisymmetry for each pair we've tested.
39 EXPECT_FALSE(less(c3, c1));
40 EXPECT_FALSE(less(c4, c1));
41 EXPECT_FALSE(less(c4, c3));
42 EXPECT_FALSE(less(c5, c4));
43 EXPECT_FALSE(less(c8, c4));
44 EXPECT_FALSE(less(c4, c6));
45 EXPECT_FALSE(less(c7, c6));
46 EXPECT_FALSE(less(c9, c8));
47
48 // Check for irreflexivity.
49 EXPECT_FALSE(less(c1, c1));
50
51 // Check for transitivity.
52 EXPECT_TRUE(less(c1, c4));
53
54 // Let's enforce that two identical elements obey strict weak ordering.
55 EXPECT_TRUE(!less(c1, c2) && !less(c2, c1));
56 }
57
58 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/storage_partition_impl_map_unittest.cc ('k') | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698