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

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

Issue 240003010: The chromium-side backchannel plumbing for blobs in IDB. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged out Created 6 years, 8 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/child/indexed_db/webidbcursor_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/indexed_db/webidbcursor_impl_unittest.cc
diff --git a/content/child/indexed_db/webidbcursor_impl_unittest.cc b/content/child/indexed_db/webidbcursor_impl_unittest.cc
index 33494e049930fc4ab8f59baabefa29c0d8752a3f..a131096be23a606db278bbd6797a119d3b10e1a8 100644
--- a/content/child/indexed_db/webidbcursor_impl_unittest.cc
+++ b/content/child/indexed_db/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 {
@@ -93,18 +95,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
@@ -171,10 +179,13 @@ TEST_F(WebIDBCursorImplTest, 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
@@ -183,11 +194,14 @@ TEST_F(WebIDBCursorImplTest, 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());
}
}
@@ -226,10 +240,13 @@ TEST_F(WebIDBCursorImplTest, AdvancePrefetchTest) {
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
@@ -298,7 +315,8 @@ TEST_F(WebIDBCursorImplTest, PrefetchReset) {
std::vector<IndexedDBKey> keys(prefetch_count);
std::vector<IndexedDBKey> primary_keys(prefetch_count);
std::vector<WebData> values(prefetch_count);
- cursor.SetPrefetchData(keys, primary_keys, values);
+ std::vector<WebVector<WebBlobInfo> > blob_info(prefetch_count);
+ cursor.SetPrefetchData(keys, primary_keys, values, blob_info);
// No reset should have been sent since prefetch data hasn't been used.
EXPECT_EQ(0, dispatcher_->reset_calls());
« no previous file with comments | « content/child/indexed_db/webidbcursor_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698