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/fileapi/sandbox_database_test_helper.h" | 5 #include "content/browser/fileapi/sandbox_database_test_helper.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
13 #include "base/files/file_enumerator.h" | 13 #include "base/files/file_enumerator.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "webkit/common/fileapi/file_system_util.h" | 16 #include "storage/common/fileapi/file_system_util.h" |
17 | 17 |
18 using fileapi::FilePathToString; | 18 using storage::FilePathToString; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 void CorruptDatabase(const base::FilePath& db_path, | 22 void CorruptDatabase(const base::FilePath& db_path, |
23 leveldb::FileType type, | 23 leveldb::FileType type, |
24 ptrdiff_t offset, | 24 ptrdiff_t offset, |
25 size_t size) { | 25 size_t size) { |
26 base::FileEnumerator file_enum(db_path, false /* not recursive */, | 26 base::FileEnumerator file_enum(db_path, false /* not recursive */, |
27 base::FileEnumerator::DIRECTORIES | base::FileEnumerator::FILES); | 27 base::FileEnumerator::DIRECTORIES | base::FileEnumerator::FILES); |
28 base::FilePath file_path; | 28 base::FilePath file_path; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 EXPECT_TRUE(leveldb::ParseFileName(FilePathToString(file_path.BaseName()), | 84 EXPECT_TRUE(leveldb::ParseFileName(FilePathToString(file_path.BaseName()), |
85 &number, &file_type)); | 85 &number, &file_type)); |
86 if (file_type == type) { | 86 if (file_type == type) { |
87 base::DeleteFile(file_path, false); | 87 base::DeleteFile(file_path, false); |
88 // We may have multiple files for the same type, so don't break here. | 88 // We may have multiple files for the same type, so don't break here. |
89 } | 89 } |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 } // namespace content | 93 } // namespace content |
OLD | NEW |