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