Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: content/browser/indexed_db/indexed_db_unittest.cc

Issue 2386683003: IndexedDB: Ignore open/delete requests from terminated renderers. (Closed)
Patch Set: Allow deletes to proceed Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 idb_context_(idb_context), 137 idb_context_(idb_context),
138 origin_(origin) {} 138 origin_(origin) {}
139 139
140 void OnSuccess() override {} 140 void OnSuccess() override {}
141 void OnSuccess(const std::vector<base::string16>&) override {} 141 void OnSuccess(const std::vector<base::string16>&) override {}
142 void OnSuccess(std::unique_ptr<IndexedDBConnection> connection, 142 void OnSuccess(std::unique_ptr<IndexedDBConnection> connection,
143 const IndexedDBDatabaseMetadata& metadata) override { 143 const IndexedDBDatabaseMetadata& metadata) override {
144 connection_ = std::move(connection); 144 connection_ = std::move(connection);
145 idb_context_->ConnectionOpened(origin_, connection_.get()); 145 idb_context_->ConnectionOpened(origin_, connection_.get());
146 } 146 }
147 bool IsValid() const override { return true; }
147 148
148 IndexedDBConnection* connection() { return connection_.get(); } 149 IndexedDBConnection* connection() { return connection_.get(); }
149 150
150 protected: 151 protected:
151 ~ForceCloseDBCallbacks() override {} 152 ~ForceCloseDBCallbacks() override {}
152 153
153 private: 154 private:
154 scoped_refptr<IndexedDBContextImpl> idb_context_; 155 scoped_refptr<IndexedDBContextImpl> idb_context_;
155 Origin origin_; 156 Origin origin_;
156 std::unique_ptr<IndexedDBConnection> connection_; 157 std::unique_ptr<IndexedDBConnection> connection_;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 285
285 // Simulate the write failure. 286 // Simulate the write failure.
286 leveldb::Status status = leveldb::Status::IOError("Simulated failure"); 287 leveldb::Status status = leveldb::Status::IOError("Simulated failure");
287 callbacks->connection()->database()->TransactionCommitFailed(status); 288 callbacks->connection()->database()->TransactionCommitFailed(status);
288 289
289 EXPECT_TRUE(db_callbacks->forced_close_called()); 290 EXPECT_TRUE(db_callbacks->forced_close_called());
290 EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin)); 291 EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin));
291 } 292 }
292 293
293 } // namespace content 294 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_dispatcher_host.cc ('k') | content/browser/indexed_db/mock_indexed_db_callbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698