Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: webkit/fileapi/file_system_database_test_helper.cc

Issue 10855002: Change the type of file_type parameter to int, as the parameter actually takes or-ed bitmasks, (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/fileapi/file_system_database_test_helper.h" 5 #include "webkit/fileapi/file_system_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/stl_util.h" 12 #include "base/stl_util.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "webkit/fileapi/file_system_util.h" 14 #include "webkit/fileapi/file_system_util.h"
15 15
16 namespace fileapi { 16 namespace fileapi {
17 17
18 void CorruptDatabase(const FilePath& db_path, 18 void CorruptDatabase(const FilePath& db_path,
19 leveldb::FileType type, 19 leveldb::FileType type,
20 ptrdiff_t offset, 20 ptrdiff_t offset,
21 size_t size) { 21 size_t size) {
22 file_util::FileEnumerator file_enum( 22 file_util::FileEnumerator file_enum(
23 db_path, false /* recursive */, 23 db_path, false /* recursive */,
jar (doing other things) 2012/08/06 18:27:02 nit: push line 23 onto the end of line 22.
Haruki Sato 2012/08/06 23:22:18 Done.
24 static_cast<file_util::FileEnumerator::FileType>( 24 (file_util::FileEnumerator::DIRECTORIES |
25 file_util::FileEnumerator::DIRECTORIES | 25 file_util::FileEnumerator::FILES));
26 file_util::FileEnumerator::FILES));
27 FilePath file_path; 26 FilePath file_path;
28 FilePath picked_file_path; 27 FilePath picked_file_path;
29 uint64 picked_file_number = kuint64max; 28 uint64 picked_file_number = kuint64max;
30 29
31 while (!(file_path = file_enum.Next()).empty()) { 30 while (!(file_path = file_enum.Next()).empty()) {
32 uint64 number = kuint64max; 31 uint64 number = kuint64max;
33 leveldb::FileType file_type; 32 leveldb::FileType file_type;
34 EXPECT_TRUE(leveldb::ParseFileName(FilePathToString(file_path.BaseName()), 33 EXPECT_TRUE(leveldb::ParseFileName(FilePathToString(file_path.BaseName()),
35 &number, &file_type)); 34 &number, &file_type));
36 if (file_type == type && 35 if (file_type == type &&
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 74
76 int written_size = base::WritePlatformFile(file, offset, 75 int written_size = base::WritePlatformFile(file, offset,
77 vector_as_array(&buf), buf.size()); 76 vector_as_array(&buf), buf.size());
78 EXPECT_GT(written_size, 0); 77 EXPECT_GT(written_size, 0);
79 EXPECT_EQ(buf.size(), static_cast<size_t>(written_size)); 78 EXPECT_EQ(buf.size(), static_cast<size_t>(written_size));
80 79
81 base::ClosePlatformFile(file); 80 base::ClosePlatformFile(file);
82 } 81 }
83 82
84 } // namespace fileapi 83 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698