OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/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 "webkit/common/fileapi/file_system_util.h" |
17 | 17 |
18 namespace fileapi { | 18 using fileapi::FilePathToString; |
| 19 |
| 20 namespace content { |
19 | 21 |
20 void CorruptDatabase(const base::FilePath& db_path, | 22 void CorruptDatabase(const base::FilePath& db_path, |
21 leveldb::FileType type, | 23 leveldb::FileType type, |
22 ptrdiff_t offset, | 24 ptrdiff_t offset, |
23 size_t size) { | 25 size_t size) { |
24 base::FileEnumerator file_enum(db_path, false /* not recursive */, | 26 base::FileEnumerator file_enum(db_path, false /* not recursive */, |
25 base::FileEnumerator::DIRECTORIES | base::FileEnumerator::FILES); | 27 base::FileEnumerator::DIRECTORIES | base::FileEnumerator::FILES); |
26 base::FilePath file_path; | 28 base::FilePath file_path; |
27 base::FilePath picked_file_path; | 29 base::FilePath picked_file_path; |
28 uint64 picked_file_number = kuint64max; | 30 uint64 picked_file_number = kuint64max; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 leveldb::FileType file_type; | 83 leveldb::FileType file_type; |
82 EXPECT_TRUE(leveldb::ParseFileName(FilePathToString(file_path.BaseName()), | 84 EXPECT_TRUE(leveldb::ParseFileName(FilePathToString(file_path.BaseName()), |
83 &number, &file_type)); | 85 &number, &file_type)); |
84 if (file_type == type) { | 86 if (file_type == type) { |
85 base::DeleteFile(file_path, false); | 87 base::DeleteFile(file_path, false); |
86 // 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. |
87 } | 89 } |
88 } | 90 } |
89 } | 91 } |
90 | 92 |
91 } // namespace fileapi | 93 } // namespace content |
OLD | NEW |