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 "content/browser/indexed_db/indexed_db_database.h" | 5 #include "content/browser/indexed_db/indexed_db_database.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" |
18 #include "content/browser/indexed_db/indexed_db.h" | 19 #include "content/browser/indexed_db/indexed_db.h" |
19 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 20 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
20 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 21 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
21 #include "content/browser/indexed_db/indexed_db_class_factory.h" | 22 #include "content/browser/indexed_db/indexed_db_class_factory.h" |
22 #include "content/browser/indexed_db/indexed_db_connection.h" | 23 #include "content/browser/indexed_db/indexed_db_connection.h" |
23 #include "content/browser/indexed_db/indexed_db_cursor.h" | 24 #include "content/browser/indexed_db/indexed_db_cursor.h" |
24 #include "content/browser/indexed_db/indexed_db_fake_backing_store.h" | 25 #include "content/browser/indexed_db/indexed_db_fake_backing_store.h" |
25 #include "content/browser/indexed_db/indexed_db_transaction.h" | 26 #include "content/browser/indexed_db/indexed_db_transaction.h" |
26 #include "content/browser/indexed_db/indexed_db_value.h" | 27 #include "content/browser/indexed_db/indexed_db_value.h" |
27 #include "content/browser/indexed_db/mock_indexed_db_callbacks.h" | 28 #include "content/browser/indexed_db/mock_indexed_db_callbacks.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 blink::WebIDBTransactionModeReadOnly); | 146 blink::WebIDBTransactionModeReadOnly); |
146 | 147 |
147 request->connection()->ForceClose(); | 148 request->connection()->ForceClose(); |
148 | 149 |
149 EXPECT_TRUE(backing_store->HasOneRef()); // local | 150 EXPECT_TRUE(backing_store->HasOneRef()); // local |
150 EXPECT_TRUE(callbacks->abort_called()); | 151 EXPECT_TRUE(callbacks->abort_called()); |
151 } | 152 } |
152 | 153 |
153 class MockCallbacks : public IndexedDBCallbacks { | 154 class MockCallbacks : public IndexedDBCallbacks { |
154 public: | 155 public: |
155 MockCallbacks() : IndexedDBCallbacks(nullptr, url::Origin(), nullptr) {} | 156 MockCallbacks() |
| 157 : IndexedDBCallbacks(nullptr, |
| 158 url::Origin(), |
| 159 nullptr, |
| 160 base::ThreadTaskRunnerHandle::Get()) {} |
156 | 161 |
157 void OnBlocked(int64_t existing_version) override { blocked_called_ = true; } | 162 void OnBlocked(int64_t existing_version) override { blocked_called_ = true; } |
158 void OnSuccess(int64_t result) override { success_called_ = true; } | 163 void OnSuccess(int64_t result) override { success_called_ = true; } |
159 void OnError(const IndexedDBDatabaseError& error) override { | 164 void OnError(const IndexedDBDatabaseError& error) override { |
160 error_called_ = true; | 165 error_called_ = true; |
161 } | 166 } |
162 | 167 |
163 bool blocked_called() const { return blocked_called_; } | 168 bool blocked_called() const { return blocked_called_; } |
164 bool success_called() const { return success_called_; } | 169 bool success_called() const { return success_called_; } |
165 bool error_called() const { return error_called_; } | 170 bool error_called() const { return error_called_; } |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 EXPECT_EQ(1ULL, db_->metadata().object_stores.size()); | 433 EXPECT_EQ(1ULL, db_->metadata().object_stores.size()); |
429 | 434 |
430 // This will execute the Put then Delete. | 435 // This will execute the Put then Delete. |
431 RunPostedTasks(); | 436 RunPostedTasks(); |
432 EXPECT_EQ(0ULL, db_->metadata().object_stores.size()); | 437 EXPECT_EQ(0ULL, db_->metadata().object_stores.size()); |
433 | 438 |
434 transaction_->Commit(); // Cleans up the object hierarchy. | 439 transaction_->Commit(); // Cleans up the object hierarchy. |
435 } | 440 } |
436 | 441 |
437 } // namespace content | 442 } // namespace content |
OLD | NEW |