OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <utility> |
6 | 7 |
7 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
9 #include "base/macros.h" | 10 #include "base/macros.h" |
10 #include "base/test/test_simple_task_runner.h" | 11 #include "base/test/test_simple_task_runner.h" |
11 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
12 #include "content/browser/browser_thread_impl.h" | 13 #include "content/browser/browser_thread_impl.h" |
13 #include "content/browser/indexed_db/indexed_db_connection.h" | 14 #include "content/browser/indexed_db/indexed_db_connection.h" |
14 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 15 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
15 #include "content/browser/indexed_db/indexed_db_factory_impl.h" | 16 #include "content/browser/indexed_db/indexed_db_factory_impl.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 ForceCloseDBCallbacks(scoped_refptr<IndexedDBContextImpl> idb_context, | 131 ForceCloseDBCallbacks(scoped_refptr<IndexedDBContextImpl> idb_context, |
131 const GURL& origin_url) | 132 const GURL& origin_url) |
132 : IndexedDBCallbacks(NULL, 0, 0), | 133 : IndexedDBCallbacks(NULL, 0, 0), |
133 idb_context_(idb_context), | 134 idb_context_(idb_context), |
134 origin_url_(origin_url) {} | 135 origin_url_(origin_url) {} |
135 | 136 |
136 void OnSuccess() override {} | 137 void OnSuccess() override {} |
137 void OnSuccess(const std::vector<base::string16>&) override {} | 138 void OnSuccess(const std::vector<base::string16>&) override {} |
138 void OnSuccess(scoped_ptr<IndexedDBConnection> connection, | 139 void OnSuccess(scoped_ptr<IndexedDBConnection> connection, |
139 const IndexedDBDatabaseMetadata& metadata) override { | 140 const IndexedDBDatabaseMetadata& metadata) override { |
140 connection_ = connection.Pass(); | 141 connection_ = std::move(connection); |
141 idb_context_->ConnectionOpened(origin_url_, connection_.get()); | 142 idb_context_->ConnectionOpened(origin_url_, connection_.get()); |
142 } | 143 } |
143 | 144 |
144 IndexedDBConnection* connection() { return connection_.get(); } | 145 IndexedDBConnection* connection() { return connection_.get(); } |
145 | 146 |
146 protected: | 147 protected: |
147 ~ForceCloseDBCallbacks() override {} | 148 ~ForceCloseDBCallbacks() override {} |
148 | 149 |
149 private: | 150 private: |
150 scoped_refptr<IndexedDBContextImpl> idb_context_; | 151 scoped_refptr<IndexedDBContextImpl> idb_context_; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 289 |
289 // Simulate the write failure. | 290 // Simulate the write failure. |
290 leveldb::Status status = leveldb::Status::IOError("Simulated failure"); | 291 leveldb::Status status = leveldb::Status::IOError("Simulated failure"); |
291 callbacks->connection()->database()->TransactionCommitFailed(status); | 292 callbacks->connection()->database()->TransactionCommitFailed(status); |
292 | 293 |
293 EXPECT_TRUE(db_callbacks->forced_close_called()); | 294 EXPECT_TRUE(db_callbacks->forced_close_called()); |
294 EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin)); | 295 EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin)); |
295 } | 296 } |
296 | 297 |
297 } // namespace content | 298 } // namespace content |
OLD | NEW |