| 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" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 blink::WebIDBDatabase::NormalTask, | 205 blink::WebIDBDatabase::NormalTask, |
| 206 new CursorCallbacks(&cursor)); | 206 new CursorCallbacks(&cursor)); |
| 207 | 207 |
| 208 // Verify that the transaction id was captured. | 208 // Verify that the transaction id was captured. |
| 209 EXPECT_EQ(1UL, dispatcher.cursor_transaction_ids_.size()); | 209 EXPECT_EQ(1UL, dispatcher.cursor_transaction_ids_.size()); |
| 210 EXPECT_FALSE(cursor.get()); | 210 EXPECT_FALSE(cursor.get()); |
| 211 | 211 |
| 212 int32 ipc_callbacks_id = dispatcher.cursor_transaction_ids_.begin()->first; | 212 int32 ipc_callbacks_id = dispatcher.cursor_transaction_ids_.begin()->first; |
| 213 | 213 |
| 214 // Now simululate a "null cursor" response. | 214 // Now simululate a "null cursor" response. |
| 215 dispatcher.OnSuccessValue( | 215 IndexedDBMsg_CallbacksSuccessValue_Params params; |
| 216 dispatcher.CurrentWorkerId(), ipc_callbacks_id, std::string()); | 216 params.ipc_thread_id = dispatcher.CurrentWorkerId(); |
| 217 params.ipc_callbacks_id = ipc_callbacks_id; |
| 218 dispatcher.OnSuccessValue(params); |
| 217 | 219 |
| 218 // Ensure the map result was deleted. | 220 // Ensure the map result was deleted. |
| 219 EXPECT_EQ(0UL, dispatcher.cursor_transaction_ids_.size()); | 221 EXPECT_EQ(0UL, dispatcher.cursor_transaction_ids_.size()); |
| 220 EXPECT_FALSE(cursor.get()); | 222 EXPECT_FALSE(cursor.get()); |
| 221 } | 223 } |
| 222 } | 224 } |
| 223 | 225 |
| 224 namespace { | 226 namespace { |
| 225 | 227 |
| 226 class MockCursor : public WebIDBCursorImpl { | 228 class MockCursor : public WebIDBCursorImpl { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 cursor1_transaction_id); | 317 cursor1_transaction_id); |
| 316 | 318 |
| 317 EXPECT_EQ(2, cursor1->reset_count()); | 319 EXPECT_EQ(2, cursor1->reset_count()); |
| 318 EXPECT_EQ(0, cursor2->reset_count()); | 320 EXPECT_EQ(0, cursor2->reset_count()); |
| 319 | 321 |
| 320 cursor1.reset(); | 322 cursor1.reset(); |
| 321 cursor2.reset(); | 323 cursor2.reset(); |
| 322 } | 324 } |
| 323 | 325 |
| 324 } // namespace content | 326 } // namespace content |
| OLD | NEW |