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

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

Issue 12310146: Merge 143347 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 10 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 144088)
+++ Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp (working copy)
@@ -116,6 +116,14 @@
}
}
+static int compareKeys(const Vector<char>& a, const Vector<char>& b)
+{
+ bool ok;
+ int result = compareEncodedIDBKeys(a, b, ok);
+ EXPECT_TRUE(ok);
+ return result;
+}
+
TEST(IDBLevelDBCodingTest, MaxIDBKey)
{
Vector<char> maxKey = maxIDBKey();
@@ -126,11 +134,11 @@
Vector<char> numberKey = encodeIDBKey(*IDBKey::createNumber(3.14));
Vector<char> dateKey = encodeIDBKey(*IDBKey::createDate(1000000));
- EXPECT_GT(compareEncodedIDBKeys(maxKey, minKey), 0);
- EXPECT_GT(compareEncodedIDBKeys(maxKey, arrayKey), 0);
- EXPECT_GT(compareEncodedIDBKeys(maxKey, stringKey), 0);
- EXPECT_GT(compareEncodedIDBKeys(maxKey, numberKey), 0);
- EXPECT_GT(compareEncodedIDBKeys(maxKey, dateKey), 0);
+ EXPECT_GT(compareKeys(maxKey, minKey), 0);
+ EXPECT_GT(compareKeys(maxKey, arrayKey), 0);
+ EXPECT_GT(compareKeys(maxKey, stringKey), 0);
+ EXPECT_GT(compareKeys(maxKey, numberKey), 0);
+ EXPECT_GT(compareKeys(maxKey, dateKey), 0);
}
TEST(IDBLevelDBCodingTest, MinIDBKey)
@@ -143,11 +151,11 @@
Vector<char> numberKey = encodeIDBKey(*IDBKey::createNumber(3.14));
Vector<char> dateKey = encodeIDBKey(*IDBKey::createDate(1000000));
- EXPECT_LT(compareEncodedIDBKeys(minKey, maxKey), 0);
- EXPECT_LT(compareEncodedIDBKeys(minKey, arrayKey), 0);
- EXPECT_LT(compareEncodedIDBKeys(minKey, stringKey), 0);
- EXPECT_LT(compareEncodedIDBKeys(minKey, numberKey), 0);
- EXPECT_LT(compareEncodedIDBKeys(minKey, dateKey), 0);
+ EXPECT_LT(compareKeys(minKey, maxKey), 0);
+ EXPECT_LT(compareKeys(minKey, arrayKey), 0);
+ EXPECT_LT(compareKeys(minKey, stringKey), 0);
+ EXPECT_LT(compareKeys(minKey, numberKey), 0);
+ EXPECT_LT(compareKeys(minKey, dateKey), 0);
}
TEST(IDBLevelDBCodingTest, EncodeInt)
@@ -322,7 +330,9 @@
static int compareStrings(const char* p, const char* limitP, const char* q, const char* limitQ)
{
- int result = compareEncodedStringsWithLength(p, limitP, q, limitQ);
+ bool ok;
+ int result = compareEncodedStringsWithLength(p, limitP, q, limitQ, ok);
+ EXPECT_TRUE(ok);
EXPECT_EQ(p, limitP);
EXPECT_EQ(q, limitQ);
return result;
@@ -631,10 +641,10 @@
EXPECT_EQ(encodedB.data() + encodedB.size(), q);
EXPECT_EQ(encodedB, extractedB);
- EXPECT_LT(compareEncodedIDBKeys(extractedA, extractedB), 0);
- EXPECT_GT(compareEncodedIDBKeys(extractedB, extractedA), 0);
- EXPECT_EQ(compareEncodedIDBKeys(extractedA, extractedA), 0);
- EXPECT_EQ(compareEncodedIDBKeys(extractedB, extractedB), 0);
+ EXPECT_LT(compareKeys(extractedA, extractedB), 0);
+ EXPECT_GT(compareKeys(extractedB, extractedA), 0);
+ EXPECT_EQ(compareKeys(extractedA, extractedA), 0);
+ EXPECT_EQ(compareKeys(extractedB, extractedB), 0);
EXPECT_EQ(0, extractEncodedIDBKey(encodedA.data(), encodedA.data() + encodedA.size() - 1, &extractedA));
}
« 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