| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/values.h" | 6 #include "base/values.h" |
| 7 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 7 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
| 8 #include "content/child/indexed_db/indexed_db_key_builders.h" | 8 #include "content/child/indexed_db/indexed_db_key_builders.h" |
| 9 #include "content/child/indexed_db/webidbcursor_impl.h" | 9 #include "content/child/indexed_db/webidbcursor_impl.h" |
| 10 #include "content/child/thread_safe_sender.h" | 10 #include "content/child/thread_safe_sender.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 int32 destroyed_cursor_id_; | 92 int32 destroyed_cursor_id_; |
| 93 scoped_ptr<WebIDBCallbacks> callbacks_; | 93 scoped_ptr<WebIDBCallbacks> callbacks_; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 class MockContinueCallbacks : public WebIDBCallbacks { | 96 class MockContinueCallbacks : public WebIDBCallbacks { |
| 97 public: | 97 public: |
| 98 MockContinueCallbacks(IndexedDBKey* key = 0, | 98 MockContinueCallbacks(IndexedDBKey* key = 0, |
| 99 WebVector<WebBlobInfo>* webBlobInfo = 0) | 99 WebVector<WebBlobInfo>* webBlobInfo = 0) |
| 100 : key_(key), web_blob_info_(webBlobInfo) {} | 100 : key_(key), web_blob_info_(webBlobInfo) {} |
| 101 | 101 |
| 102 virtual void onSuccess(const WebIDBKey& key, | 102 void onSuccess(const WebIDBKey& key, |
| 103 const WebIDBKey& primaryKey, | 103 const WebIDBKey& primaryKey, |
| 104 const WebData& value, | 104 const WebData& value, |
| 105 const WebVector<WebBlobInfo>& webBlobInfo) override { | 105 const WebVector<WebBlobInfo>& webBlobInfo) override { |
| 106 if (key_) | 106 if (key_) |
| 107 *key_ = IndexedDBKeyBuilder::Build(key); | 107 *key_ = IndexedDBKeyBuilder::Build(key); |
| 108 if (web_blob_info_) | 108 if (web_blob_info_) |
| 109 *web_blob_info_ = webBlobInfo; | 109 *web_blob_info_ = webBlobInfo; |
| 110 } | 110 } |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 IndexedDBKey* key_; | 113 IndexedDBKey* key_; |
| 114 WebVector<WebBlobInfo>* web_blob_info_; | 114 WebVector<WebBlobInfo>* web_blob_info_; |
| 115 }; | 115 }; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 // The real dispatcher would call cursor->CachedContinue(), so do that: | 320 // The real dispatcher would call cursor->CachedContinue(), so do that: |
| 321 scoped_ptr<WebIDBCallbacks> callbacks(new MockContinueCallbacks()); | 321 scoped_ptr<WebIDBCallbacks> callbacks(new MockContinueCallbacks()); |
| 322 cursor.CachedContinue(callbacks.get()); | 322 cursor.CachedContinue(callbacks.get()); |
| 323 | 323 |
| 324 // Now the cursor should have reset the rest of the cache. | 324 // Now the cursor should have reset the rest of the cache. |
| 325 EXPECT_EQ(1, dispatcher_->reset_calls()); | 325 EXPECT_EQ(1, dispatcher_->reset_calls()); |
| 326 EXPECT_EQ(1, dispatcher_->last_used_count()); | 326 EXPECT_EQ(1, dispatcher_->last_used_count()); |
| 327 } | 327 } |
| 328 | 328 |
| 329 } // namespace content | 329 } // namespace content |
| OLD | NEW |