| 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 "base/files/file_util.h" | 5 #include "base/files/file_util.h" |
| 6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
| 7 #include "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
| 8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
| 9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
| 10 #include "content/browser/indexed_db/indexed_db_connection.h" | 10 #include "content/browser/indexed_db/indexed_db_connection.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 123 } |
| 124 | 124 |
| 125 class ForceCloseDBCallbacks : public IndexedDBCallbacks { | 125 class ForceCloseDBCallbacks : public IndexedDBCallbacks { |
| 126 public: | 126 public: |
| 127 ForceCloseDBCallbacks(scoped_refptr<IndexedDBContextImpl> idb_context, | 127 ForceCloseDBCallbacks(scoped_refptr<IndexedDBContextImpl> idb_context, |
| 128 const GURL& origin_url) | 128 const GURL& origin_url) |
| 129 : IndexedDBCallbacks(NULL, 0, 0), | 129 : IndexedDBCallbacks(NULL, 0, 0), |
| 130 idb_context_(idb_context), | 130 idb_context_(idb_context), |
| 131 origin_url_(origin_url) {} | 131 origin_url_(origin_url) {} |
| 132 | 132 |
| 133 virtual void OnSuccess() OVERRIDE {} | 133 virtual void OnSuccess() override {} |
| 134 virtual void OnSuccess(const std::vector<base::string16>&) OVERRIDE {} | 134 virtual void OnSuccess(const std::vector<base::string16>&) override {} |
| 135 virtual void OnSuccess(scoped_ptr<IndexedDBConnection> connection, | 135 virtual void OnSuccess(scoped_ptr<IndexedDBConnection> connection, |
| 136 const IndexedDBDatabaseMetadata& metadata) OVERRIDE { | 136 const IndexedDBDatabaseMetadata& metadata) override { |
| 137 connection_ = connection.Pass(); | 137 connection_ = connection.Pass(); |
| 138 idb_context_->ConnectionOpened(origin_url_, connection_.get()); | 138 idb_context_->ConnectionOpened(origin_url_, connection_.get()); |
| 139 } | 139 } |
| 140 | 140 |
| 141 IndexedDBConnection* connection() { return connection_.get(); } | 141 IndexedDBConnection* connection() { return connection_.get(); } |
| 142 | 142 |
| 143 protected: | 143 protected: |
| 144 virtual ~ForceCloseDBCallbacks() {} | 144 virtual ~ForceCloseDBCallbacks() {} |
| 145 | 145 |
| 146 private: | 146 private: |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 // Simulate the write failure. | 286 // Simulate the write failure. |
| 287 leveldb::Status status = leveldb::Status::IOError("Simulated failure"); | 287 leveldb::Status status = leveldb::Status::IOError("Simulated failure"); |
| 288 callbacks->connection()->database()->TransactionCommitFailed(status); | 288 callbacks->connection()->database()->TransactionCommitFailed(status); |
| 289 | 289 |
| 290 EXPECT_TRUE(db_callbacks->forced_close_called()); | 290 EXPECT_TRUE(db_callbacks->forced_close_called()); |
| 291 EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin)); | 291 EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin)); |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace content | 294 } // namespace content |
| OLD | NEW |