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

Unified Diff: content/common/indexed_db/indexed_db_key_unittest.cc

Issue 19752007: Use builders to convert between WebKit and content IDB types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | « content/common/indexed_db/indexed_db_key_range.cc ('k') | content/content_child.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/indexed_db/indexed_db_key_unittest.cc
diff --git a/content/common/indexed_db/indexed_db_key_unittest.cc b/content/common/indexed_db/indexed_db_key_unittest.cc
index f6ff403fba5f624b7123a8440487f433711bf191..3c5191513c7d30ed79c3c2f6dc6f635fe0a7653e 100644
--- a/content/common/indexed_db/indexed_db_key_unittest.cc
+++ b/content/common/indexed_db/indexed_db_key_unittest.cc
@@ -9,10 +9,6 @@
#include "base/strings/string16.h"
#include "content/common/indexed_db/indexed_db_key.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/public/platform/WebIDBKey.h"
-
-using WebKit::WebIDBKey;
-using WebKit::WebVector;
namespace content {
@@ -20,51 +16,40 @@ namespace {
TEST(IndexedDBKeyTest, KeySizeEstimates) {
std::vector<IndexedDBKey> keys;
- std::vector<WebIDBKey> web_keys;
std::vector<size_t> estimates;
keys.push_back(IndexedDBKey());
- web_keys.push_back(WebIDBKey::createInvalid());
estimates.push_back(static_cast<size_t>(16)); // Overhead.
keys.push_back(IndexedDBKey(WebKit::WebIDBKeyTypeNull));
- web_keys.push_back(WebIDBKey::createNull());
estimates.push_back(static_cast<size_t>(16));
double number = 3.14159;
keys.push_back(IndexedDBKey(number, WebKit::WebIDBKeyTypeNumber));
- web_keys.push_back(WebIDBKey::createNumber(number));
estimates.push_back(static_cast<size_t>(24)); // Overhead + sizeof(double).
double date = 1370884329.0;
keys.push_back(IndexedDBKey(date, WebKit::WebIDBKeyTypeDate));
- web_keys.push_back(WebIDBKey::createDate(date));
estimates.push_back(static_cast<size_t>(24)); // Overhead + sizeof(double).
const string16 string(1024, static_cast<char16>('X'));
keys.push_back(IndexedDBKey(string));
- web_keys.push_back(WebIDBKey::createString(string));
// Overhead + string length * sizeof(char16).
estimates.push_back(static_cast<size_t>(2064));
const size_t array_size = 1024;
IndexedDBKey::KeyArray array;
- WebVector<WebIDBKey> web_array(static_cast<size_t>(array_size));
double value = 123.456;
for (size_t i = 0; i < array_size; ++i) {
array.push_back(IndexedDBKey(value, WebKit::WebIDBKeyTypeNumber));
- web_array[i] = WebIDBKey::createNumber(value);
}
keys.push_back(IndexedDBKey(array));
- web_keys.push_back(WebIDBKey::createArray(array));
// Overhead + array length * (Overhead + sizeof(double)).
estimates.push_back(static_cast<size_t>(24592));
- ASSERT_EQ(keys.size(), web_keys.size());
ASSERT_EQ(keys.size(), estimates.size());
for (size_t i = 0; i < keys.size(); ++i) {
EXPECT_EQ(estimates[i], keys[i].size_estimate());
- EXPECT_EQ(estimates[i], IndexedDBKey(web_keys[i]).size_estimate());
}
}
« no previous file with comments | « content/common/indexed_db/indexed_db_key_range.cc ('k') | content/content_child.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698