| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/mock_browsertest_indexed_db_class_factory.h
" | 5 #include "content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.h
" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 size_t GetMaxMessageSizeInBytes() const override { | 60 size_t GetMaxMessageSizeInBytes() const override { |
| 61 return 10 * 1024 * 1024; // 10MB | 61 return 10 * 1024 * 1024; // 10MB |
| 62 } | 62 } |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 class IndexedDBTestTransaction : public IndexedDBTransaction { | 65 class IndexedDBTestTransaction : public IndexedDBTransaction { |
| 66 public: | 66 public: |
| 67 IndexedDBTestTransaction( | 67 IndexedDBTestTransaction( |
| 68 int64_t id, | 68 int64_t id, |
| 69 base::WeakPtr<IndexedDBConnection> connection, | 69 IndexedDBConnection* connection, |
| 70 const std::set<int64_t>& scope, | 70 const std::set<int64_t>& scope, |
| 71 blink::WebIDBTransactionMode mode, | 71 blink::WebIDBTransactionMode mode, |
| 72 IndexedDBBackingStore::Transaction* backing_store_transaction) | 72 IndexedDBBackingStore::Transaction* backing_store_transaction) |
| 73 : IndexedDBTransaction(id, | 73 : IndexedDBTransaction(id, |
| 74 std::move(connection), | 74 connection, |
| 75 scope, | 75 scope, |
| 76 mode, | 76 mode, |
| 77 backing_store_transaction) {} | 77 backing_store_transaction) {} |
| 78 | 78 |
| 79 protected: | 79 protected: |
| 80 ~IndexedDBTestTransaction() override {} | 80 ~IndexedDBTestTransaction() override {} |
| 81 | 81 |
| 82 // Browser tests run under memory/address sanitizers (etc) may trip the | 82 // Browser tests run under memory/address sanitizers (etc) may trip the |
| 83 // default 60s timeout, so relax it during tests. | 83 // default 60s timeout, so relax it during tests. |
| 84 base::TimeDelta GetInactivityTimeout() const override { | 84 base::TimeDelta GetInactivityTimeout() const override { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 scoped_refptr<IndexedDBDatabase> | 257 scoped_refptr<IndexedDBDatabase> |
| 258 MockBrowserTestIndexedDBClassFactory::CreateIndexedDBDatabase( | 258 MockBrowserTestIndexedDBClassFactory::CreateIndexedDBDatabase( |
| 259 const base::string16& name, | 259 const base::string16& name, |
| 260 scoped_refptr<IndexedDBBackingStore> backing_store, | 260 scoped_refptr<IndexedDBBackingStore> backing_store, |
| 261 scoped_refptr<IndexedDBFactory> factory, | 261 scoped_refptr<IndexedDBFactory> factory, |
| 262 const IndexedDBDatabase::Identifier& unique_identifier) { | 262 const IndexedDBDatabase::Identifier& unique_identifier) { |
| 263 return new IndexedDBTestDatabase(name, backing_store, factory, | 263 return new IndexedDBTestDatabase(name, backing_store, factory, |
| 264 unique_identifier); | 264 unique_identifier); |
| 265 } | 265 } |
| 266 | 266 |
| 267 IndexedDBTransaction* | 267 std::unique_ptr<IndexedDBTransaction> |
| 268 MockBrowserTestIndexedDBClassFactory::CreateIndexedDBTransaction( | 268 MockBrowserTestIndexedDBClassFactory::CreateIndexedDBTransaction( |
| 269 int64_t id, | 269 int64_t id, |
| 270 base::WeakPtr<IndexedDBConnection> connection, | 270 IndexedDBConnection* connection, |
| 271 const std::set<int64_t>& scope, | 271 const std::set<int64_t>& scope, |
| 272 blink::WebIDBTransactionMode mode, | 272 blink::WebIDBTransactionMode mode, |
| 273 IndexedDBBackingStore::Transaction* backing_store_transaction) { | 273 IndexedDBBackingStore::Transaction* backing_store_transaction) { |
| 274 return new IndexedDBTestTransaction(id, std::move(connection), scope, mode, | 274 return std::unique_ptr<IndexedDBTransaction>(new IndexedDBTestTransaction( |
| 275 backing_store_transaction); | 275 id, connection, scope, mode, backing_store_transaction)); |
| 276 } | 276 } |
| 277 | 277 |
| 278 scoped_refptr<LevelDBTransaction> | 278 scoped_refptr<LevelDBTransaction> |
| 279 MockBrowserTestIndexedDBClassFactory::CreateLevelDBTransaction( | 279 MockBrowserTestIndexedDBClassFactory::CreateLevelDBTransaction( |
| 280 LevelDBDatabase* db) { | 280 LevelDBDatabase* db) { |
| 281 instance_count_[FAIL_CLASS_LEVELDB_TRANSACTION] = | 281 instance_count_[FAIL_CLASS_LEVELDB_TRANSACTION] = |
| 282 instance_count_[FAIL_CLASS_LEVELDB_TRANSACTION] + 1; | 282 instance_count_[FAIL_CLASS_LEVELDB_TRANSACTION] + 1; |
| 283 if (only_trace_calls_) { | 283 if (only_trace_calls_) { |
| 284 return new LevelDBTraceTransaction( | 284 return new LevelDBTraceTransaction( |
| 285 db, instance_count_[FAIL_CLASS_LEVELDB_TRANSACTION]); | 285 db, instance_count_[FAIL_CLASS_LEVELDB_TRANSACTION]); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 338 |
| 339 void MockBrowserTestIndexedDBClassFactory::Reset() { | 339 void MockBrowserTestIndexedDBClassFactory::Reset() { |
| 340 failure_class_ = FAIL_CLASS_NOTHING; | 340 failure_class_ = FAIL_CLASS_NOTHING; |
| 341 failure_method_ = FAIL_METHOD_NOTHING; | 341 failure_method_ = FAIL_METHOD_NOTHING; |
| 342 instance_count_.clear(); | 342 instance_count_.clear(); |
| 343 fail_on_instance_num_.clear(); | 343 fail_on_instance_num_.clear(); |
| 344 fail_on_call_num_.clear(); | 344 fail_on_call_num_.clear(); |
| 345 } | 345 } |
| 346 | 346 |
| 347 } // namespace content | 347 } // namespace content |
| OLD | NEW |