| 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/message_loop/message_loop_proxy.h" | 6 #include "base/message_loop/message_loop_proxy.h" |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 8 #include "content/child/indexed_db/indexed_db_dispatcher.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" |
| 11 #include "content/common/indexed_db/indexed_db_key.h" | 11 #include "content/common/indexed_db/indexed_db_key.h" |
| 12 #include "content/common/indexed_db/indexed_db_key_range.h" | 12 #include "content/common/indexed_db/indexed_db_key_range.h" |
| 13 #include "content/common/indexed_db/indexed_db_messages.h" | 13 #include "content/common/indexed_db/indexed_db_messages.h" |
| 14 #include "ipc/ipc_sync_message_filter.h" | 14 #include "ipc/ipc_sync_message_filter.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "third_party/WebKit/public/platform/WebBlobInfo.h" | 16 #include "third_party/WebKit/public/platform/WebBlobInfo.h" |
| 17 #include "third_party/WebKit/public/platform/WebData.h" | 17 #include "third_party/WebKit/public/platform/WebData.h" |
| 18 #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" | 18 #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" |
| 19 #include "third_party/WebKit/public/web/WebHeap.h" | 19 #include "third_party/WebKit/public/web/WebHeap.h" |
| 20 | 20 |
| 21 using blink::WebBlobInfo; | 21 using blink::WebBlobInfo; |
| 22 using blink::WebData; | 22 using blink::WebData; |
| 23 using blink::WebIDBCallbacks; | 23 using blink::WebIDBCallbacks; |
| 24 using blink::WebIDBCursor; | 24 using blink::WebIDBCursor; |
| 25 using blink::WebIDBDatabase; | 25 using blink::WebIDBDatabase; |
| 26 using blink::WebIDBDatabaseError; | 26 using blink::WebIDBDatabaseError; |
| 27 using blink::WebIDBKey; | 27 using blink::WebIDBKey; |
| 28 using blink::WebIDBValue; |
| 28 using blink::WebVector; | 29 using blink::WebVector; |
| 29 | 30 |
| 30 namespace content { | 31 namespace content { |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| 33 class MockCallbacks : public WebIDBCallbacks { | 34 class MockCallbacks : public WebIDBCallbacks { |
| 34 public: | 35 public: |
| 35 MockCallbacks() : error_seen_(false) {} | 36 MockCallbacks() : error_seen_(false) {} |
| 36 | 37 |
| 37 virtual void onError(const WebIDBDatabaseError&) { error_seen_ = true; } | 38 virtual void onError(const WebIDBDatabaseError&) { error_seen_ = true; } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 EXPECT_TRUE(callbacks.error_seen()); | 134 EXPECT_TRUE(callbacks.error_seen()); |
| 134 } | 135 } |
| 135 | 136 |
| 136 namespace { | 137 namespace { |
| 137 | 138 |
| 138 class CursorCallbacks : public WebIDBCallbacks { | 139 class CursorCallbacks : public WebIDBCallbacks { |
| 139 public: | 140 public: |
| 140 explicit CursorCallbacks(scoped_ptr<WebIDBCursor>* cursor) | 141 explicit CursorCallbacks(scoped_ptr<WebIDBCursor>* cursor) |
| 141 : cursor_(cursor) {} | 142 : cursor_(cursor) {} |
| 142 | 143 |
| 143 virtual void onSuccess(const WebData&, | 144 virtual void onSuccess(const WebIDBValue&) override {} |
| 144 const WebVector<WebBlobInfo>&) override {} | |
| 145 virtual void onSuccess(WebIDBCursor* cursor, | 145 virtual void onSuccess(WebIDBCursor* cursor, |
| 146 const WebIDBKey& key, | 146 const WebIDBKey& key, |
| 147 const WebIDBKey& primaryKey, | 147 const WebIDBKey& primaryKey, |
| 148 const WebData& value, | 148 const WebData& value, |
| 149 const WebVector<WebBlobInfo>&) override { | 149 const WebVector<WebBlobInfo>&) override { |
| 150 cursor_->reset(cursor); | 150 cursor_->reset(cursor); |
| 151 } | 151 } |
| 152 | 152 |
| 153 private: | 153 private: |
| 154 scoped_ptr<WebIDBCursor>* cursor_; | 154 scoped_ptr<WebIDBCursor>* cursor_; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 cursor1_transaction_id); | 340 cursor1_transaction_id); |
| 341 | 341 |
| 342 EXPECT_EQ(2, cursor1->reset_count()); | 342 EXPECT_EQ(2, cursor1->reset_count()); |
| 343 EXPECT_EQ(0, cursor2->reset_count()); | 343 EXPECT_EQ(0, cursor2->reset_count()); |
| 344 | 344 |
| 345 cursor1.reset(); | 345 cursor1.reset(); |
| 346 cursor2.reset(); | 346 cursor2.reset(); |
| 347 } | 347 } |
| 348 | 348 |
| 349 } // namespace content | 349 } // namespace content |
| OLD | NEW |