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

Side by Side Diff: webkit/browser/fileapi/sandbox_directory_database_unittest.cc

Issue 19052005: Move PathIsWritable, DirectoryExists, ContentsEqual, and TextContentsEqual to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
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/browser/fileapi/sandbox_directory_database.h" 5 #include "webkit/browser/fileapi/sandbox_directory_database.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 FileId* file_id_out) { 74 FileId* file_id_out) {
75 FileId file_id; 75 FileId file_id;
76 76
77 FileInfo info; 77 FileInfo info;
78 info.parent_id = parent_id; 78 info.parent_id = parent_id;
79 info.name = name; 79 info.name = name;
80 info.data_path = base::FilePath(data_path).NormalizePathSeparators(); 80 info.data_path = base::FilePath(data_path).NormalizePathSeparators();
81 ASSERT_TRUE(db_->AddFileInfo(info, &file_id)); 81 ASSERT_TRUE(db_->AddFileInfo(info, &file_id));
82 82
83 base::FilePath local_path = path().Append(data_path); 83 base::FilePath local_path = path().Append(data_path);
84 if (!file_util::DirectoryExists(local_path.DirName())) 84 if (!base::DirectoryExists(local_path.DirName()))
85 ASSERT_TRUE(file_util::CreateDirectory(local_path.DirName())); 85 ASSERT_TRUE(file_util::CreateDirectory(local_path.DirName()));
86 86
87 bool created = false; 87 bool created = false;
88 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED; 88 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
89 base::PlatformFile file = base::CreatePlatformFile( 89 base::PlatformFile file = base::CreatePlatformFile(
90 local_path, 90 local_path,
91 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE, 91 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE,
92 &created, &error); 92 &created, &error);
93 ASSERT_EQ(base::PLATFORM_FILE_OK, error); 93 ASSERT_EQ(base::PLATFORM_FILE_OK, error);
94 ASSERT_TRUE(created); 94 ASSERT_TRUE(created);
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 EXPECT_FALSE(db()->IsFileSystemConsistent()); 669 EXPECT_FALSE(db()->IsFileSystemConsistent());
670 670
671 FileId file_id; 671 FileId file_id;
672 EXPECT_TRUE(db()->GetChildWithName(0, kFileName, &file_id)); 672 EXPECT_TRUE(db()->GetChildWithName(0, kFileName, &file_id));
673 EXPECT_EQ(file_id_prev, file_id); 673 EXPECT_EQ(file_id_prev, file_id);
674 674
675 EXPECT_TRUE(db()->IsFileSystemConsistent()); 675 EXPECT_TRUE(db()->IsFileSystemConsistent());
676 } 676 }
677 677
678 } // namespace fileapi 678 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/sandbox_directory_database.cc ('k') | webkit/browser/fileapi/sandbox_file_system_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698