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

Unified Diff: content/child/indexed_db/proxy_webidbcursor_impl_unittest.cc

Issue 18023022: Blob support for IDB [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle the rest of Josh's feedback. Created 7 years 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
Index: content/child/indexed_db/proxy_webidbcursor_impl_unittest.cc
diff --git a/content/child/indexed_db/proxy_webidbcursor_impl_unittest.cc b/content/child/indexed_db/proxy_webidbcursor_impl_unittest.cc
index d9a23b60c6266eafbdf9a19eece412cf72121bbb..7bc21e8c1794fb46bd877f8d0d7c6812e1fcf410 100644
--- a/content/child/indexed_db/proxy_webidbcursor_impl_unittest.cc
+++ b/content/child/indexed_db/proxy_webidbcursor_impl_unittest.cc
@@ -14,11 +14,13 @@
#include "third_party/WebKit/public/platform/WebData.h"
#include "third_party/WebKit/public/platform/WebIDBCallbacks.h"
+using blink::WebBlobInfo;
using blink::WebData;
using blink::WebIDBCallbacks;
using blink::WebIDBDatabase;
using blink::WebIDBKey;
using blink::WebIDBKeyTypeNumber;
+using blink::WebVector;
namespace content {
@@ -68,18 +70,24 @@ class MockDispatcher : public IndexedDBDispatcher {
class MockContinueCallbacks : public WebIDBCallbacks {
public:
- MockContinueCallbacks(IndexedDBKey* key = 0) : key_(key) {}
+ MockContinueCallbacks(IndexedDBKey* key = 0,
+ WebVector<WebBlobInfo>* webBlobInfo = 0)
+ : key_(key), webBlobInfo_(webBlobInfo) {}
virtual void onSuccess(const WebIDBKey& key,
const WebIDBKey& primaryKey,
- const WebData& value) {
+ const WebData& value,
+ const WebVector<WebBlobInfo>& webBlobInfo) OVERRIDE {
if (key_)
*key_ = IndexedDBKeyBuilder::Build(key);
+ if (webBlobInfo_)
+ *webBlobInfo_ = webBlobInfo;
}
private:
IndexedDBKey* key_;
+ WebVector<WebBlobInfo>* webBlobInfo_;
};
} // namespace
@@ -135,10 +143,13 @@ TEST(RendererWebIDBCursorImplTest, PrefetchTest) {
std::vector<IndexedDBKey> keys;
std::vector<IndexedDBKey> primary_keys(prefetch_count);
std::vector<WebData> values(prefetch_count);
+ std::vector<WebVector<WebBlobInfo> > blob_info;
for (int i = 0; i < prefetch_count; ++i) {
keys.push_back(IndexedDBKey(expected_key + i, WebIDBKeyTypeNumber));
+ blob_info.push_back(
+ WebVector<WebBlobInfo>(static_cast<size_t>(expected_key + i)));
}
- cursor.SetPrefetchData(keys, primary_keys, values);
+ cursor.SetPrefetchData(keys, primary_keys, values, blob_info);
// Note that the real dispatcher would call cursor->CachedContinue()
// immediately after cursor->SetPrefetchData() to service the request
@@ -147,11 +158,14 @@ TEST(RendererWebIDBCursorImplTest, PrefetchTest) {
// Verify that the cache is used for subsequent continue() calls.
for (int i = 0; i < prefetch_count; ++i) {
IndexedDBKey key;
- cursor.continueFunction(null_key, new MockContinueCallbacks(&key));
+ WebVector<WebBlobInfo> web_blob_info;
+ cursor.continueFunction(
+ null_key, new MockContinueCallbacks(&key, &web_blob_info));
EXPECT_EQ(continue_calls, dispatcher.continue_calls());
EXPECT_EQ(repetitions + 1, dispatcher.prefetch_calls());
EXPECT_EQ(WebIDBKeyTypeNumber, key.type());
+ EXPECT_EQ(expected_key, static_cast<int>(web_blob_info.size()));
EXPECT_EQ(expected_key++, key.number());
}
}

Powered by Google App Engine
This is Rietveld 408576698