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

Unified Diff: webkit/dom_storage/dom_storage_map_unittest.cc

Issue 9594038: Relax strict quota limit checks when reading pre-existing DomStorage database files. The other chec… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/dom_storage/dom_storage_map.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/dom_storage/dom_storage_map_unittest.cc
===================================================================
--- webkit/dom_storage/dom_storage_map_unittest.cc (revision 125211)
+++ webkit/dom_storage/dom_storage_map_unittest.cc (working copy)
@@ -37,7 +37,7 @@
copy = map->DeepCopy();
EXPECT_EQ(0u, copy->Length());
EXPECT_EQ(0u, copy->bytes_used());
- EXPECT_TRUE(map->SwapValues(&swap));
+ map->SwapValues(&swap);
EXPECT_TRUE(swap.empty());
// Check the behavior of a map containing some values.
@@ -76,7 +76,7 @@
EXPECT_TRUE(copy->Key(2).is_null());
EXPECT_EQ(kItemBytes + kItem2Bytes, copy->bytes_used());
- EXPECT_TRUE(map->SwapValues(&swap));
+ map->SwapValues(&swap);
EXPECT_EQ(2ul, swap.size());
EXPECT_EQ(0u, map->Length());
EXPECT_EQ(0u, map->bytes_used());
@@ -105,16 +105,20 @@
EXPECT_TRUE(map->SetItem(kKey2, kValue, &old_nullable_value));
EXPECT_EQ(1u, map->Length());
+ // Verify that the SwapValues method does not do quota checking.
ValuesMap swap;
- EXPECT_TRUE(map->SwapValues(&swap));
- EXPECT_EQ(0u, map->Length());
-
swap[kKey] = NullableString16(kValue, false);
swap[kKey2] = NullableString16(kValue, false);
+ map->SwapValues(&swap);
+ EXPECT_GT(map->bytes_used(), kQuota);
- // swap is now too big to fit in the map, the swap should fail.
- EXPECT_FALSE(map->SwapValues(&swap));
- EXPECT_EQ(0u, map->Length());
+ // When overbudget, a new value of greater size the the existing value can
benm (inactive) 2012/03/07 23:25:07 s/the/than/ ?
+ // not be set, but a new value of lesser or equal size can be set.
+ EXPECT_TRUE(map->SetItem(kKey, kValue, &old_nullable_value));
+ EXPECT_FALSE(map->SetItem(kKey, string16(kValue + kValue),
+ &old_nullable_value));
+ EXPECT_TRUE(map->SetItem(kKey, string16(), &old_nullable_value));
+ EXPECT_EQ(kValue, old_nullable_value.string());
}
} // namespace dom_storage
« no previous file with comments | « webkit/dom_storage/dom_storage_map.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698