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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 blink::kWebIDBTransactionModeReadOnly); | 144 blink::kWebIDBTransactionModeReadOnly); |
144 | 145 |
145 request->connection()->ForceClose(); | 146 request->connection()->ForceClose(); |
146 | 147 |
147 EXPECT_TRUE(backing_store->HasOneRef()); // local | 148 EXPECT_TRUE(backing_store->HasOneRef()); // local |
148 EXPECT_TRUE(callbacks->abort_called()); | 149 EXPECT_TRUE(callbacks->abort_called()); |
149 } | 150 } |
150 | 151 |
151 class MockCallbacks : public IndexedDBCallbacks { | 152 class MockCallbacks : public IndexedDBCallbacks { |
152 public: | 153 public: |
153 MockCallbacks() : IndexedDBCallbacks(nullptr, url::Origin(), nullptr) {} | 154 MockCallbacks() |
| 155 : IndexedDBCallbacks(nullptr, |
| 156 url::Origin(), |
| 157 nullptr, |
| 158 base::ThreadTaskRunnerHandle::Get()) {} |
154 | 159 |
155 void OnBlocked(int64_t existing_version) override { blocked_called_ = true; } | 160 void OnBlocked(int64_t existing_version) override { blocked_called_ = true; } |
156 void OnSuccess(int64_t result) override { success_called_ = true; } | 161 void OnSuccess(int64_t result) override { success_called_ = true; } |
157 void OnError(const IndexedDBDatabaseError& error) override { | 162 void OnError(const IndexedDBDatabaseError& error) override { |
158 error_called_ = true; | 163 error_called_ = true; |
159 } | 164 } |
160 | 165 |
161 bool blocked_called() const { return blocked_called_; } | 166 bool blocked_called() const { return blocked_called_; } |
162 bool success_called() const { return success_called_; } | 167 bool success_called() const { return success_called_; } |
163 bool error_called() const { return error_called_; } | 168 bool error_called() const { return error_called_; } |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 EXPECT_EQ(1ULL, db_->metadata().object_stores.size()); | 431 EXPECT_EQ(1ULL, db_->metadata().object_stores.size()); |
427 | 432 |
428 // This will execute the Put then Delete. | 433 // This will execute the Put then Delete. |
429 RunPostedTasks(); | 434 RunPostedTasks(); |
430 EXPECT_EQ(0ULL, db_->metadata().object_stores.size()); | 435 EXPECT_EQ(0ULL, db_->metadata().object_stores.size()); |
431 | 436 |
432 transaction_->Commit(); // Cleans up the object hierarchy. | 437 transaction_->Commit(); // Cleans up the object hierarchy. |
433 } | 438 } |
434 | 439 |
435 } // namespace content | 440 } // namespace content |
OLD | NEW |