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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/indexed_db/indexed_db_transaction.h" | 8 #include "content/browser/indexed_db/indexed_db_transaction.h" |
9 #include "content/browser/indexed_db/leveldb/leveldb_iterator_impl.h" | 9 #include "content/browser/indexed_db/leveldb/leveldb_iterator_impl.h" |
10 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" | 10 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 std::string class_name_; | 34 std::string class_name_; |
35 std::string method_name_; | 35 std::string method_name_; |
36 int instance_count_; | 36 int instance_count_; |
37 int current_call_num_; | 37 int current_call_num_; |
38 }; | 38 }; |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 namespace content { | 42 namespace content { |
43 | 43 |
| 44 class IndexedDBTestDatabase : public IndexedDBDatabase { |
| 45 public: |
| 46 IndexedDBTestDatabase(const base::string16& name, |
| 47 IndexedDBBackingStore* backing_store, |
| 48 IndexedDBFactory* factory, |
| 49 const IndexedDBDatabase::Identifier& unique_identifier) |
| 50 : IndexedDBDatabase(name, backing_store, factory, unique_identifier) {} |
| 51 |
| 52 protected: |
| 53 ~IndexedDBTestDatabase() override {} |
| 54 |
| 55 size_t GetMaxMessageSizeInBytes() const override { |
| 56 return 10 * 1024 * 1024; // 10MB |
| 57 } |
| 58 }; |
| 59 |
44 class IndexedDBTestTransaction : public IndexedDBTransaction { | 60 class IndexedDBTestTransaction : public IndexedDBTransaction { |
45 public: | 61 public: |
46 IndexedDBTestTransaction( | 62 IndexedDBTestTransaction( |
47 int64 id, | 63 int64 id, |
48 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, | 64 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, |
49 const std::set<int64>& scope, | 65 const std::set<int64>& scope, |
50 blink::WebIDBTransactionMode mode, | 66 blink::WebIDBTransactionMode mode, |
51 IndexedDBDatabase* db, | 67 IndexedDBDatabase* db, |
52 IndexedDBBackingStore::Transaction* backing_store_transaction) | 68 IndexedDBBackingStore::Transaction* backing_store_transaction) |
53 : IndexedDBTransaction(id, | 69 : IndexedDBTransaction(id, |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 243 |
228 MockBrowserTestIndexedDBClassFactory::MockBrowserTestIndexedDBClassFactory() | 244 MockBrowserTestIndexedDBClassFactory::MockBrowserTestIndexedDBClassFactory() |
229 : failure_class_(FAIL_CLASS_NOTHING), | 245 : failure_class_(FAIL_CLASS_NOTHING), |
230 failure_method_(FAIL_METHOD_NOTHING), | 246 failure_method_(FAIL_METHOD_NOTHING), |
231 only_trace_calls_(false) { | 247 only_trace_calls_(false) { |
232 } | 248 } |
233 | 249 |
234 MockBrowserTestIndexedDBClassFactory::~MockBrowserTestIndexedDBClassFactory() { | 250 MockBrowserTestIndexedDBClassFactory::~MockBrowserTestIndexedDBClassFactory() { |
235 } | 251 } |
236 | 252 |
| 253 IndexedDBDatabase* |
| 254 MockBrowserTestIndexedDBClassFactory::CreateIndexedDBDatabase( |
| 255 const base::string16& name, |
| 256 IndexedDBBackingStore* backing_store, |
| 257 IndexedDBFactory* factory, |
| 258 const IndexedDBDatabase::Identifier& unique_identifier) { |
| 259 return new IndexedDBTestDatabase(name, backing_store, factory, |
| 260 unique_identifier); |
| 261 } |
| 262 |
237 IndexedDBTransaction* | 263 IndexedDBTransaction* |
238 MockBrowserTestIndexedDBClassFactory::CreateIndexedDBTransaction( | 264 MockBrowserTestIndexedDBClassFactory::CreateIndexedDBTransaction( |
239 int64 id, | 265 int64 id, |
240 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, | 266 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, |
241 const std::set<int64>& scope, | 267 const std::set<int64>& scope, |
242 blink::WebIDBTransactionMode mode, | 268 blink::WebIDBTransactionMode mode, |
243 IndexedDBDatabase* db, | 269 IndexedDBDatabase* db, |
244 IndexedDBBackingStore::Transaction* backing_store_transaction) { | 270 IndexedDBBackingStore::Transaction* backing_store_transaction) { |
245 return new IndexedDBTestTransaction(id, callbacks, scope, mode, db, | 271 return new IndexedDBTestTransaction(id, callbacks, scope, mode, db, |
246 backing_store_transaction); | 272 backing_store_transaction); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 335 |
310 void MockBrowserTestIndexedDBClassFactory::Reset() { | 336 void MockBrowserTestIndexedDBClassFactory::Reset() { |
311 failure_class_ = FAIL_CLASS_NOTHING; | 337 failure_class_ = FAIL_CLASS_NOTHING; |
312 failure_method_ = FAIL_METHOD_NOTHING; | 338 failure_method_ = FAIL_METHOD_NOTHING; |
313 instance_count_.clear(); | 339 instance_count_.clear(); |
314 fail_on_instance_num_.clear(); | 340 fail_on_instance_num_.clear(); |
315 fail_on_call_num_.clear(); | 341 fail_on_call_num_.clear(); |
316 } | 342 } |
317 | 343 |
318 } // namespace content | 344 } // namespace content |
OLD | NEW |