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

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

Issue 18286004: Move PathExists to 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 base::FilePath temp_path; 78 base::FilePath temp_path;
79 79
80 CreateAndRegisterTemporaryFile(&temp_url, &temp_path); 80 CreateAndRegisterTemporaryFile(&temp_url, &temp_path);
81 81
82 base::PlatformFileError error; 82 base::PlatformFileError error;
83 base::PlatformFileInfo file_info; 83 base::PlatformFileInfo file_info;
84 base::FilePath path; 84 base::FilePath path;
85 85
86 // Make sure the file is there. 86 // Make sure the file is there.
87 ASSERT_TRUE(temp_url.is_valid()); 87 ASSERT_TRUE(temp_url.is_valid());
88 ASSERT_TRUE(file_util::PathExists(temp_path)); 88 ASSERT_TRUE(base::PathExists(temp_path));
89 ASSERT_FALSE(file_util::DirectoryExists(temp_path)); 89 ASSERT_FALSE(file_util::DirectoryExists(temp_path));
90 90
91 // Create a snapshot file. 91 // Create a snapshot file.
92 { 92 {
93 webkit_blob::ScopedFile scoped_file = 93 webkit_blob::ScopedFile scoped_file =
94 file_util()->CreateSnapshotFile(NewOperationContext().get(), 94 file_util()->CreateSnapshotFile(NewOperationContext().get(),
95 temp_url, 95 temp_url,
96 &error, 96 &error,
97 &file_info, 97 &file_info,
98 &path); 98 &path);
99 ASSERT_EQ(base::PLATFORM_FILE_OK, error); 99 ASSERT_EQ(base::PLATFORM_FILE_OK, error);
100 ASSERT_EQ(temp_path, path); 100 ASSERT_EQ(temp_path, path);
101 ASSERT_FALSE(file_info.is_directory); 101 ASSERT_FALSE(file_info.is_directory);
102 102
103 // The file should be still there. 103 // The file should be still there.
104 ASSERT_TRUE(file_util::PathExists(temp_path)); 104 ASSERT_TRUE(base::PathExists(temp_path));
105 ASSERT_EQ(base::PLATFORM_FILE_OK, 105 ASSERT_EQ(base::PLATFORM_FILE_OK,
106 file_util()->GetFileInfo(NewOperationContext().get(), 106 file_util()->GetFileInfo(NewOperationContext().get(),
107 temp_url, &file_info, &path)); 107 temp_url, &file_info, &path));
108 ASSERT_EQ(temp_path, path); 108 ASSERT_EQ(temp_path, path);
109 ASSERT_FALSE(file_info.is_directory); 109 ASSERT_FALSE(file_info.is_directory);
110 } 110 }
111 111
112 // The file's now scoped out. 112 // The file's now scoped out.
113 base::MessageLoop::current()->RunUntilIdle(); 113 base::MessageLoop::current()->RunUntilIdle();
114 114
115 // Now the temporary file and the transient filesystem must be gone too. 115 // Now the temporary file and the transient filesystem must be gone too.
116 ASSERT_FALSE(file_util::PathExists(temp_path)); 116 ASSERT_FALSE(base::PathExists(temp_path));
117 ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, 117 ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
118 file_util()->GetFileInfo(NewOperationContext().get(), 118 file_util()->GetFileInfo(NewOperationContext().get(),
119 temp_url, &file_info, &path)); 119 temp_url, &file_info, &path));
120 } 120 }
121 121
122 } // namespace fileapi 122 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/sandbox_origin_database_unittest.cc ('k') | webkit/browser/quota/quota_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698