| 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 #include <utility> |
| 7 | 7 |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 // No data was cleared because of SetForceKeepSessionState. | 122 // No data was cleared because of SetForceKeepSessionState. |
| 123 EXPECT_TRUE(base::DirectoryExists(normal_path)); | 123 EXPECT_TRUE(base::DirectoryExists(normal_path)); |
| 124 EXPECT_TRUE(base::DirectoryExists(session_only_path)); | 124 EXPECT_TRUE(base::DirectoryExists(session_only_path)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 class ForceCloseDBCallbacks : public IndexedDBCallbacks { | 127 class ForceCloseDBCallbacks : public IndexedDBCallbacks { |
| 128 public: | 128 public: |
| 129 ForceCloseDBCallbacks(scoped_refptr<IndexedDBContextImpl> idb_context, | 129 ForceCloseDBCallbacks(scoped_refptr<IndexedDBContextImpl> idb_context, |
| 130 const Origin& origin) | 130 const Origin& origin) |
| 131 : IndexedDBCallbacks(nullptr, 0, 0), | 131 : IndexedDBCallbacks(nullptr, origin, nullptr), |
| 132 idb_context_(idb_context), | 132 idb_context_(idb_context), |
| 133 origin_(origin) {} | 133 origin_(origin) {} |
| 134 | 134 |
| 135 void OnSuccess() override {} | 135 void OnSuccess() override {} |
| 136 void OnSuccess(const std::vector<base::string16>&) override {} | 136 void OnSuccess(const std::vector<base::string16>&) override {} |
| 137 void OnSuccess(std::unique_ptr<IndexedDBConnection> connection, | 137 void OnSuccess(std::unique_ptr<IndexedDBConnection> connection, |
| 138 const IndexedDBDatabaseMetadata& metadata) override { | 138 const IndexedDBDatabaseMetadata& metadata) override { |
| 139 connection_ = std::move(connection); | 139 connection_ = std::move(connection); |
| 140 idb_context_->ConnectionOpened(origin_, connection_.get()); | 140 idb_context_->ConnectionOpened(origin_, connection_.get()); |
| 141 } | 141 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 280 |
| 281 // Simulate the write failure. | 281 // Simulate the write failure. |
| 282 leveldb::Status status = leveldb::Status::IOError("Simulated failure"); | 282 leveldb::Status status = leveldb::Status::IOError("Simulated failure"); |
| 283 callbacks->connection()->database()->TransactionCommitFailed(status); | 283 callbacks->connection()->database()->TransactionCommitFailed(status); |
| 284 | 284 |
| 285 EXPECT_TRUE(db_callbacks->forced_close_called()); | 285 EXPECT_TRUE(db_callbacks->forced_close_called()); |
| 286 EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin)); | 286 EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin)); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace content | 289 } // namespace content |
| OLD | NEW |