OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <cerrno> | 5 #include <cerrno> |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.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 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 namespace content { | 37 namespace content { |
38 class IndexedDBFactory; | 38 class IndexedDBFactory; |
39 } | 39 } |
40 | 40 |
41 namespace { | 41 namespace { |
42 | 42 |
43 class BustedLevelDBDatabase : public LevelDBDatabase { | 43 class BustedLevelDBDatabase : public LevelDBDatabase { |
44 public: | 44 public: |
45 BustedLevelDBDatabase() {} | 45 BustedLevelDBDatabase() |
| 46 : LevelDBDatabase(LevelDBDatabase::kDefaultMaxOpenIteratorsPerDatabase) {} |
46 static std::unique_ptr<LevelDBDatabase> Open( | 47 static std::unique_ptr<LevelDBDatabase> Open( |
47 const base::FilePath& file_name, | 48 const base::FilePath& file_name, |
48 const LevelDBComparator* /*comparator*/) { | 49 const LevelDBComparator* /*comparator*/) { |
49 return base::MakeUnique<BustedLevelDBDatabase>(); | 50 return base::MakeUnique<BustedLevelDBDatabase>(); |
50 } | 51 } |
51 leveldb::Status Get(const base::StringPiece& key, | 52 leveldb::Status Get(const base::StringPiece& key, |
52 std::string* value, | 53 std::string* value, |
53 bool* found, | 54 bool* found, |
54 const LevelDBSnapshot* = 0) override { | 55 const LevelDBSnapshot* = 0) override { |
55 return leveldb::Status::IOError("It's busted!"); | 56 return leveldb::Status::IOError("It's busted!"); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 leveldb_env::kNewLogger, | 165 leveldb_env::kNewLogger, |
165 base::File::FILE_ERROR_FAILED)); | 166 base::File::FILE_ERROR_FAILED)); |
166 scoped_refptr<IndexedDBBackingStore> backing_store4 = | 167 scoped_refptr<IndexedDBBackingStore> backing_store4 = |
167 IndexedDBBackingStore::Open( | 168 IndexedDBBackingStore::Open( |
168 factory, origin, path, request_context_getter, &data_loss_info, | 169 factory, origin, path, request_context_getter, &data_loss_info, |
169 &disk_full, &mock_leveldb_factory, task_runner, clean_journal, &s); | 170 &disk_full, &mock_leveldb_factory, task_runner, clean_journal, &s); |
170 ASSERT_TRUE(s.IsIOError()); | 171 ASSERT_TRUE(s.IsIOError()); |
171 } | 172 } |
172 | 173 |
173 } // namespace | 174 } // namespace |
OLD | NEW |