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

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

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/fileapi/file_system_dir_url_request_job.h" 5 #include "webkit/fileapi/file_system_dir_url_request_job.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 void TestRequest(const GURL& url) { 101 void TestRequest(const GURL& url) {
102 TestRequestHelper(url, true); 102 TestRequestHelper(url, true);
103 } 103 }
104 104
105 void TestRequestNoRun(const GURL& url) { 105 void TestRequestNoRun(const GURL& url) {
106 TestRequestHelper(url, false); 106 TestRequestHelper(url, false);
107 } 107 }
108 108
109 FileSystemURL CreateURL(const FilePath& file_path) { 109 FileSystemURL CreateURL(const base::FilePath& file_path) {
110 return file_system_context_->CreateCrackedFileSystemURL( 110 return file_system_context_->CreateCrackedFileSystemURL(
111 GURL("http://remote"), 111 GURL("http://remote"),
112 fileapi::kFileSystemTypeTemporary, 112 fileapi::kFileSystemTypeTemporary,
113 file_path); 113 file_path);
114 } 114 }
115 115
116 FileSystemOperationContext* NewOperationContext() { 116 FileSystemOperationContext* NewOperationContext() {
117 FileSystemOperationContext* context(new FileSystemOperationContext( 117 FileSystemOperationContext* context(new FileSystemOperationContext(
118 file_system_context_)); 118 file_system_context_));
119 context->set_allowed_bytes_growth(1024); 119 context->set_allowed_bytes_growth(1024);
120 return context; 120 return context;
121 } 121 }
122 122
123 void CreateDirectory(const base::StringPiece& dir_name) { 123 void CreateDirectory(const base::StringPiece& dir_name) {
124 FilePath path = FilePath().AppendASCII(dir_name); 124 base::FilePath path = base::FilePath().AppendASCII(dir_name);
125 scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); 125 scoped_ptr<FileSystemOperationContext> context(NewOperationContext());
126 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->CreateDirectory( 126 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->CreateDirectory(
127 context.get(), 127 context.get(),
128 CreateURL(path), 128 CreateURL(path),
129 false /* exclusive */, 129 false /* exclusive */,
130 false /* recursive */)); 130 false /* recursive */));
131 } 131 }
132 132
133 void EnsureFileExists(const base::StringPiece file_name) { 133 void EnsureFileExists(const base::StringPiece file_name) {
134 FilePath path = FilePath().AppendASCII(file_name); 134 base::FilePath path = base::FilePath().AppendASCII(file_name);
135 scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); 135 scoped_ptr<FileSystemOperationContext> context(NewOperationContext());
136 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->EnsureFileExists( 136 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->EnsureFileExists(
137 context.get(), CreateURL(path), NULL)); 137 context.get(), CreateURL(path), NULL));
138 } 138 }
139 139
140 void TruncateFile(const base::StringPiece file_name, int64 length) { 140 void TruncateFile(const base::StringPiece file_name, int64 length) {
141 FilePath path = FilePath().AppendASCII(file_name); 141 base::FilePath path = base::FilePath().AppendASCII(file_name);
142 scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); 142 scoped_ptr<FileSystemOperationContext> context(NewOperationContext());
143 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->Truncate( 143 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->Truncate(
144 context.get(), CreateURL(path), length)); 144 context.get(), CreateURL(path), length));
145 } 145 }
146 146
147 base::PlatformFileError GetFileInfo(const FilePath& path, 147 base::PlatformFileError GetFileInfo(const base::FilePath& path,
148 base::PlatformFileInfo* file_info, 148 base::PlatformFileInfo* file_info,
149 FilePath* platform_file_path) { 149 base::FilePath* platform_file_path) {
150 scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); 150 scoped_ptr<FileSystemOperationContext> context(NewOperationContext());
151 return file_util()->GetFileInfo(context.get(), 151 return file_util()->GetFileInfo(context.get(),
152 CreateURL(path), 152 CreateURL(path),
153 file_info, platform_file_path); 153 file_info, platform_file_path);
154 } 154 }
155 155
156 void VerifyListingEntry(const std::string& entry_line, 156 void VerifyListingEntry(const std::string& entry_line,
157 const std::string& name, 157 const std::string& name,
158 const std::string& url, 158 const std::string& url,
159 bool is_directory, 159 bool is_directory,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 CreateDirectory("foo"); 289 CreateDirectory("foo");
290 TestRequestNoRun(CreateFileSystemURL("foo/")); 290 TestRequestNoRun(CreateFileSystemURL("foo/"));
291 // Run StartAsync() and only StartAsync(). 291 // Run StartAsync() and only StartAsync().
292 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); 292 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release());
293 MessageLoop::current()->RunUntilIdle(); 293 MessageLoop::current()->RunUntilIdle();
294 // If we get here, success! we didn't crash! 294 // If we get here, success! we didn't crash!
295 } 295 }
296 296
297 } // namespace (anonymous) 297 } // namespace (anonymous)
298 } // namespace fileapi 298 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_dir_url_request_job.cc ('k') | webkit/fileapi/file_system_directory_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698