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

Unified Diff: Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp

Issue 10377101: Merge 116333 - IndexedDB: LevelDB coding for bools is broken (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 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 | « Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp
===================================================================
--- Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp (revision 116704)
+++ Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp (working copy)
@@ -83,6 +83,20 @@
EXPECT_EQ(expected, encodeByte(c));
}
+TEST(IDBLevelDBCodingTest, EncodeBool)
+{
+ {
+ Vector<char> expected;
+ expected.append(1);
+ EXPECT_EQ(expected, encodeBool(true));
+ }
+ {
+ Vector<char> expected;
+ expected.append(0);
+ EXPECT_EQ(expected, encodeBool(false));
+ }
+}
+
TEST(IDBLevelDBCodingTest, MaxIDBKey)
{
Vector<char> maxKey = maxIDBKey();
@@ -126,6 +140,20 @@
EXPECT_EQ(static_cast<size_t>(4), encodeInt(0xffffffff).size());
}
+TEST(IDBLevelDBCodingTest, DecodeBool)
+{
+ {
+ Vector<char> encoded;
+ encoded.append(1);
+ EXPECT_TRUE(decodeBool(encoded.data(), encoded.data() + encoded.size()));
+ }
+ {
+ Vector<char> encoded;
+ encoded.append(0);
+ EXPECT_FALSE(decodeBool(encoded.data(), encoded.data() + encoded.size()));
+ }
+}
+
TEST(IDBLevelDBCodingTest, DecodeInt)
{
Vector<int64_t> testCases;
« no previous file with comments | « Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698