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